mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Turn Particle.coord_ into a std::vector (remove MAX_COORD)
This commit is contained in:
parent
d70cfda07c
commit
86d187a0a7
8 changed files with 15 additions and 25 deletions
|
|
@ -20,9 +20,6 @@ option(optimize "Turn on all compiler optimization flags" OFF)
|
|||
option(coverage "Compile with coverage analysis flags" OFF)
|
||||
option(dagmc "Enable support for DAGMC (CAD) geometry" OFF)
|
||||
|
||||
# Maximum number of nested coordinates levels
|
||||
set(maxcoord 10 CACHE STRING "Maximum number of nested coordinate levels")
|
||||
|
||||
#===============================================================================
|
||||
# MPI for distributed-memory parallelism
|
||||
#===============================================================================
|
||||
|
|
@ -260,7 +257,6 @@ target_include_directories(libopenmc
|
|||
# Set compile flags
|
||||
target_compile_options(libopenmc PRIVATE ${cxxflags})
|
||||
|
||||
target_compile_definitions(libopenmc PUBLIC -DMAX_COORD=${maxcoord})
|
||||
if (HDF5_IS_PARALLEL)
|
||||
target_compile_definitions(libopenmc PRIVATE -DPHDF5)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -243,9 +243,6 @@ coverage
|
|||
Compile and link code instrumented for coverage analysis. This is typically
|
||||
used in conjunction with gcov_.
|
||||
|
||||
maxcoord
|
||||
Maximum number of nested coordinate levels in geometry. Defaults to 10.
|
||||
|
||||
To set any of these options (e.g. turning on debug mode), the following form
|
||||
should be used:
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ namespace openmc {
|
|||
|
||||
namespace model {
|
||||
|
||||
extern "C" int root_universe;
|
||||
extern int root_universe; //!< Index of root universe
|
||||
extern int n_coord_levels; //!< Number of CSG coordinate levels
|
||||
|
||||
extern std::vector<int64_t> overlap_check_count;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
|
|||
//! \return The index of the root universe.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int32_t find_root_universe();
|
||||
int32_t find_root_universe();
|
||||
|
||||
//==============================================================================
|
||||
//! Populate all data structures needed for distribcells.
|
||||
|
|
@ -74,7 +74,7 @@ void prepare_distribcell();
|
|||
//! the root universe).
|
||||
//==============================================================================
|
||||
|
||||
extern "C" void count_cell_instances(int32_t univ_indx);
|
||||
void count_cell_instances(int32_t univ_indx);
|
||||
|
||||
//==============================================================================
|
||||
//! Recursively search through universes and count universe instances.
|
||||
|
|
@ -84,8 +84,7 @@ extern "C" void count_cell_instances(int32_t univ_indx);
|
|||
//! search_univ.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int
|
||||
count_universe_instances(int32_t search_univ, int32_t target_univ_id);
|
||||
int count_universe_instances(int32_t search_univ, int32_t target_univ_id);
|
||||
|
||||
//==============================================================================
|
||||
//! Build a character array representing the path to a distribcell instance.
|
||||
|
|
@ -107,7 +106,7 @@ distribcell_path(int32_t target_cell, int32_t map, int32_t target_offset);
|
|||
//! \return The number of coordinate levels.
|
||||
//==============================================================================
|
||||
|
||||
extern "C" int maximum_levels(int32_t univ);
|
||||
int maximum_levels(int32_t univ);
|
||||
|
||||
//==============================================================================
|
||||
//! Deallocates global vectors and maps for cells, universes, and lattices.
|
||||
|
|
|
|||
|
|
@ -229,11 +229,11 @@ public:
|
|||
|
||||
int n_coord_ {1}; //!< number of current coordinate levels
|
||||
int cell_instance_; //!< offset for distributed properties
|
||||
LocalCoord coord_[MAX_COORD]; //!< coordinates for all levels
|
||||
std::vector<LocalCoord> coord_; //!< coordinates for all levels
|
||||
|
||||
// Particle coordinates before crossing a surface
|
||||
int n_coord_last_ {1}; //!< number of current coordinates
|
||||
int cell_last_[MAX_COORD]; //!< coordinates for all levels
|
||||
std::vector<int> cell_last_; //!< coordinates for all levels
|
||||
|
||||
// Energy data
|
||||
double E_; //!< post-collision energy in eV
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace openmc {
|
|||
namespace model {
|
||||
|
||||
int root_universe {-1};
|
||||
int n_coord_levels;
|
||||
|
||||
std::vector<int64_t> overlap_check_count;
|
||||
|
||||
|
|
@ -257,7 +258,7 @@ find_cell(Particle* p, bool use_neighbor_lists)
|
|||
}
|
||||
|
||||
// Reset all the deeper coordinate levels.
|
||||
for (int i = p->n_coord_; i < MAX_COORD; i++) {
|
||||
for (int i = p->n_coord_; i < p->coord_.size(); i++) {
|
||||
p->coord_[i].reset();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,14 +217,8 @@ void finalize_geometry(std::vector<std::vector<double>>& nuc_temps,
|
|||
// Determine desired temperatures for each nuclide and S(a,b) table
|
||||
get_temperatures(nuc_temps, thermal_temps);
|
||||
|
||||
// Check to make sure there are not too many nested coordinate levels in the
|
||||
// geometry since the coordinate list is statically allocated for performance
|
||||
// reasons
|
||||
if (maximum_levels(model::root_universe) > MAX_COORD) {
|
||||
fatal_error("Too many nested coordinate levels in the geometry. "
|
||||
"Try increasing the maximum number of coordinate levels by "
|
||||
"providing the CMake -Dmaxcoord= option.");
|
||||
}
|
||||
// Determine number of nested coordinate levels in the geometry
|
||||
model::n_coord_levels = maximum_levels(model::root_universe);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ LocalCoord::reset()
|
|||
|
||||
Particle::Particle()
|
||||
{
|
||||
// Clear coordinate lists
|
||||
// Create and clear coordinate levels
|
||||
coord_.resize(model::n_coord_levels);
|
||||
cell_last_.resize(model::n_coord_levels);
|
||||
clear();
|
||||
|
||||
for (int& n : n_delayed_bank_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue