#ifndef PARTICLE_H #define PARTICLE_H #include "blitz/array.h" #include "simulation/coordinates.h" #include "simulation/species.h" namespace particle { // class for the simulated particles class Particle { public: // Constructor: takes shared_ptr to the TrackedSpecies object that describes the particle // the Coordinate containing the position the particle should be created at // the Vector containing the velocity the particle should be created with Particle(std::shared_ptr specie, const Coordinate& position, const Vector& velocity); // set the position of the particle to the provided Coordinate new_position void position(const Coordinate& new_position); // return the position of the particle as a CartesianVector CartesianCoordinate position() const; // set the velocity of the particle to the provided CartesianVector new_velocity void velocity(const CartesianVector& new_velocity); // return the velocity of the particle as a CartesianVector CartesianVector velocity() const; // ads the Coordinate distance to the position of the particle // x_new = x_old + distance void move(const Coordinate& distance); // return the kinetic energy of the particle in eV double kineticEnergy_eV() const; // return the modulus of the particle velocity in m/s double absoluteVelocity() const; // return the squared modulus of the particle velocity in (m/s)^2 double absoluteVelocitySquared() const; // return the mass of the particle in kg (i.e. the mass of the particles specie) double mass_kg() const; // return the charge of the particle in C (i.e. the charge of the particles specie) double charge_C() const; // get a raw pointer to the TrackedSpecie object of the particle species::TrackedSpecie* specie() const; // set the static variable (only local to the mpi process) from which // the particle ids are generated static void lastId(long int id); // get the static variable (only local to the mpi process) from which // the particle ids are generated static long int lastId(); // increase member variable that counts the number of interactions performed // by the particle by 1 void increaseInteractionCounter(); // return the value of the number of interactions performed by the particle long int interactionCounter() const; // increase member variable counting the total time (in s) that the // particle has been alive void increaseTimeAlive(double time_s); // return the time the particle has been alive (in s) double timeAlive() const; // increase member variable counting the time the particle has bin alive // without chaingin any bin (i.e. spatial or energy) by the given time (in s). // equivalent to the time the particle has spent in its current bin void increaseTimeInBin(double time_s); // reset the time in bin variable (i.e. set to 0) void resetTimeInBin(); // return the time the particle has not changed any bin double timeInBin() const; private: CartesianVector velocity_; CartesianCoordinate position_; double time_alive_s_; double time_in_bin_s_; long int interaction_counter_; std::shared_ptr specie_; long int id_; static long int last_id_; // only local on this cpu }; }; // namespace particle #endif /* PARTICLE_H */