Access FilterMatch bins and weights via procedures

This commit is contained in:
Sterling Harper 2018-08-25 10:30:03 -04:00
parent 4deebd6d8c
commit a043699d8d
26 changed files with 255 additions and 172 deletions

View file

@ -154,27 +154,27 @@ contains
! Reset all bins to 1
do l = 1, size(t % filter)
call filter_matches(t % filter(l)) % bins % clear()
call filter_matches(t % filter(l)) % bins % push_back(1)
call filter_matches(t % filter(l)) % bins_clear()
call filter_matches(t % filter(l)) % bins_push_back(1)
end do
! Set ijk as mesh indices
ijk = (/ i, j, k /)
! Get bin number for mesh indices
filter_matches(i_filter_mesh) % bins % data(1) = &
m % get_bin_from_indices(ijk)
call filter_matches(i_filter_mesh) &
% bins_set_data(1, m % get_bin_from_indices(ijk))
! Apply energy in filter
if (energy_filters) then
filter_matches(i_filter_ein) % bins % data(1) = ng - h + 1
call filter_matches(i_filter_ein) % bins_set_data(1, ng - h + 1)
end if
! Calculate score index from bins
score_index = 1
do l = 1, size(t % filter)
score_index = score_index + (filter_matches(t % filter(l)) &
% bins % data(1) - 1) * t % stride(l)
% bins_data(1) - 1) * t % stride(l)
end do
! Get flux
@ -198,30 +198,30 @@ contains
! Reset all bins to 1
do l = 1, size(t % filter)
call filter_matches(t % filter(l)) % bins % clear()
call filter_matches(t % filter(l)) % bins % push_back(1)
call filter_matches(t % filter(l)) % bins_clear()
call filter_matches(t % filter(l)) % bins_push_back(1)
end do
! Set ijk as mesh indices
ijk = (/ i, j, k /)
! Get bin number for mesh indices
filter_matches(i_filter_mesh) % bins % data(1) = &
m % get_bin_from_indices(ijk)
call filter_matches(i_filter_mesh) &
% bins_set_data(1, m % get_bin_from_indices(ijk))
if (energy_filters) then
! Apply energy in filter
filter_matches(i_filter_ein) % bins % data(1) = ng - h + 1
call filter_matches(i_filter_ein) % bins_set_data(1, ng - h + 1)
! Set energy out bin
filter_matches(i_filter_eout) % bins % data(1) = ng - g + 1
call filter_matches(i_filter_eout) % bins_set_data(1, ng - g + 1)
end if
! Calculate score index from bins
score_index = 1
do l = 1, size(t % filter)
score_index = score_index + (filter_matches(t % filter(l)) &
% bins % data(1) - 1) * t % stride(l)
% bins_data(1) - 1) * t % stride(l)
end do
! Get scattering
@ -244,23 +244,23 @@ contains
! Initialize and filter for energy
do l = 1, size(t % filter)
call filter_matches(t % filter(l)) % bins % clear()
call filter_matches(t % filter(l)) % bins % push_back(1)
call filter_matches(t % filter(l)) % bins_clear()
call filter_matches(t % filter(l)) % bins_push_back(1)
end do
! Set the bin for this mesh cell
i_mesh = m % get_bin_from_indices([ i, j, k ])
filter_matches(i_filter_mesh) % bins % data(1) = 12*(i_mesh - 1) + 1
call filter_matches(i_filter_mesh) % bins_set_data(1, 12*(i_mesh - 1) + 1)
! Set the energy bin if needed
if (energy_filters) then
filter_matches(i_filter_ein) % bins % data(1) = ng - h + 1
call filter_matches(i_filter_ein) % bins_set_data(1, ng - h + 1)
end if
score_index = 0
do l = 1, size(t % filter)
score_index = score_index + (filter_matches(t % filter(l)) &
% bins % data(1) - 1) * t % stride(l)
% bins_data(1) - 1) * t % stride(l)
end do
! Left surface
@ -303,30 +303,30 @@ contains
! Reset all bins to 1
do l = 1, size(t % filter)
call filter_matches(t % filter(l)) % bins % clear()
call filter_matches(t % filter(l)) % bins % push_back(1)
call filter_matches(t % filter(l)) % bins_clear()
call filter_matches(t % filter(l)) % bins_push_back(1)
end do
! Set ijk as mesh indices
ijk = (/ i, j, k /)
! Get bin number for mesh indices
filter_matches(i_filter_mesh) % bins % data(1) = &
m % get_bin_from_indices(ijk)
call filter_matches(i_filter_mesh) &
% bins_set_data(1, m % get_bin_from_indices(ijk))
! Apply energy in filter
if (energy_filters) then
filter_matches(i_filter_ein) % bins % data(1) = ng - h + 1
call filter_matches(i_filter_ein) % bins_set_data(1, ng - h + 1)
end if
! Apply Legendre filter
filter_matches(i_filter_legendre) % bins % data(1) = 2
call filter_matches(i_filter_legendre) % bins_set_data(1, 2)
! Calculate score index from bins
score_index = 1
do l = 1, size(t % filter)
score_index = score_index + (filter_matches(t % filter(l)) &
% bins % data(1) - 1) * t % stride(l)
% bins_data(1) - 1) * t % stride(l)
end do
! Get p1 scatter rr and convert to p1 scatter xs

