82 lines
2.0 KiB
C++
Executable File
82 lines
2.0 KiB
C++
Executable File
#ifndef PARTICLE_H
|
|
#define PARTICLE_H
|
|
|
|
#include "blitz/array.h"
|
|
#include "simulation/coordinates.h"
|
|
#include "simulation/species.h"
|
|
|
|
namespace particle {
|
|
|
|
class Particle {
|
|
public:
|
|
// Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
|
// Coordinate* position,
|
|
// Vector* velocity);
|
|
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
|
const Coordinate& position,
|
|
const Vector& velocity,
|
|
const double time_birth,
|
|
const double weight);
|
|
|
|
void position(const Coordinate& new_position);
|
|
CartesianCoordinate cartesianPosition() const;
|
|
CylinderCoordinate cylinderPosition() const;
|
|
|
|
void velocity(const CartesianVector& new_velocity);
|
|
CartesianVector velocity() const;
|
|
|
|
void move(const Coordinate& distance);
|
|
|
|
double kineticEnergy_eV() const;
|
|
double absoluteVelocity() const;
|
|
double absoluteVelocitySquared() const;
|
|
|
|
double mass_kg() const;
|
|
double charge_C() const;
|
|
|
|
species::TrackedSpecie* specie() const;
|
|
|
|
static void lastId(long int id);
|
|
static long int lastId(); // only local on this cpu
|
|
|
|
void increaseInteractionCounter();
|
|
long int interactionCounter() const;
|
|
|
|
void increaseTimeAlive(double time_s);
|
|
double timeAlive() const;
|
|
|
|
long int ID() const;
|
|
|
|
double weight() const;
|
|
|
|
void indexNextInteration(const int index) { index_next_interaction_ = index; };
|
|
int indexNextInteraction() { return index_next_interaction_; };
|
|
|
|
void deposited();
|
|
bool wasDeposited();
|
|
|
|
private:
|
|
double weight_;
|
|
bool deposited_ = false;
|
|
|
|
CartesianVector velocity_;
|
|
CartesianCoordinate position_cart_;
|
|
CylinderCoordinate position_cyl_;
|
|
|
|
double time_alive_s_;
|
|
// double time_in_bin_s_;
|
|
long int interaction_counter_;
|
|
|
|
// index of the interaction with the sortest distance (-1 if that's none of them)
|
|
int index_next_interaction_ = -1;
|
|
|
|
std::shared_ptr<species::TrackedSpecie> specie_;
|
|
long int id_;
|
|
|
|
static long int last_id_; // only local on this cpu
|
|
};
|
|
|
|
}; // namespace particle
|
|
|
|
#endif /* PARTICLE_H */
|