Page MenuHomec4science

RungeKutta.h
No OneTemporary

File Metadata

Created
Fri, Oct 4, 05:28

RungeKutta.h

#ifndef ODELIBRARY_RUNGEKUTTA_H
#define ODELIBRARY_RUNGEKUTTA_H
#include "AbstractSolver.h"
/**
* The famous Runge Kutta solver. Solutions for 4 methods order are available. It will compute the 4th order udpate by
* default, a.k.a. the RK4 method.
*/
class RungeKutta : public AbstractSolver{
private:
//
int methodOrder;
public:
RungeKutta(double t0,double tf,int n,int order, Eigen::VectorXd& y0);
/**
* Default constructor sets the method order to 4.
*/
RungeKutta() : AbstractSolver() { methodOrder=4; };
/**
* Setter for the method order, will throw an exception if the order is invalid.
* @param n : method order, integer, can be 1, 2, 3 or 4
*/
void setMethodOrder(int n);
/// getter for the method order
int getMethodOrder();
/**
* Step method for runge Kutta, it will depend on the method order.
* @param y : Eigen vector, the current value of the equation
* @param t : double, the current time where the step must be performed
*/
void step(Eigen::VectorXd &y, double t) override ;
};
#endif //ODELIBRARY_RUNGEKUTTA_H

Event Timeline