39 lines
1.5 KiB
C++
Executable File
39 lines
1.5 KiB
C++
Executable File
#ifndef TERMINATOR_H
|
|
#define TERMINATOR_H
|
|
|
|
#include "simulation/particle.h"
|
|
|
|
// defined in "simulation/geometry.h"
|
|
class Geometry;
|
|
|
|
// class for checking if a paricle has to be terminated due to
|
|
// any reason except interaction effects
|
|
class Terminator {
|
|
public:
|
|
// Constructor: takes the maximum number of interactions a particle is allowed to perform
|
|
// the maximum amount of time a paticle is allowed to live
|
|
// a Geometry object defining the boundaries of the volume particles are allowed to exist in
|
|
Terminator(long int max_interactions,
|
|
double max_time_alive,
|
|
std::shared_ptr<Geometry> geometry);
|
|
|
|
// check if particle has not reached the maximum interaction count, the maximal time its allowed to live
|
|
// and that it has not reached a geometry boundary
|
|
bool isAlive(const particle::Particle* particle) const;
|
|
// check if particle has crossed any boundary of the Geometry
|
|
bool leftSimulationDomain(const particle::Particle* particle) const;
|
|
// check if particle has reached the maximum interaction count
|
|
bool reachedMaxInteractions(const particle::Particle* particle) const;
|
|
// check if the particle has reached its maximum lifetime
|
|
bool reachedMaxTimeAlive(const particle::Particle* particle) const;
|
|
// return the maximum lifetime
|
|
double maxTimeAlive() const;
|
|
|
|
private:
|
|
const long int max_interactions_;
|
|
const double max_time_alive_;
|
|
std::shared_ptr<Geometry> geometry_;
|
|
};
|
|
|
|
#endif /* TERMINATOR_H */
|