Restructuring Code. Removed some small classes which provided only 1 function, like parameter. Now each class calls it own parameters and stores them as static const.

Merged function containers.

Added HDF5 output and reworked Logger class into Base class and 2 derived classes ASCI_Logger and H5_Logger
This commit is contained in:
Christian
2019-04-02 10:44:33 +02:00
parent 64a2340c85
commit 62772f8477
25 changed files with 697 additions and 574 deletions
+14 -8
View File
@@ -9,13 +9,19 @@
#include "simulation.hpp"
#include "myexeption.h"
#include "constants.hpp"
#include "functions.hpp"
#include "fstream"
using namespace std;
const long int Simulation::seed = getParameter("seed");
const long int Simulation::numberTotalDecays = getParameter("numberTotalDecays");
const int Simulation::propagationMethod = getParameter("propagationMethod");
const int Simulation::maxInteractions = getParameter("maxInteractions");
Simulation::Simulation() {
numberTotalElectrons = 0;
numberDecays = 0;
@@ -45,11 +51,11 @@ void Simulation::doit() {
};
bool Simulation::check_NumberInteractions(int &numberInteractionsThisElectron) {
if (maxNumberInteractionsPerElectron == 0) {
if (maxInteractions == 0) {
return(false);
}
if (numberInteractionsThisElectron < maxNumberInteractionsPerElectron) {
if (numberInteractionsThisElectron < maxInteractions) {
numberInteractionsThisElectron++;
return(false);
} else {
@@ -82,7 +88,7 @@ void Simulation::do_statusUpdate() {
}
}
void Simulation::move_electron(Electron *moveElectron, Logger *Log) {
void Simulation::move_electron(Electron *moveElectron, H5_Logger *Log) {
double MFP_m = Kat.get_MFP_m(&electronQue.front());
if (propagationMethod==0) {
Kat.do_DriftApproximationMovement(moveElectron, MFP_m, Log);
@@ -125,10 +131,10 @@ void Simulation::do_interaction(Electron *interactElectron) {
void Simulation::parameterCheck_TC6() {
if (
injectionMethod == 1 &&
elaOn == 0 &&
ionOn == 1 &&
numberZBins == -1
getParameter("injectionMethod") == 1 &&
getParameter("elaOn") == 0 &&
getParameter("ionOn") == 1 &&
getParameter("numberZBins") == -1
) {
return;
}else {