Files
karl/include/simulation/particle.h
T
csendlinger d6578e540d reduction of std::pow calls; stronger usage of
Cartesian- and CylinderCoordinate objects
2025-06-02 11:09:57 +02:00

78 lines
1.9 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_; };
private:
double weight_;
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 */