#ifndef INJECTOR_H #define INJECTOR_H #include #include #include #include #include "simulation/coordinates.h" class DriftVelocity; class VelocityDistribution; class DynamicDensityField; class MagneticField; namespace particle { class Particle; } namespace species { class Specie; class TrackedSpecie; } // namespace species class EventPositionDistribution; struct InjectorInfo { public: std::shared_ptr created_specie; std::shared_ptr creation_velocity_distribution; double weight = 0; int injection_group; int injection_stride; }; class Injector { public: Injector(std::vector& injector_info, double activity, std::shared_ptr position_distribution, std::shared_ptr mother_drift_velocity); std::vector rollNewParticles(std::mt19937* engine, const int timestep); // physical_number: physical number of particles that are injected in one // timestep // numerical_number: number of numerical beta particles to be injected on // a single process void setWeights(const double physical_number, const int numerical_number); // draw new particles from the DynamicDensityField of the provided specie, // the new particles are then appened to the vector 'queue' // the magnetic field is necessary for the determination of the direction of the // injected particles // the weight_factor scales the time a particle contributes to a certain bin // and the injection time specifies the time the particle is injected (has to be // between T, T+\DeltaT) void drawNewParticleFromDensityField(std::mt19937* engine, std::shared_ptr specie, std::vector& queue, std::shared_ptr field, const double weight_factor); void initInjectionTimeDistribution(double delta_t); double timePassed() const; private: std::vector injector_infos_; const double activity_; std::shared_ptr position_distribution_; std::shared_ptr mother_drift_velocity_; std::uniform_real_distribution injection_time_distribution_; particle::Particle rollNewParticle( std::mt19937* engine, const Coordinate& position, std::shared_ptr created_specie, std::shared_ptr creation_velocity_distribution, const double time_birth, const double weight); }; #endif /* INJECTOR_H */