Converted physics_common to C++

This commit is contained in:
Adam G Nelson 2018-10-07 07:18:29 -04:00
parent 6dce5e3157
commit cd493057bf
4 changed files with 52 additions and 22 deletions

26
src/physics_common.cpp Normal file
View 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