From 47e30f8e2f1ab62ba07a37663aa0c63ac09664c2 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 20 Mar 2013 13:15:27 -0400 Subject: [PATCH] Change statepoint_batch to type(SetInt). --- src/eigenvalue.F90 | 19 +++++++------------ src/fixed_source.F90 | 13 ++++--------- src/global.F90 | 2 +- src/input_xml.F90 | 17 ++++++++--------- 4 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/eigenvalue.F90 b/src/eigenvalue.F90 index d97b5c3511..8357c89f35 100644 --- a/src/eigenvalue.F90 +++ b/src/eigenvalue.F90 @@ -165,8 +165,6 @@ contains subroutine finalize_batch() - integer :: i ! loop index for state point batches - ! Collect tallies call time_tallies % start() call synchronize_tallies() @@ -182,20 +180,17 @@ contains if (master) call print_batch_keff() ! Write out state point if it's been specified for this batch - do i = 1, n_state_points - if (current_batch == statepoint_batch(i)) then - ! Calculate combined estimate of k-effective - if (master) call calculate_combined_keff() + if (statepoint_batch % contains(current_batch)) then + ! Calculate combined estimate of k-effective + if (master) call calculate_combined_keff() - ! Create state point file + ! Create state point file #ifdef HDF5 - call hdf5_write_state_point() + call hdf5_write_state_point() #else - call write_state_point() + call write_state_point() #endif - exit - end if - end do + end if if (master .and. current_batch == n_batches) then ! Make sure combined estimate of k-effective is calculated at the last diff --git a/src/fixed_source.F90 b/src/fixed_source.F90 index 13d23d054d..1d2b3bf00d 100644 --- a/src/fixed_source.F90 +++ b/src/fixed_source.F90 @@ -108,24 +108,19 @@ contains subroutine finalize_batch() - integer :: i ! loop index for state point batches - ! Collect and accumulate tallies call time_tallies % start() call synchronize_tallies() call time_tallies % stop() ! Write out state point if it's been specified for this batch - do i = 1, n_state_points - if (current_batch == statepoint_batch(i)) then + if (statepoint_batch % contains(current_batch)) then #ifdef HDF5 - call hdf5_write_state_point() + call hdf5_write_state_point() #else - call write_state_point() + call write_state_point() #endif - exit - end if - end do + end if end subroutine finalize_batch diff --git a/src/global.F90 b/src/global.F90 index 31cd3535e3..d5ce1ebd06 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -360,7 +360,7 @@ module global ! Information about state points to be written integer :: n_state_points = 0 - integer, allocatable :: statepoint_batch(:) + type(SetInt) :: statepoint_batch ! Various output options logical :: output_summary = .false. diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 6f55857efd..daa6489078 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -489,20 +489,20 @@ contains if (n_state_points > 0) then ! User gave specific batches to write state points - allocate(statepoint_batch(n_state_points)) - statepoint_batch = state_point_(1) % batches + do i = 1, n_state_points + call statepoint_batch % add(state_point_(1) % batches(i)) + end do elseif (state_point_(1) % interval /= 0) then ! User gave an interval for writing state points n_state_points = n_batches / state_point_(1) % interval - allocate(statepoint_batch(n_state_points)) - statepoint_batch = (/ (state_point_(1) % interval * i, i = 1, & - n_state_points) /) + do i = 1, n_state_points + call statepoint_batch % add(state_point_(1) % interval * i) + end do else ! If neither were specified, write state point at last batch n_state_points = 1 - allocate(statepoint_batch(n_state_points)) - statepoint_batch(1) = n_batches + call statepoint_batch % add(n_batches) end if ! Check if the user has specified to write binary source file @@ -513,8 +513,7 @@ contains ! If no tag was present, by default write state point at ! last batch only n_state_points = 1 - allocate(statepoint_batch(n_state_points)) - statepoint_batch(1) = n_batches + call statepoint_batch % add(n_batches) end if ! Check if the user has specified to not reduce tallies at the end of every