54 lines
1.5 KiB
C++
Executable File
54 lines
1.5 KiB
C++
Executable File
#ifndef INTERACTION_H
|
|
#define INTERACTION_H
|
|
|
|
#include "simulation/particle.h"
|
|
#include "simulation/random_numbers.h"
|
|
#include "simulation/species.h"
|
|
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace interaction {
|
|
|
|
class InteractionOutput {
|
|
public:
|
|
InteractionOutput();
|
|
|
|
void deleteCurrentParticle(bool new_decider);
|
|
bool deleteCurrentParticle();
|
|
void add(const particle::Particle& new_particle);
|
|
std::vector<particle::Particle> newParticles();
|
|
|
|
private:
|
|
bool delete_current_particle_;
|
|
std::vector<particle::Particle> new_particles_;
|
|
};
|
|
|
|
class Interaction {
|
|
public:
|
|
Interaction(std::function<double(double)> cross_section,
|
|
std::shared_ptr<species::Specie> target);
|
|
|
|
virtual double microscopicCrossSection(double energy_eV, const Coordinate& position);
|
|
virtual double macroscopicCrossSection(particle::Particle& particle);
|
|
|
|
// return the time the given particle can travel in the laboratory frame
|
|
// before this specific interaction occurs (also stores the velocity of the
|
|
// target particle)
|
|
virtual double drawCollisionTime(particle::Particle& particle,
|
|
RandomNumbers* generator);
|
|
|
|
virtual InteractionOutput performInteraction(particle::Particle& particle,
|
|
RandomNumbers* generator) = 0;
|
|
|
|
protected:
|
|
std::function<double(double)> cross_section_;
|
|
std::shared_ptr<species::Specie> target_;
|
|
CartesianVector target_velocity_;
|
|
};
|
|
|
|
}; // namespace interaction
|
|
|
|
#endif /* INTERACTION_H */
|