Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2555b95
Factor out to_xml_element methods for XML classes
pshriwise Nov 3, 2022
ad746cb
Writing all main nodes to a single XML file
pshriwise Nov 4, 2022
a09a61e
Writing all output under a single root node
pshriwise Nov 4, 2022
7a9d8c9
Keeping old option to write separate XMLs so I can still use to tests…
pshriwise Nov 4, 2022
0409652
Adding signatures for reading information from an XML node where nece…
pshriwise Nov 4, 2022
cdd2a6b
Correcting doc scope and some reads
pshriwise Nov 4, 2022
bec9bf6
Refactoring model read into it's own function.
pshriwise Nov 4, 2022
81aa653
Factoring out some common lines between reader functions
pshriwise Nov 4, 2022
9391f17
Adding import for single or multiple XMLs
pshriwise Nov 4, 2022
af6b0af
Fix loop variable overwrite
pshriwise Nov 4, 2022
5ac6e87
Properly call read_plots_xml
pshriwise Nov 4, 2022
2e71658
Other bug fixes
pshriwise Nov 4, 2022
b4dcc30
Removing walrus operator
pshriwise Nov 4, 2022
611475a
Restructureing input function calls a little
pshriwise Nov 5, 2022
021bb28
Adding initial test for exporting model.xmls. Correcting material maps
pshriwise Nov 5, 2022
abd3d51
Correcting doc strings for material mapping sent to
pshriwise Nov 5, 2022
662d83a
Running some existing regression tests using single XML file
pshriwise Nov 10, 2022
1e7dbe9
Making sure meshes are only written once to a model.xml file
pshriwise Nov 10, 2022
d034e1d
Apply suggestions from code review
pshriwise Nov 24, 2022
b76825f
Addressing some comments from PR
pshriwise Nov 24, 2022
d984716
Adding ability to specify an input filename to the executable or to t…
pshriwise Nov 24, 2022
366f9e9
Test comment and updated error messages
pshriwise Nov 24, 2022
1e6cb68
Addressing a few more comments in C++ code
pshriwise Nov 24, 2022
7a203fb
Correcting parenthesis
pshriwise Nov 24, 2022
fe47d56
Spot check in error message from failed run
pshriwise Nov 24, 2022
6f7a6fe
Updating model XML file format w/ indentation.
pshriwise Nov 25, 2022
5d1ead2
Addressing some more PR comments. A couple of typo fixes too.
pshriwise Nov 26, 2022
e7f95b0
Docstring correction and a note about the recursion
pshriwise Nov 28, 2022
b3225be
Adding executor tests
pshriwise Nov 29, 2022
72ff942
Checking RuntimeError message correctly
pshriwise Nov 29, 2022
7f5d2a5
Refactoring model_xml regression tests a bit and adding input checking
pshriwise Nov 29, 2022
3f4a9eb
Reordering geometry XML element attributes
pshriwise Nov 29, 2022
83cf684
Updating expected inputs with reordering
pshriwise Nov 29, 2022
2c27d10
Moving other relevant XML reorder calls and updating expected input a…
pshriwise Nov 29, 2022
cd7c3bf
Updates to import/export methods suggested by @paulromano
pshriwise Dec 6, 2022
ef2f690
Updating handling of single XML input to leverage existing settings::…
pshriwise Dec 6, 2022
574845b
Moving Model.from_separate_xmls back to Model.from_xml.
pshriwise Dec 6, 2022
270331a
Adding function to check if a path is a directory
pshriwise Dec 6, 2022
bc1791d
Updates to simplify model filename checking
pshriwise Dec 6, 2022
5634d83
Changing name of input argument for Python executor
pshriwise Dec 6, 2022
d639d1d
Docstring correction
pshriwise Dec 6, 2022
939adbe
Updating tests to reflect changes to API
pshriwise Dec 6, 2022
7fdfed2
Some cleanup of file utils
pshriwise Dec 7, 2022
55d77cf
Small improvements to read_model_xml
pshriwise Dec 7, 2022
7873b4d
Update tests/regression_tests/model_xml/test.py
pshriwise Dec 7, 2022
ef13643
Some housekeeping in the Python classes
pshriwise Dec 7, 2022
9c942db
Correct use of mesh memo in single XML export
pshriwise Dec 7, 2022
916863f
Renaming and docstring/comment updates
pshriwise Dec 7, 2022
145594e
Apply @paulromano suggestions from code review
pshriwise Dec 13, 2022
f3bcad3
Addressing comments from @paulromano
pshriwise Dec 13, 2022
43687e5
Improve comment on recursion arguments
pshriwise Dec 13, 2022
2eca57a
Adding mesh memo to Settings.from_xml_element
pshriwise Dec 14, 2022
25f2bd5
Several small fixes
paulromano Dec 23, 2022
64aee3b
Merge pull request #16 from paulromano/model-xml-pr
pshriwise Dec 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Incorporating suggestions from @paulromano

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
  • Loading branch information
pshriwise and paulromano committed Dec 6, 2022
commit d034e1de9c8fe166f38624ee872b8bc46643c66a
2 changes: 1 addition & 1 deletion openmc/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def from_xml(cls, path='geometry.xml', materials=None):
----------
path : str, optional
Path to geometry XML file
materials : dict
materials : dict
Dictionary mapping material ID strings to :class:`openmc.Material`
instances (defined in :math:`openmc.Geometry.from_xml`)
Comment thread
paulromano marked this conversation as resolved.
Resolved

Expand Down
6 changes: 2 additions & 4 deletions openmc/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ def from_model_xml(cls, path='model.xml'):
model.settings = openmc.Settings.from_xml_element(root.find('settings'))
model.materials = openmc.Materials.from_xml_element(root.find('materials'))
materials = {str(m.id): m for m in model.materials}
model.geometry = \
openmc.Geometry.from_xml_element(root.find('geometry'), materials)
model.geometry = .Geometry.from_xml_element(root.find('geometry'), materials)

# gather meshses from other classes before reading the tally node
Comment thread
pshriwise marked this conversation as resolved.
Resolved
meshes = {}
Expand Down Expand Up @@ -542,8 +541,7 @@ def export_to_single_xml(self, directory='.', remove_surfs=False):
materials = openmc.Materials(self.geometry.get_all_materials()
.values())

with open(d, 'w', encoding='utf-8',
errors='xmlcharrefreplace') as fh:
with open(d, 'w', encoding='utf-8', errors='xmlcharrefreplace') as fh:
# write the XML header
fh.write("<?xml version='1.0' encoding='utf-8'?>\n")
fh.write("<model>\n")
Expand Down
16 changes: 8 additions & 8 deletions tests/regression_tests/model_xml/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ def _cleanup(self):


models = [
'adj_cell_rotation_model',
'lattice_mult_model',
'energy_laws_model',
'photon_prod_model'
'adj_cell_rotation_model',
'lattice_mult_model',
'energy_laws_model',
'photon_prod_model'
]
paths = [
'../adj_cell_rotation',
'../lattice_multiple',
'../energy_laws',
'../photon_production'
'../adj_cell_rotation',
'../lattice_multiple',
'../energy_laws',
'../photon_production'
]


Expand Down
2 changes: 0 additions & 2 deletions tests/unit_tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import openmc
import openmc.lib

from .. import cdtemp


@pytest.fixture(scope='function')
def pin_model_attributes():
Expand Down