15 #include <boost/numeric/odeint/integrate/integrate_adaptive.hpp> 28 extern "C" void intDriver(
const int,
const double,
const double,
const double*,
double*);
30 #ifdef STIFFNESS_MEASURE 31 extern std::vector<double> max_stepsize;
32 controlled_step_result test_step(
int index,
const state_type& y,
const double t,
state_type& y_out,
const double dt)
57 void intDriver (
const int NUM,
const double t,
const double t_end,
58 const double *pr_global,
double *y_global)
60 #ifdef STIFFNESS_MEASURE 62 max_stepsize.resize(NUM, 0.0);
66 #ifdef STIFFNESS_MEASURE 67 #pragma omp parallel for shared(state_vectors, evaluators, controllers, max_stepsize) private(tid) 69 #pragma omp parallel for shared(state_vectors, evaluators, controllers) private(tid) 71 for (tid = 0; tid < NUM; ++tid) {
72 int index = omp_get_thread_num();
76 evaluators[index]->set_state_var(pr_global[tid]);
79 for (
int i = 0; i <
NSP; i++)
81 vec[i] = y_global[tid + i * NUM];
84 #ifndef STIFFNESS_MEASURE 91 double left_size = 1.0;
92 while (test_step(index, vec, t, y_copy, left_size) == success)
96 double right_size = 1e-20;
97 while (test_step(index, vec, t, y_copy, right_size) == fail)
103 while (delta > tol) {
104 mid = (left_size + right_size) / 2.0;
105 controlled_step_result result = test_step(index, vec, t, y_copy, mid);
106 if (result == fail) {
108 delta = fabs(left_size - mid) / left_size;
112 delta = fabs(right_size - mid) / right_size;
116 max_stepsize[tid] = mid;
120 for (
int i = 0; i <
NSP; i++)
122 y_global[tid + i * NUM] = vec[i];
std::vector< controller > controllers
ODE controllers.
std::vector< state_type * > state_vectors
State vector containers for boost.
std::vector< rhs_eval * > evaluators
RHS wrappers for boost.
std::vector< double > state_type
state vector
Contains skeleton of all methods that need to be defined on a per solver basis.
Defines an interface for boost's runge_kutta_fehlberg78 solver.
void intDriver(const int, const double, const double, const double *, double *)
Integration driver for the CPU integrators.