Added in testing
This commit is contained in:
+2
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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)); }
|
||||
Reference in New Issue
Block a user