Preallocate space for k_generation and entropy from C++

This commit is contained in:
Paul Romano 2018-10-16 21:55:34 -05:00
parent acfc352e1b
commit b35e570645
3 changed files with 5 additions and 11 deletions

View file

@ -221,11 +221,6 @@ contains
! Get proper XMLNode type given pointer
root % ptr = root_ptr
if (run_mode == MODE_EIGENVALUE) then
! Preallocate space for keff and entropy by generation
call k_generation_reserve(n_max_batches*gen_per_batch)
end if
! Particle tracks
if (check_for_node(root, "track")) then
! Make sure that there are three values per particle

View file

@ -12,6 +12,7 @@
#include "openmc/distribution.h"
#include "openmc/distribution_multi.h"
#include "openmc/distribution_spatial.h"
#include "openmc/eigenvalue.h"
#include "openmc/error.h"
#include "openmc/file_utils.h"
#include "openmc/mesh.h"
@ -141,7 +142,10 @@ void get_run_parameters(pugi::xml_node node_base)
gen_per_batch = std::stoi(get_node_value(node_base, "generations_per_batch"));
}
// TODO: Preallocate space for keff and entropy by generation
// Preallocate space for keff and entropy by generation
int m = settings::n_max_batches * settings::gen_per_batch;
simulation::k_generation.reserve(m);
entropy.reserve(m);
// Get the trigger information for keff
if (check_for_node(node_base, "keff_trigger")) {

View file

@ -84,11 +84,6 @@ module simulation_header
subroutine k_generation_clear() bind(C)
end subroutine
subroutine k_generation_reserve(i) bind(C)
import C_INT
integer(C_INT), value :: i
end subroutine
function work_index(rank) result(i) bind(C)
import C_INT, C_INT64_T
integer(C_INT), value :: rank