Added termination of Electrons after 100 Interactions
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user