the timestep; Bug with density drawing present (if CPU syncs don't line up with the timestep)
85 lines
2.4 KiB
C++
Executable File
85 lines
2.4 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,
|
|
const double beta_particle_weight);
|
|
void processUntilTermination(particle::Particle& particle);
|
|
|
|
private:
|
|
std::vector<particle::Particle> determineInjectedParticles(RandomNumbers* random,
|
|
const double beta_particle_weight);
|
|
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 */
|