From 29a8737b25e78e5f2cdb3f9a87c85bff2f4a941b Mon Sep 17 00:00:00 2001 From: Jose Salcedo Perez Date: Tue, 15 Aug 2017 14:46:04 +0000 Subject: [PATCH] Use direct address table for reactions in nuclides --- src/nuclide_header.F90 | 10 ++++++---- src/tallies/tally.F90 | 14 +++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/nuclide_header.F90 b/src/nuclide_header.F90 index 676e1b500d..1831f0a892 100644 --- a/src/nuclide_header.F90 +++ b/src/nuclide_header.F90 @@ -87,9 +87,9 @@ module nuclide_header ! Reactions type(Reaction), allocatable :: reactions(:) - type(DictIntInt) :: reaction_index ! map MT values to index in reactions + !type(DictIntInt) :: reaction_index ! map MT values to index in reactions ! array; used at tally-time - + integer, allocatable :: rxn_index_MT(:) ! Fission energy release class(Function1D), allocatable :: fission_q_prompt ! prompt neutrons, gammas class(Function1D), allocatable :: fission_q_recov ! neutrons, gammas, betas @@ -561,7 +561,8 @@ contains n_temperature = size(this % kTs) allocate(this % sum_xs(n_temperature)) - + allocate(this % rxn_index_MT(1000)) + this % rxn_index_MT(:)=0 do i = 1, n_temperature ! Allocate and initialize derived cross sections n_grid = size(this % grid(i) % energy) @@ -580,8 +581,9 @@ contains i_fission = 0 do i = 1, size(this % reactions) + call MTs % push_back(this % reactions(i) % MT) - call this % reaction_index % set(this % reactions(i) % MT, i) + this % rxn_index_MT(this % reactions(i) % MT) = i associate (rx => this % reactions(i)) ! Skip total inelastic level scattering, gas production cross sections diff --git a/src/tallies/tally.F90 b/src/tallies/tally.F90 index eaee96fa7e..c47f94aa76 100644 --- a/src/tallies/tally.F90 +++ b/src/tallies/tally.F90 @@ -247,7 +247,7 @@ contains ! multiplicities of one. score = p % last_wgt * flux else - m = nuclides(p % event_nuclide) % reaction_index % get(p % event_MT) + m = nuclides(p % event_nuclide) % rxn_index_MT(p % event_MT) ! Get yield and apply to score associate (rxn => nuclides(p % event_nuclide) % reactions(m)) @@ -273,7 +273,7 @@ contains ! multiplicities of one. score = p % last_wgt * flux else - m = nuclides(p % event_nuclide) % reaction_index % get(p % event_MT) + m = nuclides(p % event_nuclide) % rxn_index_MT(p % event_MT) ! Get yield and apply to score associate (rxn => nuclides(p % event_nuclide) % reactions(m)) @@ -299,7 +299,7 @@ contains ! multiplicities of one. score = p % last_wgt * flux else - m = nuclides(p % event_nuclide) % reaction_index % get(p % event_MT) + m = nuclides(p % event_nuclide) % rxn_index_MT(p % event_MT) ! Get yield and apply to score associate (rxn => nuclides(p%event_nuclide)%reactions(m)) @@ -1148,8 +1148,8 @@ contains score = ZERO if (i_nuclide > 0) then - m = nuclides(i_nuclide) % reaction_index % get(score_bin) - if (m /= EMPTY) then + m = nuclides(i_nuclide) % rxn_index_MT(score_bin) + if (m /= 0) then ! Retrieve temperature and energy grid index and interpolation ! factor i_temp = micro_xs(i_nuclide) % index_temp @@ -1187,8 +1187,8 @@ contains ! Get index in nuclides array i_nuc = materials(p % material) % nuclide(l) - m = nuclides(i_nuc) % reaction_index % get(score_bin) - if (m /= EMPTY) then + m = nuclides(i_nuc) % rxn_index_MT(score_bin) + if (m /= 0) then ! Retrieve temperature and energy grid index and ! interpolation factor i_temp = micro_xs(i_nuc) % index_temp