Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions openmc/dagmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,19 @@ def auto_mat_ids(self, val):

@property
def material_names(self):
dagmc_file_contents = h5py.File(self.filename)
material_tags_hex = dagmc_file_contents['/tstt/tags/NAME'].get(
'values')
material_tags_ascii = []
for tag in material_tags_hex:
candidate_tag = tag.tobytes().decode().replace('\x00', '')
# tags might be for temperature or reflective surfaces
if candidate_tag.startswith('mat:'):
# if name ends with _comp remove it, it is not parsed
if candidate_tag.endswith('_comp'):
candidate_tag = candidate_tag[:-5]
# removes first 4 characters as openmc.Material name should be
# set without the 'mat:' part of the tag
material_tags_ascii.append(candidate_tag[4:])

with h5py.File(self.filename) as dagmc_file_contents:
material_tags_hex = dagmc_file_contents['/tstt/tags/NAME'].get('values')
for tag in material_tags_hex:
candidate_tag = tag.tobytes().decode().replace('\x00', '')
# tags might be for temperature or reflective surfaces
if candidate_tag.startswith('mat:'):
# if name ends with _comp remove it, it is not parsed
if candidate_tag.endswith('_comp'):
candidate_tag = candidate_tag[:-5]
# removes first 4 characters as openmc.Material name should be
# set without the 'mat:' part of the tag
material_tags_ascii.append(candidate_tag[4:])
return sorted(set(material_tags_ascii))

def _n_geom_elements(self, geom_type):
Expand Down
Loading