Moved serial mode to target mcelecron_serial.
Implemented parallelization with mpi.
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// particle_looper.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 16.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef particle_looper_hpp
|
||||
#define particle_looper_hpp
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "h5_file.hpp"
|
||||
#include "timer.hpp"
|
||||
|
||||
#include "logger_builder.hpp"
|
||||
#include "population_builder.hpp"
|
||||
|
||||
#include "injector.hpp"
|
||||
#include "mover_builder.hpp"
|
||||
#include "interaction_builder.hpp"
|
||||
#include "terminator_builder.hpp"
|
||||
|
||||
#include "population_load_saver.hpp"
|
||||
|
||||
|
||||
class Particle_Looper {
|
||||
UniRNG rngUni;
|
||||
NormalRNG rngNormal;
|
||||
|
||||
H5_File h5f;
|
||||
Timer timer;
|
||||
|
||||
Particle_Logger_Manager part_loggers;
|
||||
Population_Manager populations;
|
||||
|
||||
Injector injector;
|
||||
Mover_Manager movers;
|
||||
Interaction_Manager interactions;
|
||||
Terminator_Manager terminators;
|
||||
|
||||
Population_Logger_Manager pop_loggers;
|
||||
Population_Load_Saver pop_load_saver;
|
||||
|
||||
long int ID_offset;
|
||||
long int ID_counter = 0;
|
||||
long int local_decays = 0;
|
||||
long int global_decays = 0;
|
||||
|
||||
public:
|
||||
Particle_Looper() {};
|
||||
void init(long int seed, long int ID_offset, std::string output_path) {
|
||||
rngUni.seed(seed);
|
||||
rngNormal.seed(seed);
|
||||
this->ID_offset = ID_offset;
|
||||
h5f = H5_File(output_path);
|
||||
init_managers();
|
||||
//pop_load_saver.load();
|
||||
}
|
||||
~Particle_Looper() {
|
||||
//pop_load_saver.save();
|
||||
}
|
||||
private:
|
||||
void init_managers();
|
||||
|
||||
public:
|
||||
void do_loops(int target_decays);
|
||||
private:
|
||||
void process_first(std::queue<Particle> *particle_queue);
|
||||
long int get_new_id();
|
||||
|
||||
public:
|
||||
long int get_number_total_particles() {
|
||||
return ID_counter;
|
||||
}
|
||||
|
||||
void set_global_decays(long int global_decays) {
|
||||
this->global_decays = global_decays;
|
||||
}
|
||||
|
||||
Population_Manager *get_populations() {
|
||||
return &populations;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* particle_looper_hpp */
|
||||
Reference in New Issue
Block a user