From 268b865cd361e290915aee44cf2b1a6915c2c6d4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 24 Aug 2018 09:51:34 -0500 Subject: [PATCH] Move definitions for several variables from Fortran to C++ --- include/openmc/settings.h | 19 ++++++++++--------- src/settings.F90 | 16 ++++++++-------- src/settings.cpp | 8 ++++++++ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/include/openmc/settings.h b/include/openmc/settings.h index be56e0b60e..ccaaa1508f 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -17,16 +17,16 @@ namespace openmc { namespace settings { -// Defined on Fortran side -extern "C" bool check_overlaps; -extern "C" bool particle_restart_run; -extern "C" bool photon_transport; -extern "C" bool restart_run; -extern "C" bool run_CE; -extern "C" bool write_all_tracks; -extern "C" bool write_initial_source; +// Boolean flags +extern "C" bool check_overlaps; //!< check overlaps in geometry? +extern "C" bool particle_restart_run; //!< particle restart run? +extern "C" bool photon_transport; //!< photon transport turned on? +extern "C" bool restart_run; //!< restart run? +extern "C" bool run_CE; //!< run with continuous-energy data? +extern "C" bool write_all_tracks; //!< write track files for every particle? +extern "C" bool write_initial_source; //!< write out initial source file? -// Defined in .cpp +// Paths to various files // TODO: Make strings instead of char* once Fortran is gone extern "C" char* path_input; extern "C" char* path_statepoint; @@ -37,6 +37,7 @@ extern std::string path_multipole; extern std::string path_output; extern std::string path_source; +// Temperature settings extern int temperature_method; extern bool temperature_multipole; extern double temperature_tolerance; diff --git a/src/settings.F90 b/src/settings.F90 index da514757d2..2ebb4da57b 100644 --- a/src/settings.F90 +++ b/src/settings.F90 @@ -9,13 +9,13 @@ module settings ! ============================================================================ ! ENERGY TREATMENT RELATED VARIABLES - logical(C_BOOL), bind(C, name='run_CE') :: run_CE = .true. ! Run in CE mode? + logical(C_BOOL), bind(C, name='run_CE') :: run_CE ! Run in CE mode? ! ============================================================================ ! CONTINUOUS-ENERGY CROSS SECTION RELATED VARIABLES ! Unreoslved resonance probablity tables - logical :: urr_ptables_on = .true. + logical(C_BOOL) :: urr_ptables_on = .true. ! Default temperature and method for choosing temperatures integer(C_INT) :: temperature_method = TEMPERATURE_NEAREST @@ -26,7 +26,7 @@ module settings integer :: n_log_bins ! number of bins for logarithmic grid - logical(C_BOOL), bind(C) :: photon_transport = .false. + logical(C_BOOL), bind(C) :: photon_transport integer :: electron_treatment = ELECTRON_TTB ! ============================================================================ @@ -81,13 +81,13 @@ module settings integer(C_INT), bind(C, name='openmc_run_mode') :: run_mode = NONE ! Restart run - logical(C_BOOL), bind(C) :: restart_run = .false. + logical(C_BOOL), bind(C) :: restart_run ! The verbosity controls how much information will be printed to the screen ! and in logs integer(C_INT), bind(C, name='openmc_verbosity') :: verbosity = 7 - logical(C_BOOL), bind(C) :: check_overlaps = .false. + logical(C_BOOL), bind(C) :: check_overlaps ! Trace for single particle integer :: trace_batch @@ -95,14 +95,14 @@ module settings integer(8) :: trace_particle ! Particle tracks - logical(C_BOOL), bind(C) :: write_all_tracks = .false. + logical(C_BOOL), bind(C) :: write_all_tracks integer, allocatable :: track_identifiers(:,:) ! Particle restart run - logical(C_BOOL), bind(C) :: particle_restart_run = .false. + logical(C_BOOL), bind(C) :: particle_restart_run ! Write out initial source - logical(C_BOOL), bind(C) :: write_initial_source = .false. + logical(C_BOOL), bind(C) :: write_initial_source ! Whether create fission neutrons or not. Only applied for MODE_FIXEDSOURCE logical :: create_fission_neutrons = .true. diff --git a/src/settings.cpp b/src/settings.cpp index d3896f0634..fc517b0c53 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -18,6 +18,14 @@ namespace openmc { namespace settings { +bool check_overlaps {false}; +bool particle_restart_run {false}; +bool photon_transport {false}; +bool restart_run {false}; +bool run_CE {true}; +bool write_all_tracks {false}; +bool write_initial_source {false}; + char* path_input; char* path_statepoint; char* path_sourcepoint;