// // 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: "<