1 #ifndef VTESTBED_CORE_EULER_HH 2 #define VTESTBED_CORE_EULER_HH 6 #include <vtestbed/base/blitz.hh> 29 bool _verbose =
false;
40 template <
class Function,
int N>
41 inline blitz::TinyVector<T,N>
42 solve(Function f, T t0, T t1,
const blitz::TinyVector<T,N>& x0) {
43 using vec = blitz::TinyVector<T,N>;
45 bool finished =
false;
46 const T h_min = this->_minstep;
53 << std::setw(8) <<
"euler" 54 << std::setw(12) << t_n
56 << std::setw(10) << x_n
59 if (t_n+h+h_min > t1) {
68 << std::setw(8) <<
"euler" 69 << std::setw(12) << t_n
71 << std::setw(10) << x_n
78 template <
class Function,
int N>
79 inline blitz::TinyVector<T,N>
80 operator()(Function f, T t0, T t1,
const blitz::TinyVector<T,N>& x0) {
81 return this->solve<Function,N>(f, t0, t1, x0);
100 inline T min_step()
const {
return this->_minstep; }
101 inline T step()
const {
return this->_step; }
102 inline void verbose(
bool rhs) { this->_verbose = rhs; }
103 inline bool verbose()
const {
return this->_verbose; }
112 #endif // vim:filetype=cpp blitz::TinyVector< T, N > operator()(Function f, T t0, T t1, const blitz::TinyVector< T, N > &x0)
Euler initial value problem solver.