mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Apply @paulromano suggestions from code review
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
916863f82a
commit
145594ebb8
6 changed files with 7 additions and 8 deletions
|
|
@ -16,7 +16,7 @@ def clean_indentation(element, level=0, spaces_per_level=2, trailing_indent=True
|
|||
"""
|
||||
i = "\n" + level*spaces_per_level*" "
|
||||
|
||||
# ensure there's awlays some tail for the element passed in
|
||||
# ensure there's always some tail for the element passed in
|
||||
if not element.tail:
|
||||
element.tail = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ def _run(args, output, cwd):
|
|||
p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
|
||||
print(args)
|
||||
# Capture and re-print OpenMC output in real-time
|
||||
lines = []
|
||||
while True:
|
||||
|
|
@ -146,7 +145,7 @@ def plot_geometry(output=True, openmc_exec='openmc', cwd='.', path_input=None):
|
|||
"""
|
||||
args = [openmc_exec, '-p']
|
||||
if path_input is not None:
|
||||
args += ['-i', path_input]
|
||||
args += [path_input]
|
||||
_run([openmc_exec, '-p'], output, cwd)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1548,7 +1548,6 @@ class Materials(cv.CheckedList):
|
|||
|
||||
return materials
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_xml(cls, path: PathLike = 'materials.xml'):
|
||||
"""Generate materials collection from XML file
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class Model:
|
|||
materials = {str(m.id): m for m in model.materials}
|
||||
model.geometry = openmc.Geometry.from_xml_element(root.find('geometry'), materials)
|
||||
|
||||
# gather meshses from other classes before reading the tally node
|
||||
# gather meshes from other classes before reading the tally node
|
||||
meshes = {}
|
||||
if model.settings.entropy_mesh is not None:
|
||||
meshes[model.settings.entropy_mesh.id] = model.settings.entropy_mesh
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ bool read_model_xml() {
|
|||
auto other_inputs = {"materials.xml", "geometry.xml", "settings.xml", "tallies.xml", "plots.xml"};
|
||||
for (const auto& input : other_inputs) {
|
||||
if (file_exists(settings::path_input + input)) {
|
||||
warning((fmt::format("Other XML file input(s) are present. These file "
|
||||
warning((fmt::format("Other XML file input(s) are present. These files "
|
||||
"will be ignored in favor of the {} file.",
|
||||
model_filename)));
|
||||
break;
|
||||
|
|
@ -371,7 +371,7 @@ bool read_model_xml() {
|
|||
// Read geometry
|
||||
if (!check_for_node(root, "geometry")) {
|
||||
fatal_error(fmt::format(
|
||||
"No <geometry> node present in the model.xml_file.", model_filename));
|
||||
"No <geometry> node present in the {} file.", model_filename));
|
||||
}
|
||||
read_geometry_xml(root.child("geometry"));
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ def test_input_arg(run_in_tmpdir):
|
|||
openmc.run()
|
||||
|
||||
# make sure the executable isn't falling back on the separate XMLs
|
||||
[os.remove(f) for f in glob.glob('*.xml')]
|
||||
for f in glob.glob('*.xml'):
|
||||
os.remove(f)
|
||||
# now export to a single XML file with a custom name
|
||||
pincell.export_to_xml(path='pincell.xml', separate_xmls=False)
|
||||
assert Path('pincell.xml').exists()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue