diff --git a/include/openmc/tallies/filter.h b/include/openmc/tallies/filter.h index 24ce5cb89..5590a0767 100644 --- a/include/openmc/tallies/filter.h +++ b/include/openmc/tallies/filter.h @@ -77,13 +77,20 @@ public: // Global variables //============================================================================== -extern "C" int32_t n_filters; +namespace simulation { extern std::vector filter_matches; #pragma omp threadprivate(filter_matches) +} // namespace simulation + +namespace model { + +extern "C" int32_t n_filters; extern std::vector> tally_filters; +} // namespace model + //============================================================================== extern "C" void free_memory_tally_c(); diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 8ebb70eb7..c326744eb 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -187,7 +187,7 @@ prepare_distribcell() { // Find all cells listed in a DistribcellFilter. std::unordered_set distribcells; - for (auto& filt : tally_filters) { + for (auto& filt : model::tally_filters) { auto* distrib_filt = dynamic_cast(filt.get()); if (distrib_filt) { distribcells.insert(distrib_filt->cell_); diff --git a/src/simulation.cpp b/src/simulation.cpp index b1b657623..df7897d3f 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -81,7 +81,7 @@ int openmc_simulation_init() // Allocate array for matching filter bins #pragma omp parallel { - filter_matches.resize(n_filters); + simulation::filter_matches.resize(model::tally_filters.size()); } // Set up tally procedure pointers @@ -144,7 +144,7 @@ int openmc_simulation_finalize() #pragma omp parallel { - filter_matches.clear(); + simulation::filter_matches.clear(); } // Deallocate Fortran variables, set tallies to inactive diff --git a/src/tallies/filter.cpp b/src/tallies/filter.cpp index ef4ab345d..aa5d19607 100644 --- a/src/tallies/filter.cpp +++ b/src/tallies/filter.cpp @@ -33,8 +33,13 @@ namespace openmc { // Global variables //============================================================================== +namespace simulation { std::vector filter_matches; +} // namespace simulation + +namespace model { std::vector> tally_filters; +} // namespace model //============================================================================== // Non-member functions @@ -45,10 +50,10 @@ free_memory_tally_c() { #pragma omp parallel { - filter_matches.clear(); + simulation::filter_matches.clear(); } - tally_filters.clear(); + model::tally_filters.clear(); } //============================================================================== @@ -57,7 +62,7 @@ free_memory_tally_c() extern "C" { FilterMatch* filter_match_pointer(int indx) - {return &filter_matches[indx];} + {return &simulation::filter_matches[indx];} void filter_match_bins_push_back(FilterMatch* match, int val) @@ -96,53 +101,53 @@ extern "C" { { std::string type_ {type}; if (type_ == "azimuthal") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "cell") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "cellborn") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "cellfrom") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "distribcell") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "delayedgroup") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "energyfunction") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "energy") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "energyout") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "legendre") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "material") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "mesh") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "meshsurface") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "mu") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "particle") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "polar") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "surface") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "spatiallegendre") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "sphericalharmonics") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "universe") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "zernike") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else if (type_ == "zernikeradial") { - tally_filters.push_back(std::make_unique()); + model::tally_filters.push_back(std::make_unique()); } else { return nullptr; } - return tally_filters.back().get(); + return model::tally_filters.back().get(); } void filter_from_xml(Filter* filt, pugi::xml_node* node)