diff --git a/openmc/universe.py b/openmc/universe.py index ccd0cb27c3..237ddce1f7 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -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