Updated Summary and StatePoint APIs to use Nuclide ZAIDs rather than internal indices

This commit is contained in:
Will Boyd 2015-03-19 18:27:11 -04:00
parent bdcc4eb254
commit a58953ca07
2 changed files with 10 additions and 10 deletions

View file

@ -654,14 +654,14 @@ class StatePoint(object):
for tally_id, tally in self._tallies.items():
nuclides = copy.deepcopy(tally._nuclides)
nuclide_zaids = copy.deepcopy(tally._nuclides)
for nuclide_index in nuclides:
tally.remove_nuclide(nuclide_index)
if nuclide_index == -1:
for nuclide_zaid in nuclide_zaids:
tally.remove_nuclide(nuclide_zaid)
if nuclide_zaid == -1:
tally.add_nuclide(openmc.Nuclide('total'))
else:
tally.add_nuclide(summary.nuclides[nuclide_index])
tally.add_nuclide(summary.nuclides[nuclide_zaid])
for filter in tally._filters:
@ -730,4 +730,4 @@ class StatePoint(object):
if self._hdf5:
return str(self._f[path].value)
else:
return str(self._get_data(n, 's', 1)[0])
return str(self._get_data(n, 's', 1)[0])

View file

@ -82,12 +82,12 @@ class Summary(object):
# Read the Nuclide's cross-section identifier (e.g., '70c')
xs = alias.split('.')[1]
# Initialize this Nuclide and add it to the global dictionary of Nuclides
# Initialize this Nuclide and add to global dictionary of Nuclides
if 'nat' in name:
self.nuclides[index] = openmc.Element(name=name, xs=xs)
self.nuclides[zaid] = openmc.Element(name=name, xs=xs)
else:
self.nuclides[index] = openmc.Nuclide(name=name, xs=xs)
self.nuclides[index].set_zaid(zaid)
self.nuclides[zaid] = openmc.Nuclide(name=name, xs=xs)
self.nuclides[zaid].set_zaid(zaid)
def _read_materials(self):