Added in testing

This commit is contained in:
Thomas Faour
2025-06-02 21:29:10 -04:00
parent 7dd2b88b8a
commit b10bc5b5da
7 changed files with 226 additions and 6 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ Body::Body(const Position& X, const Velocity& V, const Mass& m, const std::strin
A = Acceleration{Decimal(0), Decimal(0), Decimal(0)};
}
void addAcceleration(const Acceleration& new_A) {
for (auto& [new_a, cur_a]: std::views::zip(new_A, this->A)){
void Body::addAcceleration(const Acceleration& new_A) {
for (const auto& [new_a, cur_a]: std::views::zip(new_A, this->A)){
cur_a += new_a;
}
}
+7
View File
@@ -22,6 +22,13 @@ public:
// Run simulation
void run(int steps);
// Getters
const std::vector<Body>& getBodies() const { return bodies; }
Decimal getStepSize() const { return step_size; }
int getStepsPerSave() const { return steps_per_save; }
const std::filesystem::path& getOutputFile() const { return output_file; }
int getCurrentStep() const { return current_step; }
private:
void calculate_forces();
void move_bodies();
+3 -1
View File
@@ -41,4 +41,6 @@ inline Decimal real_mass(Decimal mass) { return mass * m_0; }
inline Decimal norm_time(Decimal time) { return time / t_0; }
inline Decimal real_time(Decimal time) { return time * t_0; }
inline Decimal norm_vel(Decimal vel) { return vel / (r_0/t_0); }
inline Decimal real_vel(Decimal vel) { return vel * (r_0/t_0); }
inline Decimal real_vel(Decimal vel) { return vel * (r_0/t_0); }
inline Decimal norm_acc(Decimal acc) { return acc / (r_0/(t_0*t_0)); }
inline Decimal real_acc(Decimal acc) { return acc * (r_0/(t_0*t_0)); }