Skip to content

Commit

Permalink
Handle single objects up front in SurfaceFilter.clean_bins
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Oct 17, 2024
1 parent 066f2a4 commit f37d7d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openmc/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ class SurfaceFilter(WithIDFilter):
def clean_bins(self, bins):
""""If composite surfaces are present, expand add the component surfaces to the bins.
"""
bins = np.atleast_1d(bins)
composite_surfaces = list(filter(lambda x: isinstance(x, openmc.model.CompositeSurface), bins))
if composite_surfaces:
msg = f'In SurfaceFilter {len(composite_surfaces)} bins will be added for the ' \
Expand All @@ -753,7 +754,7 @@ def clean_bins(self, bins):
composite_surface_bins = [s for cs in composite_surfaces for s in cs.component_surfaces if s not in bins]
bins = np.concatenate((np.atleast_1d(bins), composite_surface_bins))

return np.atleast_1d(bins)
return bins


class ParticleFilter(Filter):
Expand Down

0 comments on commit f37d7d9

Please sign in to comment.