69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
//
|
|
// simulation.hpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 20.09.18.
|
|
// Copyright © 2018 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#ifndef simulation_hpp
|
|
#define simulation_hpp
|
|
|
|
#include <mpi.h>
|
|
|
|
#include "particle_looper.hpp"
|
|
|
|
class Simulation {
|
|
static const long int seed;
|
|
static const long int numberTotalDecays;
|
|
static const long int simulationStepWidth;
|
|
static const long int popCalcDecays;
|
|
static const long int popCalcStep;
|
|
|
|
long int numberTotalParticles = 0;
|
|
long int number_local_decays = 0;
|
|
long int number_global_decays = 0;
|
|
|
|
Particle_Looper looper;
|
|
|
|
int mpi_rank;
|
|
int mpi_size;
|
|
|
|
int number_pop_species;
|
|
species *pop_species;
|
|
int *pop_array_lengths;
|
|
double **global_cum_time_s;
|
|
int **global_offset;
|
|
|
|
public:
|
|
Simulation();
|
|
~Simulation();
|
|
private:
|
|
void init_pop_arrays();
|
|
void deconstruct_pop_arrays();
|
|
|
|
long int calc_ID_offset();
|
|
long int calc_seed();
|
|
|
|
std::string calc_outfile_path();
|
|
int calc_dir_number();
|
|
std::string build_dirname(int dir_number);
|
|
void create_out_dir(std::string dirname);
|
|
std::string create_number_extension();
|
|
|
|
public:
|
|
void doit();
|
|
private:
|
|
void do_cycle(long int number_total, long int step_size, bool logging);
|
|
void do_decays(const long int &number_decays, const bool &logging);
|
|
|
|
void sync_cpus();
|
|
void sync_populations();
|
|
void do_statusUpdate();
|
|
|
|
void print_term_stats();
|
|
};
|
|
|
|
|
|
#endif /* simulation_hpp */
|