odeint c ++ do_step openmp

时间:2017-09-06 12:36:25

标签: c++ openmp odeint

我正在尝试使用解决我的ode系统并使用openmp。当我尝试使用stepper.do_step:

typedef runge_kutta_dopri5< state_type , double , state_type , double , openmp_range_algebra > stepper;

我将state_type定义为std :: vector

我编译得到:

   error: expected unqualified-id before '.' token stepper.do_step(c , Y , t, dt );

这是我的typedef问题还是我不​​能将do_step与openmp一起使用?

#include <boost/numeric/odeint.hpp>
#include<omp.h>
#include <boost/numeric/odeint/external/openmp/openmp.hpp>

typedef std::vector< double > state_type;

struct T
 {
   double m_param1;
   double m_param2;
 };

 class sys
 {
   struct T T1;
 public:
   sys(struct T G) : T1(G) {}
   void operator() ( state_type const& Y , state_type& dY , double t )
    {
    const size_t N = Y.size();

    #pragma omp parallel for schedule(runtime)
    for (size_t aux = 0; aux <= N; aux++) {
        mdlfnt(Y,dY,t,T1.m_currents,T1.m_stim); //Here is my ode system
    }
  }
};

struct T T2;

state_type Y(45); // initial conditions

void main()
 {
typedef runge_kutta_dopri5< state_type , double , state_type , double , openmp_range_algebra , default_operations , never_resizer > stepper;


int number_threads = 1;
omp_set_num_threads(number_threads);
int chunk_size = omp_get_max_threads();
omp_set_schedule( omp_sched_static , chunk_size );


for(int i=0;i<nd;i++){
        sys c(T2);
        stepperdo_step(c , Y , t, dt );

     }

  }

0 个答案:

没有答案