-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_exp.cpp
More file actions
42 lines (33 loc) · 846 Bytes
/
Copy pathdemo_exp.cpp
File metadata and controls
42 lines (33 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "bla/bla.hpp"
using namespace ngbla;
#include "ode.hpp"
#include "RK_orig.hpp"
#include <math.h>
class E_ODE_Function : public ODE_Function
{
public:
E_ODE_Function() { }
virtual void Eval(double t, const Vector<> & y, Vector<> & f) const
{
f(0) = y(0);
}
};
int main()
{
ExplicitEuler expl_euler;
ImplMP impl_MP;
Gauss2 gauss2;
double h = 0.2;
double t0 = 0.;
double T = 2;
int stepsave = 1;
ofstream out_implMP("EFunc_implMP.txt");
ofstream out_explEV("EFunc_explEV.txt");
ofstream out_gauss2("EFunc_gauss2.txt");
E_ODE_Function efunc;
Vector<> y0 = { 1. };
ODESolver(efunc, impl_MP, t0, y0, T, h, out_implMP, stepsave);
ODESolver(efunc, expl_euler, t0, y0, T, h, out_explEV, stepsave);
ODESolver(efunc, gauss2, t0, y0, T, h, out_gauss2, stepsave);
return 0;
}