From fcd5af073a0e1451c295cac998f69764f8aceb1c Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Mon, 31 Aug 2020 21:21:55 -0300 Subject: [PATCH] Remove specific code from the general RK --- src/RungeKuttaSolver.cpp | 7 +------ src/RungeKuttaSolver.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/RungeKuttaSolver.cpp b/src/RungeKuttaSolver.cpp index 37f3756..aad1dbc 100644 --- a/src/RungeKuttaSolver.cpp +++ b/src/RungeKuttaSolver.cpp @@ -2,7 +2,7 @@ #include "GravitationalEntity.h" template -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; @@ -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; diff --git a/src/RungeKuttaSolver.h b/src/RungeKuttaSolver.h index 3923237..c2cb85e 100644 --- a/src/RungeKuttaSolver.h +++ b/src/RungeKuttaSolver.h @@ -11,6 +11,6 @@ class RungeKuttaSolver static State3d RungeKutta4Solverf(const float& step, const int& nSteps, const State3d& initial, const GravitationalEntity& caller); template - 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&)); };