View file

@ -773,8 +773,8 @@ contains
! Initialize bins, filter level, and indentation
do h = 1, size(t % filter)
call matches(t % filter(h)) % bins % clear()
call matches(t % filter(h)) % bins % push_back(0)
call matches(t % filter(h)) % bins_clear()
call matches(t % filter(h)) % bins_push_back(0)
end do
j = 1
indent = 0
@ -785,18 +785,18 @@ contains
if (size(t % filter) == 0) exit find_bin
! Increment bin combination
matches(t % filter(j)) % bins % data(1) = &
matches(t % filter(j)) % bins % data(1) + 1
call matches(t % filter(j)) % bins_set_data(1, &
matches(t % filter(j)) % bins_data(1) + 1)
! =================================================================
! REACHED END OF BINS FOR THIS FILTER, MOVE TO NEXT FILTER
if (matches(t % filter(j)) % bins % data(1) > &
if (matches(t % filter(j)) % bins_data(1) > &
filters(t % filter(j)) % obj % n_bins) then
! If this is the first filter, then exit
if (j == 1) exit print_bin
matches(t % filter(j)) % bins % data(1) = 0
call matches(t % filter(j)) % bins_set_data(1, 0)
j = j - 1
indent = indent - 2
@ -810,7 +810,7 @@ contains
! Print current filter information
write(UNIT=unit_tally, FMT='(1X,2A)') repeat(" ", indent), &
trim(filters(t % filter(j)) % obj % &
text_label(matches(t % filter(j)) % bins % data(1)))
text_label(matches(t % filter(j)) % bins_data(1)))
indent = indent + 2
j = j + 1
end if
@ -821,7 +821,7 @@ contains
if (size(t % filter) > 0) then
write(UNIT=unit_tally, FMT='(1X,2A)') repeat(" ", indent), &
trim(filters(t % filter(j)) % obj % &
text_label(matches(t % filter(j)) % bins % data(1)))
text_label(matches(t % filter(j)) % bins_data(1)))
end if
! Determine scoring index for this bin combination -- note that unlike
@ -831,7 +831,7 @@ contains
filter_index = 1
do h = 1, size(t % filter)
filter_index = filter_index + (max(matches(t % filter(h)) &
% bins % data(1),1) - 1) * t % stride(h)
% bins_data(1),1) - 1) * t % stride(h)
end do
! Write results for this filter bin combination

View file

@ -2080,15 +2080,15 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
if (.not. filter_matches(i_filt) % bins_present) then
call filter_matches(i_filt) % bins % clear()
call filter_matches(i_filt) % weights % clear()
call filter_matches(i_filt) % bins_clear()
call filter_matches(i_filt) % weights_clear()
call filters(i_filt) % obj % get_all_bins(p, t % estimator, &
filter_matches(i_filt))
filter_matches(i_filt) % bins_present = .true.
end if
! If there are no valid bins for this filter, then there is nothing to
! score and we can move on to the next tally.
if (filter_matches(i_filt) % bins % size() == 0) cycle TALLY_LOOP
if (filter_matches(i_filt) % bins_size() == 0) cycle TALLY_LOOP
! Set the index of the bin used in the first filter combination
filter_matches(i_filt) % i_bin = 1
@ -2107,10 +2107,10 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
i_bin = filter_matches(i_filt) % i_bin
filter_index = filter_index + (filter_matches(i_filt) % bins % &
data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) % weights % &
data(i_bin)
filter_index = filter_index + (filter_matches(i_filt) &
% bins_data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) &
% weights_data(i_bin)
end do
! ======================================================================
@ -2167,7 +2167,7 @@ contains
do j = size(t % filter), 1, -1
i_filt = t % filter(j)
if (filter_matches(i_filt) % i_bin < filter_matches(i_filt) % &
bins % size()) then
bins_size()) then
filter_matches(i_filt) % i_bin = filter_matches(i_filt) % i_bin + 1
finished = .false.
exit
@ -2226,15 +2226,15 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
if (.not. filter_matches(i_filt) % bins_present) then
call filter_matches(i_filt) % bins % clear()
call filter_matches(i_filt) % weights % clear()
call filter_matches(i_filt) % bins_clear()
call filter_matches(i_filt) % weights_clear()
call filters(i_filt) % obj % get_all_bins(p, t % estimator, &
filter_matches(i_filt))
filter_matches(i_filt) % bins_present = .true.
end if
! If there are no valid bins for this filter, then there is nothing to
! score and we can move on to the next tally.
if (filter_matches(i_filt) % bins % size() == 0) cycle TALLY_LOOP
if (filter_matches(i_filt) % bins_size() == 0) cycle TALLY_LOOP
! Set the index of the bin used in the first filter combination
filter_matches(i_filt) % i_bin = 1
@ -2253,10 +2253,10 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
i_bin = filter_matches(i_filt) % i_bin
filter_index = filter_index + (filter_matches(i_filt) % bins % &
data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) % weights % &
data(i_bin)
filter_index = filter_index + (filter_matches(i_filt) &
% bins_data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) &
% weights_data(i_bin)
end do
! ======================================================================
@ -2296,7 +2296,7 @@ contains
do j = size(t % filter), 1, -1
i_filt = t % filter(j)
if (filter_matches(i_filt) % i_bin < filter_matches(i_filt) % &
bins % size()) then
bins_size()) then
filter_matches(i_filt) % i_bin = filter_matches(i_filt) % i_bin + 1
finished = .false.
exit
@ -2361,7 +2361,7 @@ contains
! save original outgoing energy bin and score index
i = t % filter(t % find_filter(FILTER_ENERGYOUT))
i_bin = filter_matches(i) % i_bin
bin_energyout = filter_matches(i) % bins % data(i_bin)
bin_energyout = filter_matches(i) % bins_data(i_bin)
! declare the energyout filter type
select type(eo_filt => filters(i) % obj)
@ -2401,7 +2401,7 @@ contains
g_out = size(eo_filt % bins) - g_out
! change outgoing energy bin
filter_matches(i) % bins % data(i_bin) = g_out
call filter_matches(i) % bins_set_data(i_bin, g_out)
else
@ -2417,8 +2417,8 @@ contains
if (E_out < eo_filt % bins(1) .or. E_out > eo_filt % bins(n)) cycle
! change outgoing energy bin
filter_matches(i) % bins % data(i_bin) = &
binary_search(eo_filt % bins, n, E_out)
call filter_matches(i) % bins_set_data(i_bin, &
binary_search(eo_filt % bins, n, E_out))
end if
@ -2429,8 +2429,8 @@ contains
! determine scoring index and weight for this filter combination
i_filter = 1
do l = 1, size(t % filter)
i_filter = i_filter + (filter_matches(t % filter(l)) % bins % &
data(filter_matches(t % filter(l)) % i_bin) - 1) * &
i_filter = i_filter + (filter_matches(t % filter(l)) &
% bins_data(filter_matches(t % filter(l)) % i_bin) - 1) * &
t % stride(l)
end do
@ -2471,10 +2471,10 @@ contains
do l = 1, size(t % filter)
f = t % filter(l)
b = filter_matches(f) % i_bin
i_filter = i_filter + (filter_matches(f) % bins % &
data(b) - 1) * t % stride(l)
filter_weight = filter_weight * filter_matches(f) % &
weights % data(b)
i_filter = i_filter + (filter_matches(f) &
% bins_data(b) - 1) * t % stride(l)
filter_weight = filter_weight * filter_matches(f) &
% weights_data(b)
end do
call score_fission_delayed_dg(t, d_bin, &
@ -2494,10 +2494,10 @@ contains
do l = 1, size(t % filter)
f = t % filter(l)
b = filter_matches(f) % i_bin
i_filter = i_filter + (filter_matches(f) % bins % data(b) - 1) &
i_filter = i_filter + (filter_matches(f) % bins_data(b) - 1) &
* t % stride(l)
filter_weight = filter_weight * filter_matches(f) % weights % &
data(b)
filter_weight = filter_weight * filter_matches(f) &
% weights_data(b)
end do
! Add score to tally
@ -2510,7 +2510,7 @@ contains
end select
! reset outgoing energy bin and score index
filter_matches(i) % bins % data(i_bin) = bin_energyout
call filter_matches(i) % bins_set_data(i_bin, bin_energyout)
end subroutine score_fission_eout
@ -2535,14 +2535,14 @@ contains
! save original delayed group bin
i_filt = t % filter(t % find_filter(FILTER_DELAYEDGROUP))
i_bin = filter_matches(i_filt) % i_bin
bin_original = filter_matches(i_filt) % bins % data(i_bin)
filter_matches(i_filt) % bins % data(i_bin) = d_bin
bin_original = filter_matches(i_filt) % bins_data(i_bin)
call filter_matches(i_filt) % bins_set_data(i_bin, d_bin)
! determine scoring index and weight on the modified matching bins
filter_index = 1
do i = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(i)) % bins % &
data(filter_matches(t % filter(i)) % i_bin) - 1) * t % stride(i)
filter_index = filter_index + (filter_matches(t % filter(i)) % &
bins_data(filter_matches(t % filter(i)) % i_bin) - 1) * t % stride(i)
end do
!$omp atomic
@ -2550,7 +2550,7 @@ contains
t % results(RESULT_VALUE, score_index, filter_index) + score
! reset original delayed group bin
filter_matches(i_filt) % bins % data(i_bin) = bin_original
call filter_matches(i_filt) % bins_set_data(i_bin, bin_original)
end subroutine score_fission_delayed_dg
@ -2596,15 +2596,15 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
if (.not. filter_matches(i_filt) % bins_present) then
call filter_matches(i_filt) % bins % clear()
call filter_matches(i_filt) % weights % clear()
call filter_matches(i_filt) % bins_clear()
call filter_matches(i_filt) % weights_clear()
call filters(i_filt) % obj % get_all_bins(p, t % estimator, &
filter_matches(i_filt))
filter_matches(i_filt) % bins_present = .true.
end if
! If there are no valid bins for this filter, then there is nothing to
! score and we can move on to the next tally.
if (filter_matches(i_filt) % bins % size() == 0) cycle TALLY_LOOP
if (filter_matches(i_filt) % bins_size() == 0) cycle TALLY_LOOP
! Set the index of the bin used in the first filter combination
filter_matches(i_filt) % i_bin = 1
@ -2623,10 +2623,10 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
i_bin = filter_matches(i_filt) % i_bin
filter_index = filter_index + (filter_matches(i_filt) % bins % &
data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) % weights % &
data(i_bin)
filter_index = filter_index + (filter_matches(i_filt) &
% bins_data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) &
% weights_data(i_bin)
end do
! ======================================================================
@ -2675,7 +2675,7 @@ contains
do j = size(t % filter), 1, -1
i_filt = t % filter(j)
if (filter_matches(i_filt) % i_bin < filter_matches(i_filt) % &
bins % size()) then
bins_size()) then
filter_matches(i_filt) % i_bin = filter_matches(i_filt) % i_bin + 1
finished = .false.
exit
@ -2753,15 +2753,15 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
if (.not. filter_matches(i_filt) % bins_present) then
call filter_matches(i_filt) % bins % clear()
call filter_matches(i_filt) % weights % clear()
call filter_matches(i_filt) % bins_clear()
call filter_matches(i_filt) % weights_clear()
call filters(i_filt) % obj % get_all_bins(p, t % estimator, &
filter_matches(i_filt))
filter_matches(i_filt) % bins_present = .true.
end if
! If there are no valid bins for this filter, then there is nothing to
! score and we can move on to the next tally.
if (filter_matches(i_filt) % bins % size() == 0) cycle TALLY_LOOP
if (filter_matches(i_filt) % bins_size() == 0) cycle TALLY_LOOP
! Set the index of the bin used in the first filter combination
filter_matches(i_filt) % i_bin = 1
@ -2780,10 +2780,10 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
i_bin = filter_matches(i_filt) % i_bin
filter_index = filter_index + (filter_matches(i_filt) % bins % &
data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) % weights % &
data(i_bin)
filter_index = filter_index + (filter_matches(i_filt) &
% bins_data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) &
% weights_data(i_bin)
end do
! ======================================================================
@ -2832,7 +2832,7 @@ contains
do j = size(t % filter), 1, -1
i_filt = t % filter(j)
if (filter_matches(i_filt) % i_bin < filter_matches(i_filt) % &
bins % size()) then
bins_size()) then
filter_matches(i_filt) % i_bin = filter_matches(i_filt) % i_bin + 1
finished = .false.
exit
@ -2899,15 +2899,15 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
if (.not. filter_matches(i_filt) % bins_present) then
call filter_matches(i_filt) % bins % clear()
call filter_matches(i_filt) % weights % clear()
call filter_matches(i_filt) % bins_clear()
call filter_matches(i_filt) % weights_clear()
call filters(i_filt) % obj % get_all_bins(p, t % estimator, &
filter_matches(i_filt))
filter_matches(i_filt) % bins_present = .true.
end if
! If there are no valid bins for this filter, then there is nothing to
! score and we can move on to the next tally.
if (filter_matches(i_filt) % bins % size() == 0) cycle TALLY_LOOP
if (filter_matches(i_filt) % bins_size() == 0) cycle TALLY_LOOP
! Set the index of the bin used in the first filter combination
filter_matches(i_filt) % i_bin = 1
@ -2926,10 +2926,10 @@ contains
do j = 1, size(t % filter)
i_filt = t % filter(j)
i_bin = filter_matches(i_filt) % i_bin
filter_index = filter_index + (filter_matches(i_filt) % bins % &
data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) % weights % &
data(i_bin)
filter_index = filter_index + (filter_matches(i_filt) &
% bins_data(i_bin) - 1) * t % stride(j)
filter_weight = filter_weight * filter_matches(i_filt) &
% weights_data(i_bin)
end do
! Determine score
@ -2962,7 +2962,7 @@ contains
do j = size(t % filter), 1, -1
i_filt = t % filter(j)
if (filter_matches(i_filt) % i_bin < filter_matches(i_filt) % &
bins % size()) then
bins_size()) then
filter_matches(i_filt) % i_bin = filter_matches(i_filt) % i_bin + 1
finished = .false.
exit

View file

@ -0,0 +1,21 @@
#include "openmc/tallies/tally_filter.h"
namespace openmc {
//==============================================================================
// Global variables
//==============================================================================
std::vector<TallyFilterMatch> filter_matches;
//==============================================================================
// Fortran compatibility functions
//==============================================================================
extern "C" {
TallyFilterMatch* filter_match_pointer(int indx)
{return &filter_matches[indx];}
}
} // namespace openmc

View file

@ -89,8 +89,8 @@ contains
! Search to find azimuthal angle bin.
bin = binary_search(this % bins, n + 1, phi)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
end subroutine get_all_bins_azimuthal

View file

@ -61,8 +61,8 @@ contains
do i = 1, p % n_coord
val = this % map % get(p % coord(i) % cell)
if (val /= EMPTY) then
call match % bins % push_back(val)
call match % weights % push_back(ONE)
call match % bins_push_back(val)
call match % weights_push_back(ONE)
end if
end do

View file

@ -57,8 +57,8 @@ contains
val = this % map % get(p % cell_born)
if (val /= EMPTY) then
call match % bins % push_back(val)
call match % weights % push_back(ONE)
call match % bins_push_back(val)
call match % weights_push_back(ONE)
end if
end subroutine get_all_bins_cellborn

View file

@ -44,8 +44,8 @@ contains
do i = 1, p % last_n_coord
val = this % map % get(p % last_cell(i))
if (val /= EMPTY) then
call match % bins % push_back(val)
call match % weights % push_back(ONE)
call match % bins_push_back(val)
call match % weights_push_back(ONE)
exit
end if
end do

