*******************************************************************************/
-#ifndef _MOOF_PHYSICS_HH_
-#define _MOOF_PHYSICS_HH_
+#ifndef _MOOF_RK4_HH_
+#define _MOOF_RK4_HH_
#include <Moof/Math.hh>
namespace Mf {
// Generic implementation of the RK4 integrator. To use, you need one type
-// representing the state and another containing the derivatives of the state.
+// representing the state and another containing the derivatives of the primary
+// state variables. The state class must implement these methods:
+//
+// void getDerivative(Derivative_Type& derivative, Scalar absoluteTime);
+// void applyDerivative(const Derivative_Type& derivative, Scalar deltaTime);
+//
+// Additionally, the derivative class must overload a few operators:
+//
+// Derivative_Type operator+(const Derivative_Type& other) const
+// Derivative_Type operator*(const Derivative_Type& other) const
template<typename S, typename D>
inline D evaluate(const S& state, Scalar t)
D c = evaluate<S,D>(state, t, dt * 0.5, b);
D d = evaluate<S,D>(state, t, dt, c);
- //state += (a + (b + c) * 2.0 + d) * (1.0/6.0) * dt;
state.applyDerivative((a + (b + c) * 2.0 + d) * (1.0/6.0), dt);
}
} // namespace Mf
-#endif // _MOOF_PHYSICS_HH_
+#endif // _MOOF_RK4_HH_
/** vim: set ts=4 sw=4 tw=80: *************************************************/