Initializing internal volume parameter and using len() to size bins (so we aren't assuming use of a numpy array)

This commit is contained in:
Patrick Shriwise 2020-02-16 09:16:07 -06:00
parent b1023a2afa
commit 43a4bd4ac7
2 changed files with 2 additions and 1 deletions

View file

@ -750,7 +750,7 @@ class MeshFilter(Filter):
cv.check_type('filter mesh', mesh, openmc.MeshBase)
self._mesh = mesh
if isinstance(mesh, openmc.UnstructuredMesh):
self.bins = [ (n, 1, 1) for n in range(1, mesh.volumes.size + 1) ]
self.bins = [(n, 1, 1) for n in range(1, len(mesh.volumes) + 1)]
else:
self.bins = list(mesh.indices)

View file

@ -616,6 +616,7 @@ class UnstructuredMesh(MeshBase):
def __init__(self, mesh_id=None, name='', filename=''):
super().__init__(mesh_id, name)
self._filename = filename
self._volumes = []
@property
def filename(self):