Skip to content

Commit

Permalink
Remove specific code from the general RK
Browse files Browse the repository at this point in the history
  • Loading branch information
vitor-k committed Nov 27, 2024
1 parent 4faf100 commit fcd5af0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/RungeKuttaSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "GravitationalEntity.h"

template <typename T, class C>
T RungeKuttaSolver::RungeKutta4Solver(const float& step, const int& nSteps, T initial, C& caller, T(C::* f)(float, T)) {
T RungeKuttaSolver::RungeKutta4Solver(const float& step, const int& nSteps, const T& initial, const C& caller, T(C::* f)(const float&, const T&)) {
T current = initial;
T next = initial;
T k1, k2, k3, k4;
Expand All @@ -16,11 +16,6 @@ T RungeKuttaSolver::RungeKutta4Solver(const float& step, const int& nSteps, T in
k4 = step * (caller.*f)(t + step, current + k3);
next = current + (k1 + 2 * k2 + 2 * k3 + k4) / 6;

next.v.normalize();

if ((next.s).norm() < 1.5) { return next; }
if ((next.s).norm() > caller.relativeOuterRadius) { return next; }

t += step;
}
return next;
Expand Down
2 changes: 1 addition & 1 deletion src/RungeKuttaSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class RungeKuttaSolver
static State3d RungeKutta4Solverf(const float& step, const int& nSteps, const State3d& initial, const GravitationalEntity& caller);

template <typename T, class C>
static T RungeKutta4Solver(const float& step, const int& nSteps, T initial, C& caller, T (C::*f)(float, T));
static T RungeKutta4Solver(const float& step, const int& nSteps, const T& initial, const C& caller, T (C::*f)(const float&, const T&));

};

0 comments on commit fcd5af0

Please sign in to comment.