28 namespace swarm {
namespace gpu {
namespace bppt {
34 template<
class Monitor ,
template<
class T>
class Gravitation >
37 typedef Monitor monitor_t;
38 typedef typename monitor_t::params mon_params_t;
41 mon_params_t _mon_params;
45 _time_step = cfg.
require(
"time_step", 0.0);
58 __device__
void kernel(T compile_time_param){
62 typedef Gravitation<T> Grav;
64 typedef typename Grav::shared_data grav_t;
68 const int nbod = T::n;
75 monitor_t montest(_mon_params,sys,*
_log) ;
79 double pos = 0.0, vel = 0.0 , acc0 = 0.0, jerk0 = 0.0;
80 if( (b < nbod) && (c < 3) )
81 { pos = sys[b][
c].pos(); vel = sys[b][
c].vel(); }
93 for(
int iter = 0 ; (iter <
_max_iterations) && sys.is_active() ; iter ++ )
95 double h = _time_step;
107 pos = pos + h*(vel+(h*0.5)*(acc0+(h/3.0)*jerk0));
108 vel = vel + h*(acc0+(h*0.5)*jerk0);
110 double pre_pos = pos, pre_vel = vel;
119 pos = pre_pos + (0.1-0.25) * (acc0 - acc1) * h * h - 1.0/60.0 * ( 7.0 * jerk0 + 2.0 * jerk1 ) * h * h * h;
120 vel = pre_vel + ( -0.5 ) * (acc0 - acc1 ) * h - 1.0/12.0 * ( 5.0 * jerk0 + jerk1 ) * h * h;
122 pos = pre_pos + ( (0.1-0.25) * (acc0 - acc1) - 1.0/60.0 * ( 7.0 * jerk0 + 2.0 * jerk1 ) * h) * h * h;
123 vel = pre_vel + (( -0.5 ) * (acc0 - acc1 ) - 1.0/12.0 * ( 5.0 * jerk0 + jerk1 ) * h )* h ;
132 pos = pre_pos + (0.1-0.25) * (acc0 - acc1) * h * h - 1.0/60.0 * ( 7.0 * jerk0 + 2.0 * jerk1 ) * h * h * h;
133 vel = pre_vel + ( -0.5 ) * (acc0 - acc1 ) * h - 1.0/12.0 * ( 5.0 * jerk0 + jerk1 ) * h * h;
135 pos = pre_pos + ((0.1-0.25) * (acc0 - acc1) - 1.0/60.0 * ( 7.0 * jerk0 + 2.0 * jerk1 ) * h )* h * h ;
136 vel = pre_vel + (( -0.5 ) * (acc0 - acc1 ) - 1.0/12.0 * ( 5.0 * jerk0 + jerk1 ) * h ) * h ;
139 acc0 = acc1, jerk0 = jerk1;
142 if( (b < nbod) && (c < 3) )
143 { sys[b][
c].pos() = pos; sys[b][
c].vel() = vel; }
151 { sys.set_inactive(); }