Working Version with Population update and T+ interactions.
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
// Copyright © 2018 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "simulation.hpp"
|
||||
|
||||
using namespace std;
|
||||
@@ -16,25 +15,54 @@ const long int Simulation::seed = getParameter("seed");
|
||||
const long int Simulation::numberTotalDecays = getParameter("numberTotalDecays");
|
||||
const int Simulation::maxInteractions = getParameter("maxInteractions");
|
||||
|
||||
void Simulation::init_Simulation() {
|
||||
set_RNGs();
|
||||
Tim = Timer(&numberDecays);
|
||||
Pop = Population_Builder::build_Population(&Tim, &rngUni, &rngNormal);
|
||||
Inj = Injector(&rngUni, &rngNormal);
|
||||
Mov = Mover(&Log);
|
||||
Inter = InteractionBuilder::build_InteractionProcessor(&Pop, &rngUni, &rngNormal);
|
||||
set_statusUpdater();
|
||||
}
|
||||
|
||||
void Simulation::set_RNGs() {
|
||||
rngUni.seed(seed);
|
||||
rngNormal.seed(seed);
|
||||
}
|
||||
|
||||
void Simulation::set_statusUpdater() {
|
||||
updater_fraction = numberTotalDecays/100;
|
||||
updater_fraction = updater_fraction==0 ? 1 : updater_fraction;
|
||||
}
|
||||
|
||||
void Simulation::doit() {
|
||||
InteractionOut IntOut;
|
||||
double mfp;
|
||||
std::deque<Particle> partQue;
|
||||
Particle curPart;
|
||||
vec3 oldLoc_m;
|
||||
while ( (numberDecays < numberTotalDecays) || (!partQue.empty()) ) {
|
||||
if (partQue.empty()) {
|
||||
curPart = Inj.injectElectron(numberTotalElectrons);
|
||||
curPart = Inj.injectElectron(numberTotalParticles);
|
||||
numberDecays++;
|
||||
numberTotalElectrons++;
|
||||
numberTotalParticles++;
|
||||
do_statusUpdate();
|
||||
} else {
|
||||
curPart = partQue.front();
|
||||
partQue.pop_front();
|
||||
}
|
||||
|
||||
while (!Term.check_Termination(curPart)) {
|
||||
oldLoc_m = curPart.get_Location_m();
|
||||
mfp = 1/Inter.get_macroSigma_m2(curPart);
|
||||
Mov.moveParticle(&curPart, mfp);
|
||||
Pop.up_Denisty(oldLoc_m, curPart);
|
||||
if (!Term.check_Termination(curPart)) {
|
||||
IntOut = Inter.do_Interaction(&curPart);
|
||||
//appy_Inter_Output(IntOut);
|
||||
IntOut.appendDeque(&partQue, &numberTotalParticles);
|
||||
if (IntOut.terminateCurrent()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +77,7 @@ void Simulation::do_statusUpdate() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void Simulation::doTC6() {
|
||||
cout<<endl<<"Simulation::doTC6: Doing Testcase 6."<<endl<<endl;
|
||||
|
||||
Reference in New Issue
Block a user