View file

@ -62,8 +62,8 @@ contains
integer, intent(in) :: estimator
type(TallyFilterMatch), intent(inout) :: match
call match % bins % push_back(1)
call match % weights % push_back(ONE)
call match % bins_push_back(1)
call match % weights_push_back(ONE)
end subroutine get_all_bins_dg
subroutine to_statepoint_dg(this, filter_group)

View file

@ -74,8 +74,8 @@ contains
end if
end if
if (this % cell == p % coord(i) % cell) then
call match % bins % push_back(offset + 1)
call match % weights % push_back(ONE)
call match % bins_push_back(offset + 1)
call match % weights_push_back(ONE)
return
end if
end do

View file

@ -95,11 +95,11 @@ contains
if (p % g /= NONE .and. this % matches_transport_groups) then
if (estimator == ESTIMATOR_TRACKLENGTH) then
call match % bins % push_back(num_energy_groups - p % g + 1)
call match % weights % push_back(ONE)
call match % bins_push_back(num_energy_groups - p % g + 1)
call match % weights_push_back(ONE)
else
call match % bins % push_back(num_energy_groups - p % last_g + 1)
call match % weights % push_back(ONE)
call match % bins_push_back(num_energy_groups - p % last_g + 1)
call match % weights_push_back(ONE)
end if
else
@ -109,8 +109,8 @@ contains
! Search to find incoming energy bin.
bin = binary_search(this % bins, n + 1, E)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
end if
end subroutine get_all_bins_energy
@ -155,16 +155,16 @@ contains
if (p % g /= NONE .and. this % matches_transport_groups) then
! Tallies are ordered in increasing groups, group indices
! however are the opposite, so switch
call match % bins % push_back(num_energy_groups - p % g + 1)
call match % weights % push_back(ONE)
call match % bins_push_back(num_energy_groups - p % g + 1)
call match % weights_push_back(ONE)
else
! Search to find incoming energy bin.
bin = binary_search(this % bins, n + 1, p % E)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
end if
end subroutine get_all_bins_energyout

