diff --git a/include/openmc/capi.h b/include/openmc/capi.h index 43f5f9869e..f7d69290c4 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -148,8 +148,6 @@ extern "C" { extern int32_t n_surfaces; extern int32_t n_tallies; extern int32_t n_universes; - extern double global_tally_absorption; -#pragma omp threadprivate(global_tally_absorption) // Variables that are shared by necessity (can be removed from public header // later) diff --git a/include/openmc/tallies/tally.h b/include/openmc/tallies/tally.h index a07cd6bd12..96b081615d 100644 --- a/include/openmc/tallies/tally.h +++ b/include/openmc/tallies/tally.h @@ -7,12 +7,31 @@ namespace openmc { +//============================================================================== +// Global variable declarations +//============================================================================== + extern "C" double total_weight; +// Threadprivate variables + +extern "C" double global_tally_absorption; +#pragma omp threadprivate(global_tally_absorption) + +//============================================================================== +// Non-member functions +//============================================================================== + template using adaptor_type = xt::xtensor_adaptor, N>; +//! Get the global tallies as a multidimensional array +//! \return Global tallies array adaptor_type<2> global_tallies(); + +//! Get tally results as a multidimensional array +//! \param idx Index in tallies array +//! \return Tally results array adaptor_type<3> tally_results(int idx); #ifdef OPENMC_MPI diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index 18301c3ab0..40e5ba1aea 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -16,6 +16,7 @@ #include "openmc/random_lcg.h" #include "openmc/settings.h" #include "openmc/simulation.h" +#include "openmc/tallies/tally.h" namespace openmc { diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 98783f4498..481f05edc6 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -13,6 +13,10 @@ namespace openmc { +//============================================================================== +// Non-member functions +//============================================================================== + adaptor_type<2> global_tallies() { // Get pointer to global tallies