Changes in summary.py from PullRequest Inc. review

This commit is contained in:
Paul Romano 2020-04-01 13:34:27 -05:00
parent 1fa17f69e5
commit 2e54c170f1

View file

@ -54,9 +54,7 @@ class Summary:
self._read_nuclides()
self._read_macroscopics()
with warnings.catch_warnings():
warnings.simplefilter("ignore", openmc.IDWarning)
self._read_geometry()
self._read_geometry()
@property
def date_and_time(self):
@ -93,20 +91,25 @@ class Summary:
if 'macroscopics/names' in self._f:
names = self._f['macroscopics/names'][()]
for name in names:
self._macroscopics = name.decode()
self._macroscopics.append(name.decode())
def _read_geometry(self):
with warnings.catch_warnings():
# We expect that new objects will be created with the same IDs as
# objects that might already exist in the Python process (if it was
# also used to create the model), so silence ID warnings
warnings.simplefilter("ignore", openmc.IDWarning)
# Read in and initialize the Materials
self._read_materials()
# Read in and initialize the Materials
self._read_materials()
# Read native geometry only
if "dagmc" not in self._f['geometry'].attrs.keys():
self._read_surfaces()
cell_fills = self._read_cells()
self._read_universes()
self._read_lattices()
self._finalize_geometry(cell_fills)
# Read native geometry only
if "dagmc" not in self._f['geometry'].attrs.keys():
self._read_surfaces()
cell_fills = self._read_cells()
self._read_universes()
self._read_lattices()
self._finalize_geometry(cell_fills)
def _read_materials(self):
for group in self._f['materials'].values():
@ -134,11 +137,11 @@ class Summary:
fill_type = group['fill_type'][()].decode()
if fill_type == 'material':
fill = group['material'][()]
fill_id = group['material'][()]
elif fill_type == 'universe':
fill = group['fill'][()]
fill_id = group['fill'][()]
else:
fill = group['lattice'][()]
fill_id = group['lattice'][()]
region = group['region'][()].decode() if 'region' in group else ''
@ -161,7 +164,7 @@ class Summary:
cell.temperature = group['temperature'][()]
# Store Cell fill information for after Universe/Lattice creation
cell_fills[cell.id] = (fill_type, fill)
cell_fills[cell.id] = (fill_type, fill_id)
# Generate Region object given infix expression
if region: