mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Move secondary bank outside of Particle class
This commit is contained in:
parent
49bf4523c3
commit
279104cfed
6 changed files with 12 additions and 13 deletions
|
|
@ -22,11 +22,12 @@ namespace simulation {
|
|||
|
||||
extern std::vector<Particle::Bank> source_bank;
|
||||
extern std::vector<Particle::Bank> fission_bank;
|
||||
extern std::vector<Particle::Bank> secondary_bank;
|
||||
#ifdef _OPENMP
|
||||
extern std::vector<Particle::Bank> master_fission_bank;
|
||||
#endif
|
||||
|
||||
#pragma omp threadprivate(fission_bank)
|
||||
#pragma omp threadprivate(fission_bank, secondary_bank)
|
||||
|
||||
} // namespace simulation
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public:
|
|||
//! \param u Direction of the secondary particle
|
||||
//! \param E Energy of the secondary particle in [eV]
|
||||
//! \param type Particle type
|
||||
void create_secondary(Direction u, double E, Type type);
|
||||
void create_secondary(Direction u, double E, Type type) const;
|
||||
|
||||
//! initialize from a source site
|
||||
//
|
||||
|
|
@ -283,9 +283,6 @@ public:
|
|||
|
||||
// Track output
|
||||
bool write_track_ {false};
|
||||
|
||||
// Secondary particles created
|
||||
std::vector<Bank> secondary_bank_;
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace simulation {
|
|||
|
||||
std::vector<Particle::Bank> source_bank;
|
||||
std::vector<Particle::Bank> fission_bank;
|
||||
std::vector<Particle::Bank> secondary_bank;
|
||||
#ifdef _OPENMP
|
||||
std::vector<Particle::Bank> master_fission_bank;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ Particle::clear()
|
|||
}
|
||||
|
||||
void
|
||||
Particle::create_secondary(Direction u, double E, Type type)
|
||||
Particle::create_secondary(Direction u, double E, Type type) const
|
||||
{
|
||||
secondary_bank_.emplace_back();
|
||||
simulation::secondary_bank.emplace_back();
|
||||
|
||||
auto& bank {secondary_bank_.back()};
|
||||
auto& bank {simulation::secondary_bank.back()};
|
||||
bank.particle = type;
|
||||
bank.wgt = wgt_;
|
||||
bank.r = this->r();
|
||||
|
|
@ -357,10 +357,10 @@ Particle::transport()
|
|||
// Check for secondary particles if this particle is dead
|
||||
if (!alive_) {
|
||||
// If no secondary particles, break out of event loop
|
||||
if (secondary_bank_.empty()) break;
|
||||
if (simulation::secondary_bank.empty()) break;
|
||||
|
||||
this->from_source(&secondary_bank_.back());
|
||||
secondary_bank_.pop_back();
|
||||
this->from_source(&simulation::secondary_bank.back());
|
||||
simulation::secondary_bank.pop_back();
|
||||
n_event = 0;
|
||||
|
||||
// Enter new particle in particle track file
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void sample_neutron_reaction(Particle* p)
|
|||
create_fission_sites(p, i_nuclide, rx, simulation::fission_bank);
|
||||
} else if (settings::run_mode == RUN_MODE_FIXEDSOURCE &&
|
||||
settings::create_fission_neutrons) {
|
||||
create_fission_sites(p, i_nuclide, rx, p->secondary_bank_);
|
||||
create_fission_sites(p, i_nuclide, rx, simulation::secondary_bank);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ sample_reaction(Particle* p)
|
|||
create_fission_sites(p, simulation::fission_bank);
|
||||
} else if ((settings::run_mode == RUN_MODE_FIXEDSOURCE) &&
|
||||
(settings::create_fission_neutrons)) {
|
||||
create_fission_sites(p, p->secondary_bank_);
|
||||
create_fission_sites(p, simulation::secondary_bank);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue