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

Gravitation calculation for a number of bodies between 10-20 EXPERIMENTAL: This class is not thoroughly tested. More...

#include <gravitation_mediumn.hpp>

Public Member Functions

GENERIC GravitationMediumN (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...
 
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...
 
__device__ double acc_planets (int ij, int b, int c) const
 todo: Remove once allow propagators to use GravitationAcc
 
__device__ double acc (int ij, int b, int c, double &pos, double &vel) const
 todo: Remove once allow propagators to use GravitationAcc
 

Static Public Member Functions

static GENERIC int shmem_per_system ()
 
static GENERIC int thread_per_system ()
 Number of threads per system.
 
static GENERIC int shmem_per_system ()
 Amount of shared memory per system.
 

Detailed Description

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

Gravitation calculation for a number of bodies between 10-20 EXPERIMENTAL: This class is not thoroughly tested.

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

Todo:
For this to be useful would need to make it so that integrators using this gravitation class would know that they only needed to launch 3*nbod threads per systems.

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 66 of file gravitation_mediumn.hpp.

Constructor & Destructor Documentation

template<class T >
GENERIC swarm::gpu::bppt::GravitationMediumN< T >::GravitationMediumN ( 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 91 of file gravitation_mediumn.hpp.

Member Function Documentation

template<class T >
GPUAPI void swarm::gpu::bppt::GravitationMediumN< 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 300 of file gravitation_mediumn.hpp.

References peyton::constants::c.

template<class T >
static GENERIC int swarm::gpu::bppt::GravitationMediumN< T >::shmem_per_system ( )
inlinestatic

todo: Test

Definition at line 344 of file gravitation_mediumn.hpp.


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