#ifndef SIMULATION_H #define SIMULATION_H #include #include #include #include "simulation/parameter.h" #include "simulation/particle.h" class RandomNumbers; class InteractionOutput; class MagneticField; class ElectricField; class GravityField; class Timer; class Injector; class SimulationOutput; class CpuSynchronizer; class PoissonSolver; namespace species { class Specie; }; namespace interaction { class InteractionOutput; }; class Simulation { public: Simulation(std::string parameter_filename); void init(Parameter& parameter); void start(); void finalize(); // cpu_syncs only included for debug purposes, e.g. only drawing decay particles // at the 0th timestep void processEvents(int events, const double beta_particle_weight); void processDensityEvents(int particles_per_bin, const double weight_factor); void processUntilTermination(particle::Particle& particle); private: std::vector determineInjectedParticles(RandomNumbers* random, const double beta_particle_weight); std::vector determineInjectedDensityParticles( RandomNumbers* random, const double weight_factor, const int current, std::map& particleNumbers, bool& all_bins_done); double meanFreePath(particle::Particle& particle, RandomNumbers* random, std::vector& macroscopic_cross_sections_m); // draw the individual collision times of the possible interactions and return the // minimum of them. Also sets the "nextInteractionIndex" in the particle to the // interaction of the chosen time. double collisionTime(particle::Particle& particle, RandomNumbers* random); interaction::InteractionOutput interact(particle::Particle& particle, RandomNumbers* random); interaction::InteractionOutput interact(particle::Particle& particle, RandomNumbers* random, std::vector& macroscopic_cross_sections_m); blitz::Array chargedensity(); std::map> tracked_species_; std::map> background_species_; std::shared_ptr injector_; std::shared_ptr magnetic_field_; std::shared_ptr electric_field_; std::shared_ptr gravity_field_; std::shared_ptr poisson_solver_; Parameter parameter_; std::shared_ptr random_; std::shared_ptr timer_; std::shared_ptr output_; std::shared_ptr cpu_synchronizer_; std::vector queue_; std::vector storage_queue_[2]; int active_storage = 0; int inactive_storage = 1; int timestep = 0; int injectionGroupOffset = 0; }; #endif /* SIMULATION_H */