mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
A couple more fixes for mesh to/from XML
This commit is contained in:
parent
c0ede1ec8d
commit
81674a1c2d
2 changed files with 9 additions and 4 deletions
|
|
@ -231,8 +231,9 @@ class Mesh(IDManagerMixin):
|
|||
element.set("id", str(self._id))
|
||||
element.set("type", self._type)
|
||||
|
||||
subelement = ET.SubElement(element, "dimension")
|
||||
subelement.text = ' '.join(map(str, self._dimension))
|
||||
if self._dimension is not None:
|
||||
subelement = ET.SubElement(element, "dimension")
|
||||
subelement.text = ' '.join(map(str, self._dimension))
|
||||
|
||||
subelement = ET.SubElement(element, "lower_left")
|
||||
subelement.text = ' '.join(map(str, self._lower_left))
|
||||
|
|
@ -264,7 +265,10 @@ class Mesh(IDManagerMixin):
|
|||
"""
|
||||
mesh_id = int(get_text(elem, 'id'))
|
||||
mesh = cls(mesh_id)
|
||||
mesh.type = get_text(elem, 'type')
|
||||
|
||||
mesh_type = get_text(elem, 'type')
|
||||
if mesh_type is not None:
|
||||
mesh.type = mesh_type
|
||||
|
||||
dimension = get_text(elem, 'dimension')
|
||||
if dimension is not None:
|
||||
|
|
|
|||
|
|
@ -551,7 +551,8 @@ class Settings(object):
|
|||
@entropy_mesh.setter
|
||||
def entropy_mesh(self, entropy):
|
||||
cv.check_type('entropy mesh', entropy, Mesh)
|
||||
cv.check_length('entropy mesh dimension', entropy.dimension, 3)
|
||||
if entropy.dimension:
|
||||
cv.check_length('entropy mesh dimension', entropy.dimension, 3)
|
||||
cv.check_length('entropy mesh lower-left corner', entropy.lower_left, 3)
|
||||
cv.check_length('entropy mesh upper-right corner', entropy.upper_right, 3)
|
||||
self._entropy_mesh = entropy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue