mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Converted physics_common to C++
This commit is contained in:
parent
6dce5e3157
commit
cd493057bf
4 changed files with 52 additions and 22 deletions
26
src/physics_common.cpp
Normal file
26
src/physics_common.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "openmc/physics_common.h"
|
||||
|
||||
#include "openmc/settings.h"
|
||||
#include "openmc/random_lcg.h"
|
||||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// RUSSIAN_ROULETTE
|
||||
//==============================================================================
|
||||
|
||||
void russian_roulette(Particle* p)
|
||||
{
|
||||
if (p->wgt < settings::weight_cutoff) {
|
||||
if (prn() < p->wgt / settings::weight_survive) {
|
||||
p->wgt = settings::weight_survive;
|
||||
p->last_wgt = p->wgt;
|
||||
} else {
|
||||
p->wgt = 0.;
|
||||
p->last_wgt = 0.;
|
||||
p->alive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace openmc
|
||||
Loading…
Add table
Add a link
Reference in a new issue