-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
32 lines (28 loc) · 801 Bytes
/
test.cpp
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
//struct rhs_van {
// Doub eps;
// rhs_van(Doub epss) : eps(epss) {}
// void operator() (const Doub x, VecDoub_I &y, VecDoub_O &dydx) {
// dydx[0] = y[1];
// dydx[1] = ((1.0 - y[0]*y[0])*y[1]-y[0])/eps;
// }
//};
int test() {
const Int nvar {2};
const Doub atol {1.0e-3};
const Doub rtol {atol};
const Doub h1{0.01};
const Doub hmin {0.0};
const Doub x1{0.0};
const Doub x2{-2.0};
VecDoub ystart(nvar);
ystart[0]=2.0;
ystart[1]=0.0;
Output out(100);
rhs_van d(1.0e-3);
Odeint<StepperDopr5<rhs_van> > ode(ystart,x1,x2,atol,rtol,h1,hmin,out,d);
ode.integrate();
for (Int i=0;i<out.count;i++)
cout << out.xsave[i] << " " << out.ysave[0][i]
<< " " << out.ysave[1][i] << endl;
return 0;
}