Rename max_surf_banks to max_particles

This commit is contained in:
YoungHui Park 2021-01-18 11:49:02 -06:00
parent 26c3043726
commit 5f48ec9eeb
10 changed files with 22 additions and 22 deletions

View file

@ -751,7 +751,7 @@ This element has the following attributes/sub-elements:
*Default*: None
:max_surf_banks:
: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

@ -88,7 +88,7 @@ extern RunMode run_mode; //!< Run mode (eigenvalue, fixed src, e
extern std::unordered_set<int> sourcepoint_batch; //!< Batches when source should be written
extern std::unordered_set<int> statepoint_batch; //!< Batches when state should be written
extern std::unordered_set<int> source_write_surf_id; //!< Surface ids where sources will be written
extern int64_t max_surf_banks; //!< maximum number of particles to be banked on surfaces per process
extern int64_t max_particles; //!< maximum number of particles to be banked on surfaces per process
extern TemperatureMethod temperature_method; //!< method for choosing temperatures
extern double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures
extern double temperature_default; //!< Default T in [K]

View file

@ -152,7 +152,7 @@ class Settings:
:surface_ids: List of surface ids at which crossing particles are to be
banked (int)
:max_surf_banks: Maximum number of particles to be banked on surfaces
:max_particles: Maximum number of particles to be banked on surfaces
per process (int)
survival_biasing : bool
Indicate whether survival biasing is to be used
@ -604,14 +604,14 @@ class Settings:
cv.check_type('surface source writing options', surf_source_write, Mapping)
for key, value in surf_source_write.items():
cv.check_value('surface source writing key', key,
('surface_ids', 'max_surf_banks'))
('surface_ids', 'max_particles'))
if key == 'surface_ids':
cv.check_type('surface ids for source banking', value,
Iterable, Integral)
for surf_id in value:
cv.check_greater_than('surface id for source banking',
surf_id, 0)
elif key == 'max_surf_banks':
elif key == 'max_particles':
cv.check_type('maximum particle banks on surfaces per process',
value, Integral)
cv.check_greater_than('maximum particle banks on surfaces per process',
@ -954,9 +954,9 @@ class Settings:
subelement = ET.SubElement(element, "surface_ids")
subelement.text = ' '.join(
str(x) for x in self._surf_source_write['surface_ids'])
if 'max_surf_banks' in self._surf_source_write:
subelement = ET.SubElement(element, "max_surf_banks")
subelement.text = str(self._surf_source_write['max_surf_banks'])
if 'max_particles' in self._surf_source_write:
subelement = ET.SubElement(element, "max_particles")
subelement.text = str(self._surf_source_write['max_particles'])
def _create_confidence_intervals(self, root):
if self._confidence_intervals is not None:
@ -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_surf_banks'):
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_surf_banks'):
elif key in ('max_particles'):
value = int(value)
self.surf_source_write[key] = value

View file

@ -146,8 +146,8 @@ element settings {
element surf_source_write {
(element surface_ids { list { xsd:positiveInteger+ } } |
attribute surface_ids { list { xsd:positiveInteger+ } }) &
(element max_surf_banks { xsd:positiveInteger } |
attribute max_surf_banks { xsd:positiveInteger })
(element max_particles { xsd:positiveInteger } |
attribute max_particles { xsd:positiveInteger })
}? &
element survival_biasing { xsd:boolean }? &

View file

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

View file

@ -101,7 +101,7 @@ RunMode run_mode {RunMode::UNSET};
std::unordered_set<int> sourcepoint_batch;
std::unordered_set<int> statepoint_batch;
std::unordered_set<int> source_write_surf_id;
int64_t max_surf_banks;
int64_t max_particles;
TemperatureMethod temperature_method {TemperatureMethod::NEAREST};
double temperature_tolerance {10.0};
double temperature_default {293.6};
@ -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_surf_banks")) {
max_surf_banks = std::stoi(get_node_value(node_ssw, "max_surf_banks"));
if (check_for_node(node_ssw, "max_particles")) {
max_particles = std::stoi(get_node_value(node_ssw, "max_particles"));
}
}

View file

@ -289,7 +289,7 @@ void allocate_banks()
if (settings::surf_source_write) {
// Allocate surface source bank
simulation::surf_source_bank.reserve(settings::max_surf_banks);
simulation::surf_source_bank.reserve(settings::max_particles);
}
}

View file

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

View file

@ -47,7 +47,7 @@ def model(request):
openmc_model.settings.source = pt_src
openmc_model.settings.surf_source_write = {'surface_ids': [1],
'max_surf_banks': 1000}
'max_particles': 1000}
elif surf_src_op == 'read':
openmc_model.settings.surf_src_read = {'path': 'surface_source_true.h5'}

View file

@ -21,7 +21,7 @@ def test_export_to_xml(run_in_tmpdir):
'write': True, 'overwrite': True}
s.statepoint = {'batches': [50, 150, 500, 1000]}
s.surf_source_read = {'path': 'surface_source_1.h5'}
s.surf_source_write = {'surface_ids': [2], 'max_surf_banks': 200}
s.surf_source_write = {'surface_ids': [2], 'max_particles': 200}
s.confidence_intervals = True
s.ptables = True
s.seed = 17
@ -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_surf_banks': 200}
assert s.surf_source_write == {'surface_ids': [2], 'max_particles': 200}
assert s.confidence_intervals
assert s.ptables
assert s.seed == 17