39 time_step = cfg.
require(
"time_step", 0.0);
50 template<
class T,
class Gravitation>
53 const static int nbod = T::n;
59 ensemble::SystemRef&
sys;
60 Gravitation& calcForces;
64 bool body_component_grid;
65 bool first_thread_in_system;
71 :_params(p),
sys(s),calcForces(calc){}
73 GPUAPI
void init() { }
75 GPUAPI
void shutdown() { }
77 GPUAPI
void convert_internal_to_std_coord() {}
78 GPUAPI
void convert_std_to_internal_coord() {}
80 static GENERIC int thread_per_system(){
84 static GENERIC int shmem_per_system() {
88 __device__
bool is_in_body_component_grid()
90 {
return ((b < nbod) && (c < 3)); }
92 __device__
bool is_in_body_component_grid_no_star()
94 {
return ( (b!=0) && (b < nbod) && (c < 3) ); }
96 __device__
bool is_first_thread_in_system()
102 double h = min(_params.time_step, max_timestep);
103 double pos = 0.0, vel = 0.0;
104 double acc = 0.0, jerk = 0.0;
105 const double third = 1.0/3.0;
107 if( is_in_body_component_grid() )
108 pos =
sys[b][c].pos() , vel =
sys[b][c].vel();
111 calcForces(ij,b,c,pos,vel,acc,jerk);
113 pos = pos + h*(vel+(h*0.5)*(acc+(h*third)*jerk));
114 vel = vel + h*(acc+(h*0.5)*jerk);
118 if( is_in_body_component_grid() )
119 sys[b][c].pos() = pos ,
sys[b][c].vel() = vel;
120 if( is_first_thread_in_system() )