This commit is contained in:
AI-Pranto 2021-03-03 00:42:39 +06:00
parent 903ed39e33
commit 8c289fc5bd
6 changed files with 10 additions and 10 deletions

View file

@ -751,7 +751,7 @@ This element has the following attributes/sub-elements:
*Default*: None
:max_surface_particles:
:max_particles:
An integer indicating the maximum number of particles to be banked on
specified surfaces per processor. The size of source bank in
``surface_source.h5`` is limited to this value times the number of

View file

@ -955,7 +955,7 @@ class Settings:
subelement.text = ' '.join(
str(x) for x in self._surf_source_write['surface_ids'])
if 'max_particles' in self._surf_source_write:
subelement = ET.SubElement(element, "max_surface_particles")
subelement = ET.SubElement(element, "max_particles")
subelement.text = str(self._surf_source_write['max_particles'])
def _create_confidence_intervals(self, root):
@ -1230,12 +1230,12 @@ class Settings:
def _surf_source_write_from_xml_element(self, root):
elem = root.find('surf_source_write')
if elem is not None:
for key in ('surface_ids', 'max_surface_particles'):
for key in ('surface_ids', 'max_particles'):
value = get_text(elem, key)
if value is not None:
if key == 'surface_ids':
value = [int(x) for x in value.split()]
elif key in ('max_surface_particles'):
elif key in ('max_particles'):
value = int(value)
self.surf_source_write[key] = value

View file

@ -670,10 +670,10 @@
</attribute>
</choice>
<choice>
<element name="max_surface_particles">
<element name="max_particles">
<data type="positiveInteger"/>
</element>
<attribute name="max_surface_particles">
<attribute name="max_particles">
<data type="positiveInteger"/>
</attribute>
</choice>

View file

@ -655,8 +655,8 @@ void read_settings_xml()
}
// Get maximum number of particles to be banked per surface
if (check_for_node(node_ssw, "max_surface_particles")) {
max_surface_particles = std::stoll(get_node_value(node_ssw, "max_surface_particles"));
if (check_for_node(node_ssw, "max_particles")) {
max_surface_particles = std::stoll(get_node_value(node_ssw, "max_particles"));
}
}

View file

@ -24,7 +24,7 @@
</source>
<surf_source_write>
<surface_ids>1</surface_ids>
<max_surface_particles>1000</max_surface_particles>
<max_particles>1000</max_particles>
</surf_source_write>
<seed>1</seed>
</settings>

View file

@ -79,7 +79,7 @@ def test_export_to_xml(run_in_tmpdir):
'write': True, 'overwrite': True}
assert s.statepoint == {'batches': [50, 150, 500, 1000]}
assert s.surf_source_read == {'path': 'surface_source_1.h5'}
assert s.surf_source_write == {'surface_ids': [2], 'max_surface_particles': 200}
assert s.surf_source_write == {'surface_ids': [2], 'max_particles': 200}
assert s.confidence_intervals
assert s.ptables
assert s.seed == 17