Files
katrin-plasma/src/mc_electron/simulation_serial.cpp
T
Christian 3ddf92fd75 Added some recombination and cluster formation channels.
Changed Parameter names to be more consistent.
2019-10-14 15:37:45 +02:00

49 lines
1.3 KiB
C++

//
// simulation_serial.cpp
// mc_electron_serial
//
// Created by Christian Reiling on 17.07.19.
// Copyright © 2019 Christian Reiling. All rights reserved.
//
#include "simulation_serial.hpp"
using namespace std;
const long int Simulation::seed = load_parameter("SEED");
const long int Simulation::numberTotalDecays = load_parameter("DECAYS");
const long int Simulation::simulationStepWidth = load_parameter("STEP");
std::string Simulation::calc_outfile_path() {
string parname = get_parameter_filenamepath();
stringstream H5name;
int i = 1;
do {
H5name.str(std::string());
H5name << parname << "_" << get_time_string() << "_" << i++<<".h5";
} while ( is_file(H5name.str()) );
return H5name.str();
}
void Simulation::doit() {
int num_cycles = numberTotalDecays/simulationStepWidth;
int num_remaining = numberTotalDecays%simulationStepWidth;
for (int i = 0; i<(num_cycles-1); i++) {
do_decays(simulationStepWidth);
}
do_decays(simulationStepWidth + num_remaining);
cout<<"Total particles: "<<looper.get_number_total_particles()<<"\n";
};
void Simulation::do_decays(int number_decays) {
looper.do_loops(number_decays);
number_current_decays += number_decays;
do_statusUpdate();
}
void Simulation::do_statusUpdate() {
cout<<number_current_decays<<"/"<<numberTotalDecays<<endl;
}