View file

@ -89,9 +89,9 @@ contains
/ (this % energy(indx+1) - this % energy(indx))
! Interpolate on the lin-lin grid.
call match % bins % push_back(1)
call match % bins_push_back(1)
weight = (ONE - f) * this % y(indx) + f * this % y(indx+1)
call match % weights % push_back(weight)
call match % weights_push_back(weight)
end select
end subroutine get_all_bins_energyfunction

View file

@ -28,11 +28,21 @@ module tally_filter_header
type, public :: TallyFilterMatch
! Index of the bin and weight being used in the current filter combination
integer :: i_bin
type(VectorInt) :: bins
type(VectorReal) :: weights
type(VectorInt) :: bins_
type(VectorReal) :: weights_
! Indicates whether all valid bins for this filter have been found
logical :: bins_present = .false.
contains
procedure :: bins_push_back
procedure :: weights_push_back
procedure :: bins_clear
procedure :: weights_clear
procedure :: bins_size
procedure :: bins_data
procedure :: weights_data
procedure :: bins_set_data
end type TallyFilterMatch
!===============================================================================
@ -129,6 +139,58 @@ module tally_filter_header
contains
!===============================================================================
!===============================================================================
subroutine bins_push_back(this, val)
class(TallyFilterMatch), intent(inout) :: this
integer, intent(in) :: val
call this % bins_ % push_back(val)
end subroutine bins_push_back
subroutine weights_push_back(this, val)
class(TallyFilterMatch), intent(inout) :: this
real(8), intent(in) :: val
call this % weights_ % push_back(val)
end subroutine weights_push_back
subroutine bins_clear(this)
class(TallyFilterMatch), intent(inout) :: this
call this % bins_ % clear()
end subroutine bins_clear
subroutine weights_clear(this)
class(TallyFilterMatch), intent(inout) :: this
call this % weights_ % clear()
end subroutine weights_clear
function bins_size(this) result(len)
class(TallyFilterMatch), intent(inout) :: this
integer :: len
len = this % bins_ % size()
end function bins_size
function bins_data(this, indx) result(val)
class(TallyFilterMatch), intent(inout) :: this
integer, intent(in) :: indx
integer :: val
val = this % bins_ % data(indx)
end function bins_data
function weights_data(this, indx) result(val)
class(TallyFilterMatch), intent(inout) :: this
integer, intent(in) :: indx
real(8) :: val
val = this % weights_ % data(indx)
end function weights_data
subroutine bins_set_data(this, indx, val)
class(TallyFilterMatch), intent(inout) :: this
integer, intent(in) :: indx
integer, intent(in) :: val
this % bins_ % data(indx) = val
end subroutine bins_set_data
!===============================================================================
! INITIALIZE sets up any internal data, as necessary. If this procedure is not
! overriden by the derived class, then it will do nothing by default.

