Skip to content

Commit

Permalink
Adjusting source write for unstructured mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Apr 8, 2024
1 parent e3c3e5a commit 84d774c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions openmc/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,13 @@ def populate_xml_element(self, elem: ET.Element):
elem.set("mesh", str(self.mesh.id))

# write in the order of mesh indices
for idx in self.mesh.indices:
idx = tuple(i - 1 for i in idx)
elem.append(self.sources[idx].to_xml_element())
if isinstance(self.mesh, openmc.UnstructuredMesh):
for s in self.sources:
elem.append(s.to_xml_element())
else:
for idx in self.mesh.indices:
idx = tuple(i - 1 for i in idx)
elem.append(self.sources[idx].to_xml_element())

@classmethod
def from_xml_element(cls, elem: ET.Element, meshes) -> openmc.MeshSource:
Expand Down

0 comments on commit 84d774c

Please sign in to comment.