27 namespace swarm {
namespace gpu {
namespace bppt {
37 time_step = cfg.
require(
"time_step", 0.0);
52 template<
class T,
class Gravitation>
55 const static int nbod = T::n;
61 ensemble::SystemRef&
sys;
62 Gravitation& calcForces;
73 :_params(p),
sys(s),calcForces(calc){}
76 static GENERIC int thread_per_system(){
80 static GENERIC int shmem_per_system() {
84 GPUAPI
void init() { }
86 GPUAPI
void shutdown() { }
93 __device__
bool is_in_body_component_grid()
95 {
return ((b < T::n) && (c < 3)); }
97 __device__
bool is_in_body_component_grid_no_star()
99 {
return ( (b!=0) && (b < T::n) && (c < 3) ); }
101 __device__
bool is_first_thread_in_system()
107 double H = min( max_timestep , _params.time_step );
108 double pos = 0, vel = 0;
110 if( is_in_body_component_grid() )
111 pos =
sys[b][c].pos() , vel =
sys[b][c].vel();
120 double p_i , p_im1, p_im2;
121 double v_i, v_im1, v_im2;
132 a_im1 = calcForces.acc(ij,b,c,p_im1,v_im1);
134 p_i = p_im1 + h * v_im1;
135 v_i = v_im1 + h * a_im1;
138 for(
int i = 2; i <= n; i++){
144 a_im1 = calcForces.acc(ij,b,c,p_im1,v_im1);
146 p_i = p_im2 + 2.0 * h * v_im1;
147 v_i = v_im2 + 2.0 * h * a_im1;
149 double a_i = calcForces.acc(ij,b,c,p_i,v_i);
151 pos = 0.5 * ( p_i + p_im1 + h * v_i );
152 vel = 0.5 * ( v_i + v_im1 + h * a_i );
156 if( is_in_body_component_grid() )
157 sys[b][c].pos() = pos ,
sys[b][c].vel() = vel;
158 if( is_first_thread_in_system() )