diff --git a/include/openmc/capi.h b/include/openmc/capi.h index a04f1a622..ace061f54 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -135,7 +135,6 @@ extern "C" { // Global variables extern char openmc_err_msg[256]; - extern int32_t n_materials; extern int n_nuclides; extern int32_t n_plots; extern int32_t n_realizations; diff --git a/include/openmc/material.h b/include/openmc/material.h index b6d7e19cd..fcab023a5 100644 --- a/include/openmc/material.h +++ b/include/openmc/material.h @@ -14,9 +14,14 @@ namespace openmc { //============================================================================== class Material; + +namespace model { + extern std::vector materials; extern std::unordered_map material_map; +} // namespace model + //============================================================================== //! A substance with constituent nuclides and thermal scattering data //============================================================================== diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index 3d31fb489..7fcd58a06 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -17,6 +17,19 @@ namespace openmc { +//============================================================================== +// Global variables +//============================================================================== + +class RegularMesh; + +namespace model { + +extern std::vector> meshes; +extern std::unordered_map mesh_map; + +} // namespace model + //============================================================================== //! Tessellation of n-dimensional Euclidean space by congruent squares or cubes //============================================================================== @@ -117,15 +130,6 @@ extern "C" void read_meshes(pugi::xml_node* root); //! \param[in] group HDF5 group extern "C" void meshes_to_hdf5(hid_t group); -//============================================================================== -// Global variables -//============================================================================== - -extern std::vector> meshes; - -extern std::unordered_map mesh_map; - - } // namespace openmc #endif // OPENMC_MESH_H diff --git a/src/cell.cpp b/src/cell.cpp index 8c5aaf29c..5c341eb15 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -480,7 +480,7 @@ CSGCell::to_hdf5(hid_t cell_group) const std::vector mat_ids; for (auto i_mat : material_) { if (i_mat != MATERIAL_VOID) { - mat_ids.push_back(materials[i_mat]->id_); + mat_ids.push_back(model::materials[i_mat]->id_); } else { mat_ids.push_back(MATERIAL_VOID); } @@ -724,7 +724,7 @@ openmc_cell_set_fill(int32_t index, int type, int32_t n, int i_mat = indices[i]; if (i_mat == MATERIAL_VOID) { c.material_.push_back(MATERIAL_VOID); - } else if (i_mat >= 1 && i_mat <= materials.size()) { + } else if (i_mat >= 1 && i_mat <= model::materials.size()) { //TODO: off-by-one c.material_.push_back(i_mat - 1); } else { diff --git a/src/cmfd_execute.cpp b/src/cmfd_execute.cpp index 46371601b..0af584c1b 100644 --- a/src/cmfd_execute.cpp +++ b/src/cmfd_execute.cpp @@ -24,7 +24,7 @@ cmfd_populate_sourcecounts(int n_energy, const double* energies, openmc_source_bank(&source_bank, &n); // Get source counts in each mesh bin / energy bin - auto& m = meshes.at(settings::index_cmfd_mesh); + auto& m = model::meshes.at(settings::index_cmfd_mesh); xt::xarray counts = m->count_sites(simulation::work, source_bank, n_energy, energies, outside); // Copy data from the xarray into the source counts array diff --git a/src/eigenvalue.cpp b/src/eigenvalue.cpp index 89e25dbcf..4d9196ea0 100644 --- a/src/eigenvalue.cpp +++ b/src/eigenvalue.cpp @@ -497,7 +497,7 @@ int openmc_get_keff(double* k_combined) void shannon_entropy() { // Get pointer to entropy mesh - auto& m = meshes[settings::index_entropy_mesh]; + auto& m = model::meshes[settings::index_entropy_mesh]; // Get pointer to fission bank Bank* fission_bank; @@ -533,7 +533,7 @@ void shannon_entropy() void ufs_count_sites() { - auto &m = meshes[settings::index_ufs_mesh]; + auto &m = model::meshes[settings::index_ufs_mesh]; if (simulation::current_batch == 1 && simulation::current_gen == 1) { // On the first generation, just assume that the source is already evenly @@ -579,7 +579,7 @@ void ufs_count_sites() double ufs_get_weight(const Particle* p) { - auto& m = meshes[settings::index_ufs_mesh]; + auto& m = model::meshes[settings::index_ufs_mesh]; // Determine indices on ufs mesh for current location // TODO: off by one diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 2a3cf1db9..52d0ae92a 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -46,8 +46,8 @@ adjust_indices() for (auto it = c->material_.begin(); it != c->material_.end(); it++) { int32_t mid = *it; if (mid != MATERIAL_VOID) { - auto search = material_map.find(mid); - if (search != material_map.end()) { + auto search = model::material_map.find(mid); + if (search != model::material_map.end()) { *it = search->second; } else { std::stringstream err_msg; @@ -96,9 +96,9 @@ assign_temperatures() c->sqrtkT_.push_back(0); } else { - if (materials[i_mat]->temperature_ >= 0) { + if (model::materials[i_mat]->temperature_ >= 0) { // This material has a default temperature; use that value. - auto T = materials[i_mat]->temperature_; + auto T = model::materials[i_mat]->temperature_; c->sqrtkT_.push_back(std::sqrt(K_BOLTZMANN * T)); } else { // Use the global default temperature. diff --git a/src/material.cpp b/src/material.cpp index ecc6eed2b..7f8cfc50b 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -13,9 +13,13 @@ namespace openmc { // Global variables //============================================================================== +namespace model { + std::vector materials; std::unordered_map material_map; +} // namespace model + //============================================================================== // Material implementation //============================================================================== @@ -46,16 +50,16 @@ read_materials(pugi::xml_node* node) { // Loop over XML material elements and populate the array. for (pugi::xml_node material_node : node->children("material")) { - materials.push_back(new Material(material_node)); + model::materials.push_back(new Material(material_node)); } - materials.shrink_to_fit(); + model::materials.shrink_to_fit(); // Populate the material map. - for (int i = 0; i < materials.size(); i++) { - int32_t mid = materials[i]->id_; - auto search = material_map.find(mid); - if (search == material_map.end()) { - material_map[mid] = i; + for (int i = 0; i < model::materials.size(); i++) { + int32_t mid = model::materials[i]->id_; + auto search = model::material_map.find(mid); + if (search == model::material_map.end()) { + model::material_map[mid] = i; } else { std::stringstream err_msg; err_msg << "Two or more materials use the same unique ID: " << mid; @@ -71,8 +75,8 @@ read_materials(pugi::xml_node* node) extern "C" int openmc_material_get_volume(int32_t index, double* volume) { - if (index >= 1 && index <= materials.size()) { - Material* m = materials[index - 1]; + if (index >= 1 && index <= model::materials.size()) { + Material* m = model::materials[index - 1]; if (m->volume_ >= 0.0) { *volume = m->volume_; return 0; @@ -91,8 +95,8 @@ openmc_material_get_volume(int32_t index, double* volume) extern "C" int openmc_material_set_volume(int32_t index, double volume) { - if (index >= 1 && index <= materials.size()) { - Material* m = materials[index - 1]; + if (index >= 1 && index <= model::materials.size()) { + Material* m = model::materials[index - 1]; if (volume >= 0.0) { m->volume_ = volume; return 0; @@ -111,7 +115,7 @@ openmc_material_set_volume(int32_t index, double volume) //============================================================================== extern "C" { - Material* material_pointer(int32_t indx) {return materials[indx];} + Material* material_pointer(int32_t indx) {return model::materials[indx];} int32_t material_id(Material* mat) {return mat->id_;} @@ -119,7 +123,7 @@ extern "C" { { mat->id_ = id; //TODO: off-by-one - material_map[id] = index - 1; + model::material_map[id] = index - 1; } bool material_fissionable(Material* mat) {return mat->fissionable;} @@ -131,17 +135,17 @@ extern "C" { void extend_materials_c(int32_t n) { - materials.reserve(materials.size() + n); + model::materials.reserve(model::materials.size() + n); for (int32_t i = 0; i < n; i++) { - materials.push_back(new Material()); + model::materials.push_back(new Material()); } } void free_memory_material_c() { - for (Material *mat : materials) {delete mat;} - materials.clear(); - material_map.clear(); + for (Material *mat : model::materials) {delete mat;} + model::materials.clear(); + model::material_map.clear(); } } diff --git a/src/mesh.cpp b/src/mesh.cpp index 2c3e508fe..6ec298a78 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -29,10 +29,13 @@ namespace openmc { // Global variables //============================================================================== -std::vector> meshes; +namespace model { +std::vector> meshes; std::unordered_map mesh_map; +} // namespace model + //============================================================================== // RegularMesh implementation //============================================================================== @@ -44,7 +47,7 @@ RegularMesh::RegularMesh(pugi::xml_node node) id_ = std::stoi(get_node_value(node, "id")); // Check to make sure 'id' hasn't been used - if (mesh_map.find(id_) != mesh_map.end()) { + if (model::mesh_map.find(id_) != model::mesh_map.end()) { fatal_error("Two or more meshes use the same unique ID: " + std::to_string(id_)); } @@ -724,11 +727,11 @@ xt::xarray RegularMesh::count_sites(int64_t n, const Bank* bank, extern "C" int openmc_extend_meshes(int32_t n, int32_t* index_start, int32_t* index_end) { - if (index_start) *index_start = meshes.size(); + if (index_start) *index_start = model::meshes.size(); for (int i = 0; i < n; ++i) { - meshes.emplace_back(new RegularMesh{}); + model::meshes.emplace_back(new RegularMesh{}); } - if (index_end) *index_end = meshes.size() - 1; + if (index_end) *index_end = model::meshes.size() - 1; return 0; } @@ -737,8 +740,8 @@ openmc_extend_meshes(int32_t n, int32_t* index_start, int32_t* index_end) extern "C" int openmc_get_mesh_index(int32_t id, int32_t* index) { - auto pair = mesh_map.find(id); - if (pair == mesh_map.end()) { + auto pair = model::mesh_map.find(id); + if (pair == model::mesh_map.end()) { set_errmsg("No mesh exists with ID=" + std::to_string(id) + "."); return OPENMC_E_INVALID_ID; } @@ -750,11 +753,11 @@ openmc_get_mesh_index(int32_t id, int32_t* index) extern "C" int openmc_mesh_get_id(int32_t index, int32_t* id) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - *id = meshes[index]->id_; + *id = model::meshes[index]->id_; return 0; } @@ -762,12 +765,12 @@ openmc_mesh_get_id(int32_t index, int32_t* id) extern "C" int openmc_mesh_set_id(int32_t index, int32_t id) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - meshes[index]->id_ = id; - mesh_map[id] = index; + model::meshes[index]->id_ = id; + model::mesh_map[id] = index; return 0; } @@ -775,12 +778,12 @@ openmc_mesh_set_id(int32_t index, int32_t id) extern "C" int openmc_mesh_get_dimension(int32_t index, int** dims, int* n) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - *dims = meshes[index]->shape_.data(); - *n = meshes[index]->n_dimension_; + *dims = model::meshes[index]->shape_.data(); + *n = model::meshes[index]->n_dimension_; return 0; } @@ -788,14 +791,14 @@ openmc_mesh_get_dimension(int32_t index, int** dims, int* n) extern "C" int openmc_mesh_set_dimension(int32_t index, int n, const int* dims) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } // Copy dimension std::vector shape = {static_cast(n)}; - auto& m = meshes[index]; + auto& m = model::meshes[index]; m->shape_ = xt::adapt(dims, n, xt::no_ownership(), shape); m->n_dimension_ = m->shape_.size(); @@ -806,12 +809,12 @@ openmc_mesh_set_dimension(int32_t index, int n, const int* dims) extern "C" int openmc_mesh_get_params(int32_t index, double** ll, double** ur, double** width, int* n) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - auto& m = meshes[index]; + auto& m = model::meshes[index]; if (m->lower_left_.dimension() == 0) { set_errmsg("Mesh parameters have not been set."); return OPENMC_E_ALLOCATE; @@ -829,12 +832,12 @@ extern "C" int openmc_mesh_set_params(int32_t index, int n, const double* ll, const double* ur, const double* width) { - if (index < 0 || index >= meshes.size()) { + if (index < 0 || index >= model::meshes.size()) { set_errmsg("Index in meshes array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - auto& m = meshes[index]; + auto& m = model::meshes[index]; std::vector shape = {static_cast(n)}; if (ll && ur) { m->lower_left_ = xt::adapt(ll, n, xt::no_ownership(), shape); @@ -864,10 +867,10 @@ void read_meshes(pugi::xml_node* root) { for (auto node : root->children("mesh")) { // Read mesh and add to vector - meshes.emplace_back(new RegularMesh{node}); + model::meshes.emplace_back(new RegularMesh{node}); // Map ID to position in vector - mesh_map[meshes.back()->id_] = meshes.size() - 1; + model::mesh_map[model::meshes.back()->id_] = model::meshes.size() - 1; } } @@ -875,13 +878,13 @@ void meshes_to_hdf5(hid_t group) { // Write number of meshes hid_t meshes_group = create_group(group, "meshes"); - int32_t n_meshes = meshes.size(); + int32_t n_meshes = model::meshes.size(); write_attribute(meshes_group, "n_meshes", n_meshes); if (n_meshes > 0) { // Write IDs of meshes std::vector ids; - for (const auto& m : meshes) { + for (const auto& m : model::meshes) { m->to_hdf5(meshes_group); ids.push_back(m->id_); } @@ -896,9 +899,9 @@ void meshes_to_hdf5(hid_t group) //============================================================================== extern "C" { - int n_meshes() { return meshes.size(); } + int n_meshes() { return model::meshes.size(); } - RegularMesh* mesh_ptr(int i) { return meshes.at(i).get(); } + RegularMesh* mesh_ptr(int i) { return model::meshes.at(i).get(); } int32_t mesh_id(RegularMesh* m) { return m->id_; } @@ -936,8 +939,8 @@ extern "C" { void free_memory_mesh() { - meshes.clear(); - mesh_map.clear(); + model::meshes.clear(); + model::mesh_map.clear(); } } diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index ff41221ba..4ce64b61a 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -47,7 +47,7 @@ sample_reaction(Particle* p, const double* energy_bin_avg, // change when sampling fission sites. The following block handles all // absorption (including fission) - if (materials[p->material - 1]->fissionable) { + if (model::materials[p->material - 1]->fissionable) { if (settings::run_mode == RUN_MODE_EIGENVALUE) { Bank* result_bank; int64_t result_bank_size; diff --git a/src/plot.cpp b/src/plot.cpp index d325919e4..e372a678e 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -362,23 +362,20 @@ Plot::set_default_colors(pugi::xml_node plot_node) } if ("cell" == pl_color_by) { color_by_ = PlotColorBy::cells; - colors_.resize(model::n_cells); - for (int i = 0; i < model::n_cells; i++) { - colors_[i] = random_color(); - } - + colors_.resize(model::cells.size()); } else if("material" == pl_color_by) { color_by_ = PlotColorBy::mats; - colors_.resize(n_materials); - for (int i = 0; i < materials.size(); i++) { - colors_[i] = random_color(); - } + colors_.resize(model::materials.size()); } else { std::stringstream err_msg; err_msg << "Unsupported plot color type '" << pl_color_by << "' in plot " << id_; fatal_error(err_msg); } + + for (auto& c : colors_) { + c = random_color(); + } } void @@ -423,8 +420,8 @@ Plot::set_user_colors(pugi::xml_node plot_node) fatal_error(err_msg); } } else if (PlotColorBy::mats == color_by_) { - if (material_map.find(col_id) != material_map.end()) { - col_id = material_map[col_id]; + if (model::material_map.find(col_id) != model::material_map.end()) { + col_id = model::material_map[col_id]; colors_[col_id] = user_rgb; } else { std::stringstream err_msg; @@ -586,8 +583,8 @@ Plot::set_mask(pugi::xml_node plot_node) fatal_error(err_msg); } } else if (PlotColorBy::mats == color_by_) { - if (material_map.find(col_id) != material_map.end()) { - col_id = material_map[col_id]; + if (model::material_map.find(col_id) != model::material_map.end()) { + col_id = model::material_map[col_id]; } else { std::stringstream err_msg; @@ -672,7 +669,7 @@ void position_rgb(Particle p, Plot pl, RGBColor& rgb, int& id) id = -1; } else { rgb = pl.colors_[p.material - 1]; - id = materials[p.material - 1]->id_; + id = model::materials[p.material - 1]->id_; } } else if (PlotColorBy::cells == pl.color_by_) { // Assign color based on cell @@ -760,7 +757,7 @@ void draw_mesh_lines(Plot pl, ImageData& data) width[1] = xyz_ur_plot[1] - xyz_ll_plot[1]; width[2] = xyz_ur_plot[2] - xyz_ll_plot[2]; - auto& m = meshes[pl.index_meshlines_mesh_]; + auto& m = model::meshes[pl.index_meshlines_mesh_]; int ijk_ll[3], ijk_ur[3]; bool in_mesh; diff --git a/src/settings.cpp b/src/settings.cpp index 227ebca5c..b5bb4fe80 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -507,12 +507,12 @@ void read_settings_xml() // Shannon Entropy mesh if (check_for_node(root, "entropy_mesh")) { int temp = std::stoi(get_node_value(root, "entropy_mesh")); - if (mesh_map.find(temp) == mesh_map.end()) { + if (model::mesh_map.find(temp) == model::mesh_map.end()) { std::stringstream msg; msg << "Mesh " << temp << " specified for Shannon entropy does not exist."; fatal_error(msg); } - index_entropy_mesh = mesh_map.at(temp); + index_entropy_mesh = model::mesh_map.at(temp); } else if (check_for_node(root, "entropy")) { warning("Specifying a Shannon entropy mesh via the element " @@ -521,18 +521,18 @@ void read_settings_xml() // Read entropy mesh from auto node_entropy = root.child("entropy"); - meshes.emplace_back(new RegularMesh{node_entropy}); + model::meshes.emplace_back(new RegularMesh{node_entropy}); // Set entropy mesh index - index_entropy_mesh = meshes.size() - 1; + index_entropy_mesh = model::meshes.size() - 1; // Assign ID and set mapping - meshes.back()->id_ = 10000; - mesh_map[10000] = index_entropy_mesh; + model::meshes.back()->id_ = 10000; + model::mesh_map[10000] = index_entropy_mesh; } if (index_entropy_mesh >= 0) { - auto& m = *meshes[index_entropy_mesh]; + auto& m = *model::meshes[index_entropy_mesh]; if (m.shape_.dimension() == 0) { // If the user did not specify how many mesh cells are to be used in // each direction, we automatically determine an appropriate number of @@ -552,13 +552,13 @@ void read_settings_xml() // Uniform fission source weighting mesh if (check_for_node(root, "ufs_mesh")) { auto temp = std::stoi(get_node_value(root, "ufs_mesh")); - if (mesh_map.find(temp) == mesh_map.end()) { + if (model::mesh_map.find(temp) == model::mesh_map.end()) { std::stringstream msg; msg << "Mesh " << temp << " specified for uniform fission site method " "does not exist."; fatal_error(msg); } - index_ufs_mesh = mesh_map.at(temp); + index_ufs_mesh = model::mesh_map.at(temp); } else if (check_for_node(root, "uniform_fs")) { warning("Specifying a UFS mesh via the element " @@ -567,14 +567,14 @@ void read_settings_xml() // Read entropy mesh from auto node_ufs = root.child("uniform_fs"); - meshes.emplace_back(new RegularMesh{node_ufs}); + model::meshes.emplace_back(new RegularMesh{node_ufs}); // Set entropy mesh index - index_ufs_mesh = meshes.size() - 1; + index_ufs_mesh = model::meshes.size() - 1; // Assign ID and set mapping - meshes.back()->id_ = 10001; - mesh_map[10001] = index_entropy_mesh; + model::meshes.back()->id_ = 10001; + model::mesh_map[10001] = index_entropy_mesh; } if (index_ufs_mesh >= 0) { diff --git a/src/source.cpp b/src/source.cpp index 782fb97a2..6610e7f4d 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -169,7 +169,7 @@ Bank SourceDistribution::sample() const // Determine material auto c = model::cells[cell_index - 1]; int32_t mat_index = c->material_[instance]; - auto m = materials[mat_index]; + auto m = model::materials[mat_index]; if (mat_index == MATERIAL_VOID) { found = false; diff --git a/src/tallies/filter_material.cpp b/src/tallies/filter_material.cpp index d36175e9b..be462b915 100644 --- a/src/tallies/filter_material.cpp +++ b/src/tallies/filter_material.cpp @@ -21,8 +21,8 @@ MaterialFilter::initialize() { // Convert material IDs to indices of the global array. for (auto& m : materials_) { - auto search = material_map.find(m); - if (search != material_map.end()) { + auto search = model::material_map.find(m); + if (search != model::material_map.end()) { m = search->second; } else { std::stringstream err_msg; @@ -55,7 +55,7 @@ MaterialFilter::to_statepoint(hid_t filter_group) const { Filter::to_statepoint(filter_group); std::vector material_ids; - for (auto c : materials_) material_ids.push_back(materials[c]->id_); + for (auto c : materials_) material_ids.push_back(model::materials[c]->id_); write_dataset(filter_group, "bins", material_ids); } @@ -63,7 +63,7 @@ std::string MaterialFilter::text_label(int bin) const { //TODO: off-by-one - return "Material " + std::to_string(materials[materials_[bin-1]]->id_); + return "Material " + std::to_string(model::materials[materials_[bin-1]]->id_); } //============================================================================== diff --git a/src/tallies/filter_mesh.cpp b/src/tallies/filter_mesh.cpp index 5ff54bcf5..7f2b0d60c 100644 --- a/src/tallies/filter_mesh.cpp +++ b/src/tallies/filter_mesh.cpp @@ -20,8 +20,8 @@ MeshFilter::from_xml(pugi::xml_node node) } auto id = bins_[0]; - auto search = mesh_map.find(id); - if (search != mesh_map.end()) { + auto search = model::mesh_map.find(id); + if (search != model::mesh_map.end()) { set_mesh(search->second); } else{ std::stringstream err_msg; @@ -35,14 +35,14 @@ MeshFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match) const { if (estimator != ESTIMATOR_TRACKLENGTH) { - auto bin = meshes[mesh_]->get_bin(p->coord[0].xyz); + auto bin = model::meshes[mesh_]->get_bin(p->coord[0].xyz); if (bin >= 0) { //TODO: off-by-one match.bins_.push_back(bin); match.weights_.push_back(1.0); } } else { - meshes[mesh_]->bins_crossed(p, match.bins_, match.weights_); + model::meshes[mesh_]->bins_crossed(p, match.bins_, match.weights_); } } @@ -50,13 +50,13 @@ void MeshFilter::to_statepoint(hid_t filter_group) const { Filter::to_statepoint(filter_group); - write_dataset(filter_group, "bins", meshes[mesh_]->id_); + write_dataset(filter_group, "bins", model::meshes[mesh_]->id_); } std::string MeshFilter::text_label(int bin) const { - auto& mesh = *meshes[mesh_]; + auto& mesh = *model::meshes[mesh_]; int n_dim = mesh.n_dimension_; int ijk[n_dim]; @@ -76,7 +76,7 @@ MeshFilter::set_mesh(int32_t mesh) { mesh_ = mesh; n_bins_ = 1; - for (auto dim : meshes[mesh_]->shape_) n_bins_ *= dim; + for (auto dim : model::meshes[mesh_]->shape_) n_bins_ *= dim; } //============================================================================== @@ -123,7 +123,7 @@ openmc_mesh_filter_set_mesh(int32_t index, int32_t index_mesh) } // Check the mesh index. - if (index_mesh < 0 || index_mesh >= meshes.size()) { + if (index_mesh < 0 || index_mesh >= model::meshes.size()) { set_errmsg("Index in 'meshes' array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } diff --git a/src/tallies/filter_meshsurface.cpp b/src/tallies/filter_meshsurface.cpp index af9bc5321..a8854c7ec 100644 --- a/src/tallies/filter_meshsurface.cpp +++ b/src/tallies/filter_meshsurface.cpp @@ -11,14 +11,14 @@ void MeshSurfaceFilter::get_all_bins(const Particle* p, int estimator, FilterMatch& match) const { - meshes[mesh_]->surface_bins_crossed(p, match.bins_); + model::meshes[mesh_]->surface_bins_crossed(p, match.bins_); for (auto b : match.bins_) match.weights_.push_back(1.0); } std::string MeshSurfaceFilter::text_label(int bin) const { - auto& mesh = *meshes[mesh_]; + auto& mesh = *model::meshes[mesh_]; int n_dim = mesh.n_dimension_; // Get flattend mesh index and surface index. @@ -76,8 +76,8 @@ void MeshSurfaceFilter::set_mesh(int32_t mesh) { mesh_ = mesh; - n_bins_ = 4 * meshes[mesh_]->n_dimension_; - for (auto dim : meshes[mesh_]->shape_) n_bins_ *= dim; + n_bins_ = 4 * model::meshes[mesh_]->n_dimension_; + for (auto dim : model::meshes[mesh_]->shape_) n_bins_ *= dim; } //==============================================================================