mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Fix bugs in Material.remove_nuclide and Material.remove_element
This commit is contained in:
parent
97d99f1625
commit
247c2461c5
1 changed files with 9 additions and 10 deletions
|
|
@ -464,16 +464,16 @@ class Material(object):
|
|||
Nuclide to remove
|
||||
|
||||
"""
|
||||
cv.check_type('nuclide', nuclide, string_types + (openmc.Nuclide,))
|
||||
|
||||
if not isinstance(nuclide, openmc.Nuclide):
|
||||
msg = 'Unable to remove a Nuclide "{}" in Material ID="{}" ' \
|
||||
'since it is not a Nuclide'.format(self._id, nuclide)
|
||||
raise ValueError(msg)
|
||||
if isinstance(nuclide, string_types):
|
||||
nuclide = openmc.Nuclide(nuclide)
|
||||
|
||||
# If the Material contains the Nuclide, delete it
|
||||
for nuc in self._nuclides:
|
||||
if nuclide == nuc:
|
||||
if nuclide == nuc[0]:
|
||||
self._nuclides.remove(nuc)
|
||||
break
|
||||
|
||||
def add_macroscopic(self, macroscopic):
|
||||
"""Add a macroscopic to the material. This will also set the
|
||||
|
|
@ -625,15 +625,14 @@ class Material(object):
|
|||
Element to remove
|
||||
|
||||
"""
|
||||
cv.check_type('element', element, string_types + (openmc.Element,))
|
||||
|
||||
if not isinstance(element, openmc.Element):
|
||||
msg = 'Unable to remove "{}" in Material ID="{}" ' \
|
||||
'since it is not an Element'.format(self.id, element)
|
||||
raise ValueError(msg)
|
||||
if isinstance(element, string_types):
|
||||
element = openmc.Element(element)
|
||||
|
||||
# If the Material contains the Element, delete it
|
||||
for elm in self._elements:
|
||||
if element == elm:
|
||||
if element == elm[0]:
|
||||
self._elements.remove(elm)
|
||||
|
||||
def add_s_alpha_beta(self, name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue