More or less last working status, major changes comming now.

This commit is contained in:
Christian
2019-04-13 00:14:51 +02:00
parent b5a73da3b8
commit 404dccb5ef
11 changed files with 411 additions and 110 deletions
+22 -12
View File
@@ -23,32 +23,42 @@ const int Simulation::propagationMethod = getParameter("propagationMethod");
const int Simulation::maxInteractions = getParameter("maxInteractions");
Simulation::Simulation() {
numberTotalElectrons = 0;
numberDecays = 0;
rngUni.seed(seed);
updater_fraction = numberTotalDecays/100;
updater_numberOfPrevious = 0;
}
void Simulation::doit() {
int numberInteractionsThisElectron = 0;
while ( (numberDecays < numberTotalDecays) || (electronQue.size() > 0) ) {
if (electronQue.empty()) {
while ( (numberDecays < numberTotalDecays) || (!electronQue.empty()) || (!tritiumIonQue.empty()) ) {
if (electronQue.empty() && tritiumIonQue.empty()) {
electronQue.push_back(Kat.injectElectron(numberTotalElectrons++, &rngUni, &rngNormal));
numberDecays++;
}
actionElectronPtr = &electronQue.front();
do_statusUpdate();
if (!electronQue.empty()) {
process_firstElectron();
} else {
process_firstTIon();
}
}
};
void Simulation::process_firstElectron() {
int numberInteractionsThisElectron = 0;
actionElectronPtr = &electronQue.front();
while (!Kat.check_Termination (*actionElectronPtr) && !check_NumberInteractions(numberInteractionsThisElectron)) {
move_electron(actionElectronPtr, &Log);
if (!Kat.check_Termination (*actionElectronPtr) ) {
do_interaction(actionElectronPtr);
}
if (Kat.check_Termination (*actionElectronPtr) || check_NumberInteractions(numberInteractionsThisElectron)) {
electronQue.pop_front();
numberInteractionsThisElectron = 0;
}
}
};
electronQue.pop_front();
}
void Simulation::process_firstTIon() {
}
bool Simulation::check_NumberInteractions(int &numberInteractionsThisElectron) {
if (maxInteractions == 0) {