Skip to content

Commit

Permalink
Add gravity namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
200km committed Jul 20, 2024
1 parent f4866fe commit aba36b1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/disturbances/geopotential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Geopotential::Geopotential(const int degree, const std::string file_path, const
}
}
// Initialize GravityPotential
geopotential_ = GravityPotential(degree, c_, s_);
geopotential_ = gravity::GravityPotential(degree, c_, s_);
}

bool Geopotential::ReadCoefficientsEgm96(std::string file_name) {
Expand Down
2 changes: 1 addition & 1 deletion src/disturbances/geopotential.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Geopotential : public Disturbance {
virtual std::string GetLogValue() const;

private:
GravityPotential geopotential_;
gravity::GravityPotential geopotential_;
size_t degree_; //!< Maximum degree setting to calculate the geo-potential
std::vector<std::vector<double>> c_; //!< Cosine coefficients
std::vector<std::vector<double>> s_; //!< Sine coefficients
Expand Down
2 changes: 1 addition & 1 deletion src/disturbances/lunar_gravity_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ LunarGravityField::LunarGravityField(const int degree, const std::string file_pa
}
}
// Initialize GravityPotential
lunar_potential_ = GravityPotential(degree, c_, s_, gravity_constants_km3_s2_ * 1e9, reference_radius_km_ * 1e3);
lunar_potential_ = gravity::GravityPotential(degree, c_, s_, gravity_constants_km3_s2_ * 1e9, reference_radius_km_ * 1e3);
}

bool LunarGravityField::ReadCoefficientsGrgm1200a(std::string file_name) {
Expand Down
2 changes: 1 addition & 1 deletion src/disturbances/lunar_gravity_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LunarGravityField : public Disturbance {
virtual std::string GetLogValue() const;

private:
GravityPotential lunar_potential_;
gravity::GravityPotential lunar_potential_;
double reference_radius_km_;
double gravity_constants_km3_s2_;
size_t degree_; //!< Maximum degree setting to calculate the geo-potential
Expand Down
4 changes: 4 additions & 0 deletions src/math_physics/gravity/gravity_potential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <fstream>
#include <iostream>

namespace gravity {

GravityPotential::GravityPotential(const size_t degree, const std::vector<std::vector<double>> cosine_coefficients,
const std::vector<std::vector<double>> sine_coefficients, const double gravity_constants_m3_s2,
const double center_body_radius_m)
Expand Down Expand Up @@ -275,3 +277,5 @@ void GravityPotential::v_w_nm_update(double *v_nm, double *w_nm, const double v_
*w_nm = c_normalize * (c1 * z_tmp * w_prev - c2 * c2_normalize * re_tmp * w_prev2);
return;
}

} // namespace gravity
4 changes: 4 additions & 0 deletions src/math_physics/gravity/gravity_potential.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "../math/matrix.hpp"
#include "../math/vector.hpp"

namespace gravity {

/**
* @class GravityPotential
* @brief Class to calculate gravity potential
Expand Down Expand Up @@ -83,4 +85,6 @@ class GravityPotential {
void v_w_nm_update(double *v_nm, double *w_nm, const double v_prev, const double w_prev, const double v_prev2, const double w_prev2);
};

} // namespace gravity

#endif // S2E_LIBRARY_GRAVITY_GRAVITY_POTENTIAL_HPP_
2 changes: 2 additions & 0 deletions src/math_physics/gravity/test_gravity_potential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "gravity_potential.hpp"

using namespace gravity;

/**
* @brief Test for Acceleration calculation
*/
Expand Down

0 comments on commit aba36b1

Please sign in to comment.