Added termination of Electrons after 100 Interactions

This commit is contained in:
Christian
2019-03-20 15:48:24 +01:00
parent c5174beeb9
commit 63470ac340
7 changed files with 123 additions and 25 deletions
+11 -3
View File
@@ -22,11 +22,10 @@ Simulation::Simulation() {
rngUni.seed(seed);
updater_fraction = numberTotalDecays/100;
updater_numberOfPrevious = 0;
}
void Simulation::doit() {
Electron *actionElectronPtr;
int numberInteractionsThisElectron = 0;
while ( (numberDecays < numberTotalDecays) || (electronQue.size() > 0) ) {
if (electronQue.empty()) {
electronQue.push_back(Kat.injectElectron(numberTotalElectrons++, &rngUni, &rngNormal));
@@ -38,12 +37,21 @@ void Simulation::doit() {
if (!Kat.check_Termination (*actionElectronPtr) ) {
do_interaction(actionElectronPtr);
}
if (Kat.check_Termination (*actionElectronPtr)) {
if (Kat.check_Termination (*actionElectronPtr) || check_NumberInteractions(numberInteractionsThisElectron)) {
electronQue.pop_front();
numberInteractionsThisElectron = 0;
}
}
};
bool Simulation::check_NumberInteractions(int &numberInteractionsThisElectron) {
if (numberInteractionsThisElectron < 100) {
numberInteractionsThisElectron++;
return(false);
} else {
return(true);
}
}
void Simulation::doTC6() {
cout<<endl<<"Simulation::doTC6: Doing Testcase 6."<<endl<<endl;
parameterCheck_TC6();