mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Merge pull request #563 from smharper/pyapi_void_hotfix
Fix bug with void fills in the Python API
This commit is contained in:
commit
a9a37a326a
1 changed files with 17 additions and 17 deletions
|
|
@ -397,28 +397,28 @@ class Cell(object):
|
|||
|
||||
def create_xml_subelement(self, xml_element):
|
||||
element = ET.Element("cell")
|
||||
element.set("id", str(self._id))
|
||||
element.set("id", str(self.id))
|
||||
|
||||
if len(self._name) > 0:
|
||||
element.set("name", str(self._name))
|
||||
element.set("name", str(self.name))
|
||||
|
||||
if isinstance(self._fill, openmc.Material):
|
||||
element.set("material", str(self._fill._id))
|
||||
if isinstance(self.fill, basestring):
|
||||
element.set("material", "void")
|
||||
|
||||
elif isinstance(self._fill, Iterable):
|
||||
elif isinstance(self.fill, openmc.Material):
|
||||
element.set("material", str(self.fill.id))
|
||||
|
||||
elif isinstance(self.fill, Iterable):
|
||||
element.set("material", ' '.join([m if m == 'void' else str(m.id)
|
||||
for m in self.fill]))
|
||||
|
||||
elif isinstance(self._fill, (Universe, Lattice)):
|
||||
element.set("fill", str(self._fill._id))
|
||||
self._fill.create_xml_subelement(xml_element)
|
||||
|
||||
elif self._fill.strip().lower() == "void":
|
||||
element.set("material", "void")
|
||||
elif isinstance(self.fill, (Universe, Lattice)):
|
||||
element.set("fill", str(self.fill.id))
|
||||
self.fill.create_xml_subelement(xml_element)
|
||||
|
||||
else:
|
||||
element.set("fill", str(self._fill))
|
||||
self._fill.create_xml_subelement(xml_element)
|
||||
element.set("fill", str(self.fill))
|
||||
self.fill.create_xml_subelement(xml_element)
|
||||
|
||||
if self.region is not None:
|
||||
# Set the region attribute with the region specification
|
||||
|
|
@ -445,11 +445,11 @@ class Cell(object):
|
|||
# Call the recursive function from the top node
|
||||
create_surface_elements(self.region, xml_element)
|
||||
|
||||
if self._translation is not None:
|
||||
element.set("translation", ' '.join(map(str, self._translation)))
|
||||
if self.translation is not None:
|
||||
element.set("translation", ' '.join(map(str, self.translation)))
|
||||
|
||||
if self._rotation is not None:
|
||||
element.set("rotation", ' '.join(map(str, self._rotation)))
|
||||
if self.rotation is not None:
|
||||
element.set("rotation", ' '.join(map(str, self.rotation)))
|
||||
|
||||
return element
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue