reduction of std::pow calls; stronger usage of
Cartesian- and CylinderCoordinate objects
This commit is contained in:
@@ -24,7 +24,8 @@ Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const double time_birth,
|
||||
const double weight)
|
||||
: specie_(specie),
|
||||
position_(position),
|
||||
position_cart_(position),
|
||||
position_cyl_(position),
|
||||
velocity_(velocity, position),
|
||||
id_(this->last_id_),
|
||||
time_alive_s_(time_birth),
|
||||
@@ -63,15 +64,21 @@ species::TrackedSpecie* Particle::specie() const {
|
||||
}
|
||||
|
||||
void Particle::position(const Coordinate& new_position) {
|
||||
position_ = CartesianCoordinate(new_position);
|
||||
position_cart_ = CartesianCoordinate(new_position);
|
||||
position_cyl_ = CylinderCoordinate(new_position);
|
||||
}
|
||||
|
||||
CartesianCoordinate Particle::position() const {
|
||||
return position_;
|
||||
CartesianCoordinate Particle::cartesianPosition() const {
|
||||
return position_cart_;
|
||||
}
|
||||
|
||||
CylinderCoordinate Particle::cylinderPosition() const {
|
||||
return position_cyl_;
|
||||
}
|
||||
|
||||
void Particle::move(const Coordinate& distance) {
|
||||
position_.add(distance);
|
||||
position_cart_.add(distance);
|
||||
position_cyl_ = CylinderCoordinate(position_cart_);
|
||||
}
|
||||
|
||||
double Particle::kineticEnergy_eV() const {
|
||||
|
||||
Reference in New Issue
Block a user