View file

@ -55,8 +55,8 @@ contains
call calc_pn(this % order, p % mu, wgt)
do i = 1, this % n_bins
call match % bins % push_back(i)
call match % weights % push_back(wgt(i))
call match % bins_push_back(i)
call match % weights_push_back(wgt(i))
end do
end subroutine get_all_bins

View file

@ -58,8 +58,8 @@ contains
val = this % map % get(p % material)
if (val /= EMPTY) then
call match % bins % push_back(val)
call match % weights % push_back(ONE)
call match % bins_push_back(val)
call match % weights_push_back(ONE)
end if
end subroutine get_all_bins_material

View file

@ -103,8 +103,8 @@ contains
! valid mesh bin.
call m % get_bin(p % coord(1) % xyz, bin)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
return
end if
@ -217,8 +217,8 @@ contains
! Assign the next tally bin and the score.
bin = m % get_bin_from_indices(ijk0(:n))
call match % bins % push_back(bin)
call match % weights % push_back(distance / total_distance)
call match % bins_push_back(bin)
call match % weights_push_back(distance / total_distance)
! Find the next mesh cell that the particle enters.

View file

@ -162,8 +162,8 @@ contains
i_mesh = m % get_bin_from_indices(ijk0)
i_bin = 4*n_dim*(i_mesh - 1) + i_surf
call match % bins % push_back(i_bin)
call match % weights % push_back(ONE)
call match % bins_push_back(i_bin)
call match % weights_push_back(ONE)
end if
! Advance position
@ -178,8 +178,8 @@ contains
i_mesh = m % get_bin_from_indices(ijk0)
i_bin = 4*n_dim*(i_mesh - 1) + i_surf
call match % bins % push_back(i_bin)
call match % weights % push_back(ONE)
call match % bins_push_back(i_bin)
call match % weights_push_back(ONE)
end if
else
@ -192,8 +192,8 @@ contains
i_mesh = m % get_bin_from_indices(ijk0)
i_bin = 4*n_dim*(i_mesh - 1) + i_surf
call match % bins % push_back(i_bin)
call match % weights % push_back(ONE)
call match % bins_push_back(i_bin)
call match % weights_push_back(ONE)
end if
! Advance position
@ -208,8 +208,8 @@ contains
i_mesh = m % get_bin_from_indices(ijk0)
i_bin = 4*n_dim*(i_mesh - 1) + i_surf
call match % bins % push_back(i_bin)
call match % weights % push_back(ONE)
call match % bins_push_back(i_bin)
call match % weights_push_back(ONE)
end if
end if
end if

View file

@ -80,8 +80,8 @@ contains
! Search to find incoming energy bin.
bin = binary_search(this % bins, n + 1, p % mu)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
end subroutine get_all_bins_mu

View file

@ -52,8 +52,8 @@ contains
do i = 1, this % n_bins
if (this % particles(i) == p % type) then
call match % bins % push_back(i)
call match % weights % push_back(ONE)
call match % bins_push_back(i)
call match % weights_push_back(ONE)
end if
end do
end subroutine get_all_bins

View file

@ -88,8 +88,8 @@ contains
! Search to find polar angle bin.
bin = binary_search(this % bins, n + 1, theta)
if (bin /= NO_BIN_FOUND) then
call match % bins % push_back(bin)
call match % weights % push_back(ONE)
call match % bins_push_back(bin)
call match % weights_push_back(ONE)
end if
end subroutine get_all_bins_polar

View file

@ -95,8 +95,8 @@ contains
! Append matching (bin,weight) for each moment
do i = 1, num_nm
j = j + 1
call match % bins % push_back(j)
call match % weights % push_back(wgt(n + 1) * rn(j))
call match % bins_push_back(j)
call match % weights_push_back(wgt(n + 1) * rn(j))
end do
end do

View file

