Swarm-NG  1.1
swarm::gpu::bppt::GravitationAccJerk< T > Class Template Reference

templatized Class working as a function object to calculate acceleration and jerk in parallel. More...

#include <gravitation_accjerk.hpp>

Public Member Functions

GENERIC GravitationAccJerk (ensemble::SystemRef &sys, shared_data &shared)
 Create a function object for computing gravitational force on planets in a system using a shared memory area. More...
 
GENERIC void sum (int b, int c, double &acc, double &jerk) const
 Find the acceleration and jerk for a planet. More...
 
GPUAPI void operator() (int ij, int b, int c, double &pos, double &vel, double &acc, double &jerk) const
 Run the complete algorithm for computing acceleration and jerk on all bodies. More...
 

Static Public Member Functions

static GENERIC int thread_per_system ()
 The number of thread per system.
 
static GENERIC int shmem_per_system ()
 The amount of memory per system.
 

Detailed Description

template<class T>
class swarm::gpu::bppt::GravitationAccJerk< T >

templatized Class working as a function object to calculate acceleration and jerk in parallel.

shared_data member is to be initialized with a shared memory pointer. Although it does not have to be a shared memory pointer.

It operates in two steps:

Step 0: Write positions and velocities to global memory which is cached.

Step 1: Calculate distances between pairs using calc_pair you should supply ij that is between 0 and n*(n-1)/2. It calculates the inverse of distance squared between each pair of bodies. The intermediate values for calculating acc/jerk are stored to the shared memory.

Step 2: Calculate forces that operate on each body it is done in one of the functions: sum, sum_acc, sum_acc_planets This function should be called per body per component. It uses the shared data and calculates the acc/jerk for each body.

Definition at line 56 of file gravitation_accjerk.hpp.

Constructor & Destructor Documentation

template<class T >
GENERIC swarm::gpu::bppt::GravitationAccJerk< T >::GravitationAccJerk ( ensemble::SystemRef &  sys,
shared_data &  shared 
)
inline

Create a function object for computing gravitational force on planets in a system using a shared memory area.

  • sys Reference to system that this algorithm operates on
  • shared Reference to an array of appropriate size allocated on shared memory to hold intermediat results.

Definition at line 81 of file gravitation_accjerk.hpp.

Member Function Documentation

template<class T >
GPUAPI void swarm::gpu::bppt::GravitationAccJerk< T >::operator() ( int  ij,
int  b,
int  c,
double &  pos,
double &  vel,
double &  acc,
double &  jerk 
) const
inline

Run the complete algorithm for computing acceleration and jerk on all bodies.

This is tightly coupled with the BPPT integrators. ij, b and c are calculated from thread id.

If you need to calculate only acceleration use acc function instead.

The pair number for this tread. The planet number for this thread. coordinate number x:0,y:1,z:2 position for this planet's coordinate velecotiy for this planet's coordinate output variable to hold acceleration output variable to hold jerk.

Definition at line 186 of file gravitation_accjerk.hpp.

References peyton::constants::c, and swarm::gpu::bppt::GravitationAccJerk< T >::sum().

template<class T >
GENERIC void swarm::gpu::bppt::GravitationAccJerk< T >::sum ( int  b,
int  c,
double &  acc,
double &  jerk 
) const
inline

Find the acceleration and jerk for a planet.

planet number coordinate number x:0,y:1,z:2 reference to output variable for acceleration reference to output variable for jerk

Find the contribution from/to Sun first

Definition at line 129 of file gravitation_accjerk.hpp.

References peyton::constants::c, and x.

Referenced by swarm::gpu::bppt::GravitationAccJerk< T >::operator()().


The documentation for this class was generated from the following file: