mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Adding translation to MeshFilter repr. Fix for reading filters without a translation.
This commit is contained in:
parent
574c8794f7
commit
a0142f183b
1 changed files with 5 additions and 3 deletions
|
|
@ -739,6 +739,7 @@ class MeshFilter(Filter):
|
|||
string = type(self).__name__ + '\n'
|
||||
string += '{: <16}=\t{}\n'.format('\tMesh ID', self.mesh.id)
|
||||
string += '{: <16}=\t{}\n'.format('\tID', self.id)
|
||||
string += '{: <16}=\t{}\n'.format('\tTranslation', self.translation)
|
||||
return string
|
||||
|
||||
@classmethod
|
||||
|
|
@ -752,13 +753,14 @@ class MeshFilter(Filter):
|
|||
raise ValueError(cls.__name__ + " requires a 'meshes' keyword "
|
||||
"argument.")
|
||||
|
||||
if 'translation' in group:
|
||||
translation = group['translation'][()]
|
||||
|
||||
mesh_id = group['bins'][()]
|
||||
mesh_obj = kwargs['meshes'][mesh_id]
|
||||
filter_id = int(group.name.split('/')[-1].lstrip('filter '))
|
||||
|
||||
translation = group.get('translation')
|
||||
if translation:
|
||||
translation = translation[()]
|
||||
|
||||
out = cls(mesh_obj, filter_id=filter_id, translation=translation)
|
||||
|
||||
return out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue