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

Gravitation calculation class for large number of bodies in a system. More...

#include <gravitation_largen.hpp>

Public Member Functions

GENERIC GravitationLargeN (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...
 

Static Public Member Functions

static GPUAPI void * unused_shared_data_pointer (const int system_per_block)
 WARNING: Need to test that this works (accounting for larger memory usage due to coalesced arrys)
 

Detailed Description

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

Gravitation calculation class for large number of bodies in a system.

EXPERIMENTAL: This class is not thoroughly tested.

Doesn't-need-to-be-templatized Class working as a function object to calculate acceleration and jerk in parallel for many-body 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: Loops over other bodies to: Step 1a: Calculate distances between pairs of bodies The intermediate values for calculating acc/jerk are stored to the shared memory.

Step 1b: Calculate forces that affect the thread's body using data

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 63 of file gravitation_largen.hpp.

Constructor & Destructor Documentation

template<class T >
GENERIC swarm::gpu::bppt::GravitationLargeN< T >::GravitationLargeN ( 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 87 of file gravitation_largen.hpp.

Member Function Documentation

template<class T >
GPUAPI void swarm::gpu::bppt::GravitationLargeN< 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 270 of file gravitation_largen.hpp.

References peyton::constants::c.


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