Skip to content

Commit

Permalink
Merge pull request #1969 from pshriwise/bin_indices_opt
Browse files Browse the repository at this point in the history
Return all bin indices for filters not specified in `Tally.get_filter_indices`
  • Loading branch information
paulromano authored Feb 17, 2022
2 parents ea5dbe1 + 9a28bc8 commit c9bbcda
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions openmc/tallies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,23 +1093,11 @@ def get_filter_indices(self, filters=[], filter_bins=[]):
for j, test_filter in enumerate(filters):
if type(self_filter) is test_filter:
bins = filter_bins[j]
indices = np.array([self_filter.get_bin_index(b) for b in bins])
break
else:
# If not a user-requested Filter, get all bins
if isinstance(self_filter, openmc.DistribcellFilter):
# Create list of cell instance IDs for distribcell Filters
bins = list(range(self_filter.num_bins))
indices = np.arange(self_filter.num_bins)

elif isinstance(self_filter, openmc.EnergyFunctionFilter):
# EnergyFunctionFilters don't have bins so just add a None
bins = [None]

else:
# Create list of IDs for bins for all other filter types
bins = self_filter.bins

# Add indices for each bin in this Filter to the list
indices = np.array([self_filter.get_bin_index(b) for b in bins])
filter_indices.append(indices)

# Account for stride in each of the previous filters
Expand Down

0 comments on commit c9bbcda

Please sign in to comment.