Skip to content

Commit

Permalink
fix more calls
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke committed Mar 30, 2024
1 parent 3272199 commit 6470336
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions dagmc/dagnav.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def add_groups(self, group_map):
if isinstance(dagset, DAGSet):
group.add_set(dagset)
else:
if dagset in self.volumes:
group.add_set(self.volumes[dagset])
elif dagset in self.surfaces:
group.add_set(self.surfaces[dagset])
if dagset in self.volumes_by_id:
group.add_set(self.volumes_by_id[dagset])
elif dagset in self.surfaces_by_id:
group.add_set(self.surfaces_by_id[dagset])
else:
raise ValueError(f"DAGSet ID={dagset} could not be "
"found in model volumes or surfaces.")
Expand Down
26 changes: 13 additions & 13 deletions test/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ def test_surface(request):
test_file = str(request.path.parent / 'fuel_pin.h5m')
model = dagmc.DAGModel(test_file)

s1 = model.surfaces[1]
assert s1.volumes == [model.volumes[1], model.volumes[2]]
assert s1.forward_volume == model.volumes[1]
assert s1.reverse_volume == model.volumes[2]
s1 = model.surfaces_by_id[1]
assert s1.volumes == [model.volumes_by_id[1], model.volumes_by_id[2]]
assert s1.forward_volume == model.volumes_by_id[1]
assert s1.reverse_volume == model.volumes_by_id[2]

s1.forward_volume = model.volumes[3]
assert s1.forward_volume == model.volumes[3]
assert s1.surf_sense == [model.volumes[3], model.volumes[2]]
s1.forward_volume = model.volumes_by_id[3]
assert s1.forward_volume == model.volumes_by_id[3]
assert s1.surf_sense == [model.volumes_by_id[3], model.volumes_by_id[2]]

s1.reverse_volume = model.volumes[1]
assert s1.reverse_volume == model.volumes[1]
assert s1.surf_sense == [model.volumes[3], model.volumes[1]]
s1.reverse_volume = model.volumes_by_id[1]
assert s1.reverse_volume == model.volumes_by_id[1]
assert s1.surf_sense == [model.volumes_by_id[3], model.volumes_by_id[1]]


def test_hash(request):
Expand Down Expand Up @@ -298,7 +298,7 @@ def test_write(request, tmpdir):
model.write_file('fuel_pin_copy.h5m')

model = dagmc.DAGModel('fuel_pin_copy.h5m')
assert 12345 in model.volumes
assert 12345 in model.volumes_by_id


def test_volume(request):
Expand Down Expand Up @@ -331,8 +331,8 @@ def test_area(request):
def test_add_groups(request):
test_file = str(request.path.parent / 'fuel_pin.h5m')
model = dagmc.DAGModel(test_file)
volumes = model.volumes
surfaces = model.surfaces
volumes = model.volumes_by_id
surfaces = model.surfaces_by_id

for group in model.groups.values():
group.delete()
Expand Down

0 comments on commit 6470336

Please sign in to comment.