mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Switch surf_src_bank from vector to SharedArray
This commit is contained in:
parent
c362ba5ef4
commit
d849014391
4 changed files with 11 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ namespace simulation {
|
|||
|
||||
extern std::vector<Particle::Bank> source_bank;
|
||||
|
||||
extern std::vector<Particle::Bank> surf_src_bank;
|
||||
extern SharedArray<Particle::Bank> surf_src_bank;
|
||||
|
||||
extern SharedArray<Particle::Bank> fission_bank;
|
||||
|
||||
|
|
@ -34,6 +34,8 @@ void sort_fission_bank();
|
|||
|
||||
void free_memory_bank();
|
||||
|
||||
void init_surf_src_bank(int64_t max);
|
||||
|
||||
void init_fission_bank(int64_t max);
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace simulation {
|
|||
|
||||
std::vector<Particle::Bank> source_bank;
|
||||
|
||||
std::vector<Particle::Bank> surf_src_bank;
|
||||
SharedArray<Particle::Bank> surf_src_bank;
|
||||
|
||||
// The fission bank is allocated as a SharedArray, rather than a vector, as it will
|
||||
// be shared by all threads in the simulation. It will be allocated to a fixed
|
||||
|
|
@ -44,6 +44,11 @@ void free_memory_bank()
|
|||
simulation::progeny_per_particle.clear();
|
||||
}
|
||||
|
||||
void init_surf_src_bank(int64_t max)
|
||||
{
|
||||
simulation::surf_src_bank.reserve(max);
|
||||
}
|
||||
|
||||
void init_fission_bank(int64_t max)
|
||||
{
|
||||
simulation::fission_bank.reserve(max);
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ Particle::cross_surface()
|
|||
site.particle = this->type_;
|
||||
// site.parent_id = this->id_;
|
||||
// site.progeny_id = this->n_progeny_;
|
||||
simulation::surf_src_bank.push_back(site);
|
||||
int64_t idx = simulation::surf_src_bank.thread_safe_append(site);
|
||||
}
|
||||
|
||||
// Handle any applicable boundary conditions.
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ void allocate_banks()
|
|||
// Allocate fission bank
|
||||
init_fission_bank(3*simulation::work_per_rank);
|
||||
|
||||
simulation::surf_src_bank.resize(simulation::work_per_rank);
|
||||
init_surf_src_bank(10*simulation::work_per_rank); // TODO: capacity enough?
|
||||
}
|
||||
|
||||
void initialize_batch()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue