#ifndef INTERACTION_H #define INTERACTION_H #include "simulation/particle.h" #include "simulation/random_numbers.h" #include "simulation/species.h" #include #include #include namespace interaction { // class to define the output of an interaction class InteractionOutput { public: // Constructor: incident particle is not flagged for deletion InteractionOutput(); // if new_decider is true then the incident particle of the interaction is // flagged for deletion void deleteCurrentParticle(bool new_decider); // return if the incident particle is flagged for deletion bool deleteCurrentParticle(); // add particles that are created (not the incident) particles to the InteractionOutput void add(const particle::Particle& new_particle); // return the vector of particles that have been created by an interactoin std::vector newParticles(); private: // flag if the incident particle should be deleted bool delete_current_particle_; // vector for the interaction products (no including the incident particle even if it's not // destroyed by the interaction) std::vector new_particles_; }; // parent class for all interactions (cannot be instantiated) class Interaction { public: // Constructor: takes a function describing the cross section of used for the interaction as a function of energy (in eV) // a shared_ptr to the Specie of the target species Interaction(std::function cross_section, std::shared_ptr target); // return the value of the cross section at the energy (in eV) energy_eV in m^2 // Coordinate position necessary for three body processes in which the // cross section depends on the density at the position (see "interactions/cluster_formation.h") virtual double microscopicCrossSection(double energy_eV, const Coordinate& position); // calculate the density scaled cross section for the Particle particle // interacting with the defined target Specie (returns cross section * target density) (units: m^-1) // assumes that v_particle >> v_target virtual double macroscopicCrossSection(particle::Particle& particle); // pure virtual function defining the specifics of the actual interaction virtual InteractionOutput performInteraction(particle::Particle& particle, RandomNumbers* generator) = 0; protected: std::function cross_section_; std::shared_ptr target_; }; }; // namespace interaction #endif /* INTERACTION_H */