Files
karl/include/simulation/simulation.h
T
csendlinger b529021149 Some optimizations (mfp: vector instead of recalc,
reduced number of density recalculations);
Default gravity field of 0;
adjusted error output
2025-01-29 16:59:10 +01:00

83 lines
2.3 KiB
C++
Executable File

#ifndef SIMULATION_H
#define SIMULATION_H
#include <map>
#include <memory>
#include <vector>
#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, int density_events, int cpu_syncs);
void processUntilTermination(particle::Particle& particle);
private:
std::vector<particle::Particle> determineInjectedParticles(RandomNumbers* random);
std::vector<particle::Particle>
determineInjectedDensityParticles(RandomNumbers* random,
const int numberParticlesToDraw, const int current,
std::map<std::string, double>& particleNumbers);
double meanFreePath(particle::Particle& particle, RandomNumbers* random,
std::vector<double>& macroscopic_cross_sections_m);
interaction::InteractionOutput interact(particle::Particle& particle,
RandomNumbers* random,
std::vector<double>& macroscopic_cross_sections_m);
blitz::Array<double,3> chargedensity();
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
tracked_species_;
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
background_species_;
std::shared_ptr<Injector> injector_;
std::shared_ptr<MagneticField> magnetic_field_;
std::shared_ptr<ElectricField> electric_field_;
std::shared_ptr<GravityField> gravity_field_;
std::shared_ptr<PoissonSolver> poisson_solver_;
Parameter parameter_;
std::shared_ptr<RandomNumbers> random_;
std::shared_ptr<Timer> timer_;
std::shared_ptr<SimulationOutput> output_;
std::shared_ptr<CpuSynchronizer> cpu_synchronizer_;
std::vector<particle::Particle> queue_;
};
#endif /* SIMULATION_H */