@ -86,8 +86,8 @@ contains
call calc_pn(this % order, x_norm, wgt)
do i = 1, this % n_bins
call match % bins % push_back(i)
call match % weights % push_back(wgt(i))
call match % bins_push_back(i)
call match % weights_push_back(wgt(i))
end do
end if
end subroutine get_all_bins

View file

@ -58,11 +58,11 @@ contains
do i = 1, this % n_bins
if (abs(p % surface) == this % surfaces(i)) then
call match % bins % push_back(i)
call match % bins_push_back(i)
if (p % surface < 0) then
call match % weights % push_back(-ONE)
call match % weights_push_back(-ONE)
else
call match % weights % push_back(ONE)
call match % weights_push_back(ONE)
end if
exit
end if

View file

@ -59,8 +59,8 @@ contains
do i = 1, p % n_coord
val = this % map % get(p % coord(i) % universe)
if (val /= EMPTY) then
call match % bins % push_back(val)
call match % weights % push_back(ONE)
call match % bins_push_back(val)
call match % weights_push_back(ONE)
end if
end do

View file

@ -102,8 +102,8 @@ contains
call calc_zn(this % order, r, theta, zn)
do i = 1, this % n_bins
call match % bins % push_back(i)
call match % weights % push_back(zn(i))
call match % bins_push_back(i)
call match % weights_push_back(zn(i))
end do
endif
end subroutine get_all_bins_zn
@ -173,8 +173,8 @@ contains
call calc_zn_rad(this % order, r, zn_rad)
do i = 1, this % n_bins
call match % bins % push_back(i)
call match % weights % push_back(zn_rad(i))
call match % bins_push_back(i)
call match % weights_push_back(zn_rad(i))
end do
endif
end subroutine get_all_bins_zn_rad

View file

@ -173,8 +173,8 @@ contains
! Initialize bins, filter level
do j = 1, size(t % filter)
call filter_matches(t % filter(j)) % bins % clear()
call filter_matches(t % filter(j)) % bins % push_back(0)
call filter_matches(t % filter(j)) % bins_clear()
call filter_matches(t % filter(j)) % bins_push_back(0)
end do
FILTER_LOOP: do filter_index = 1, t % n_filter_bins
@ -269,8 +269,8 @@ contains
! initialize bins array
do j = 1, size(t % filter)
call filter_matches(t % filter(j)) % bins % clear()
call filter_matches(t % filter(j)) % bins % push_back(1)
call filter_matches(t % filter(j)) % bins_clear()
call filter_matches(t % filter(j)) % bins_push_back(1)
end do
! determine how many energyin bins there are
@ -293,20 +293,20 @@ contains
! Get the indices for this cell
call m % get_indices_from_bin(i, ijk)
filter_matches(i_filter_mesh) % bins % data(1) = i
call filter_matches(i_filter_mesh) % bins_set_data(1, i)
do l = 1, n
if (print_ebin) then
filter_matches(i_filter_ein) % bins % data(1) = l
call filter_matches(i_filter_ein) % bins_set_data(1, l)
end if
! Left Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_LEFT
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_LEFT)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then
@ -318,11 +318,11 @@ contains
trigger % variance = std_dev**2
! Right Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_RIGHT
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_RIGHT)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then
@ -334,11 +334,11 @@ contains
trigger % variance = trigger % std_dev**2
! Back Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_BACK
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_BACK)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then
@ -350,11 +350,11 @@ contains
trigger % variance = trigger % std_dev**2
! Front Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_FRONT
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_FRONT)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then
@ -366,11 +366,11 @@ contains
trigger % variance = trigger % std_dev**2
! Bottom Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_BOTTOM
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_BOTTOM)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then
@ -382,11 +382,11 @@ contains
trigger % variance = trigger % std_dev**2
! Top Surface
filter_matches(i_filter_surf) % bins % data(1) = OUT_TOP
call filter_matches(i_filter_surf) % bins_set_data(1, OUT_TOP)
filter_index = 1
do j = 1, size(t % filter)
filter_index = filter_index + (filter_matches(t % filter(j)) % &
bins % data(1) - 1) * t % stride(j)
bins_data(1) - 1) * t % stride(j)
end do
call get_trigger_uncertainty(std_dev, rel_err, 1, filter_index, t)
if (trigger % std_dev < std_dev) then