mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #1969 from pshriwise/bin_indices_opt
Return all bin indices for filters not specified in `Tally.get_filter_indices`
This commit is contained in:
commit
c9bbcda347
1 changed files with 2 additions and 14 deletions
|
|
@ -1093,23 +1093,11 @@ class Tally(IDManagerMixin):
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue