reduction of calls to atan2, sin and cos

This commit is contained in:
2025-06-04 10:43:39 +02:00
parent 2439f4fca9
commit 532bdf7979
17 changed files with 94 additions and 33 deletions
+13
View File
@@ -41,6 +41,13 @@ class Coordinate {
// return the value of the stored coordinate transformed to Cylinder space
virtual blitz::TinyVector<double, 3> cylinderEntries() const = 0;
// return cos(phi) with phi the second variable of the coordinate in cylinder
// coordinates
virtual double cosAzimuth() const = 0;
// return cos(phi) with phi the second variable of the coordinate in cylinder
// coordinates
virtual double sinAzimuth() const = 0;
// add the values of the parameter coordinate to the value stored in this variable
virtual void add(const Coordinate& coordinate) = 0;
};
@@ -58,6 +65,9 @@ class CartesianCoordinate : public Coordinate {
// return the value of the stored coordinate transformed to Cylider space
blitz::TinyVector<double, 3> cylinderEntries() const;
double cosAzimuth() const;
double sinAzimuth() const;
// add the values of the parameter coordinate to the value stored in this variable
void add(const Coordinate& coordinate);
@@ -77,6 +87,9 @@ class CylinderCoordinate : public Coordinate {
// return the value of the stored coordinate transformed to Cylinder space
blitz::TinyVector<double, 3> cylinderEntries() const;
double cosAzimuth() const;
double sinAzimuth() const;
// add the values of the parameter coordinate to the value stored in this variable
void add(const Coordinate& coordinate);
+3
View File
@@ -14,6 +14,9 @@ class DriftVelocity {
// returns the drift velocity value at the Coordinate position as a CartesianVector
CartesianVector driftVelocity(const Coordinate& position);
// overload using both the cartesian and cylinder coordinate version of the position
CartesianVector driftVelocity(const CartesianCoordinate& cartpos,
const CylinderCoordinate& cylpos);
private:
std::shared_ptr<VectorField> drift_velocity_;
+4 -1
View File
@@ -19,8 +19,10 @@ class Particle {
// 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
// return the position of the particle as a CartesianCoordinate
CartesianCoordinate position() const;
// return the cylinder position of the particle
CylinderCoordinate cylinderPosition() const;
// set the velocity of the particle to the provided CartesianVector new_velocity
void velocity(const CartesianVector& new_velocity);
@@ -77,6 +79,7 @@ class Particle {
private:
CartesianVector velocity_;
CartesianCoordinate position_;
CylinderCoordinate position_cyl_;
double time_alive_s_;
double time_in_bin_s_;