Swarm-NG  1.1
swarm::EnsembleAlloc< W, _Allocator > Struct Template Reference

Allocator based version of ensemble containing memory management routines It takes an allocator as a parameter and uses the allocator for allocate, deallocate and copying the ensemble. More...

#include <ensemble_alloc.hpp>

Inheritance diagram for swarm::EnsembleAlloc< W, _Allocator >:
swarm::EnsembleBase< W >

Public Member Functions

EnsembleAlloc clone ()
 Deep copy of this ensemble.
 
template<class Other >
Other cloneTo ()
 Clone to a different memory (e.g. GPU)
 
template<class Other >
void copyTo (Other &o)
 Copy to another ensemble located on a different memory.
 
- Public Member Functions inherited from swarm::EnsembleBase< W >
GENERIC const int & nbod () const
 Number of bodies per system.
 
GENERIC const int & nsys () const
 Number of systems.
 
BodyArraybodies ()
 Coalsed array of bodies. For INTERNAL use only.
 
SysArraysystems ()
 Coalsed array of systems. For INTERNAL use only.
 
GENERIC SystemRef operator[] (const int &i)
 Index into systems array to access a system. More...
 
GENERIC void get_barycenter (const int &sys, double &x, double &y, double &z, double &vx, double &vy, double &vz, const int &max_body_id=MAX_NBODIES) const
 Deprecated function: this function uses a very bad signature and too many arguments. More...
 
GENERIC double calc_total_energy (int sys) const
 Total energy (potential+kinetic) of a system.
 
GENERIC void calc_total_energy (double *E) const
 Calculate the total energy of a system and store it in E. More...
 
GENERIC range_t time_ranges () const
 Range of times of systems (average,min,max) Averages the time for all systems and finds min and max Useful to find the best value for destination time.
 

Static Public Member Functions

static EnsembleAlloc create (const int &nbod, const int &nsys)
 Create a new ensemble that can accomodate nsys systems with nbod bodies Arrays are allocated on the heap but ensemble structure is value-copied.
 
- Static Public Member Functions inherited from swarm::EnsembleBase< W >
static GENERIC size_t body_element_count (const int &nbod, const int &nsys)
 Size of Body[] array required for an ensemble of size nbod,nsys.
 
static GENERIC size_t sys_element_count (const int &nsys)
 Size of Sys[] array required for an ensemble of size nsys.
 

Additional Inherited Members

- Public Types inherited from swarm::EnsembleBase< W >
typedef CoalescedStructArray
< Body, double, CHUNK_SIZE > 
BodyArray
 Type of array that we want to use for Body.
 
typedef CoalescedStructArray
< Sys, double, CHUNK_SIZE > 
SysArray
 Type of array that we want to use for Sys.
 
- Static Public Attributes inherited from swarm::EnsembleBase< W >
static const int CHUNK_SIZE
 CHUNK_SIZE for Coalesced access. c.f CoalescedStructArray.
 
static const int NUM_BODY_ATTRIBUTES
 Number of extra attributes.
 
static const int NUM_SYS_ATTRIBUTES
 Number of extra attributes per system.
 
- Protected Member Functions inherited from swarm::EnsembleBase< W >
GENERIC EnsembleBase ()
 Trivial constructor, creates an invalid ensemble. More...
 
GENERIC EnsembleBase (const int &nbod, const int &nsys, PBody body_array, PSys sys_array)
 Create an ensemble from pre-allocated body_array and sys_array arrays.
 
- Protected Attributes inherited from swarm::EnsembleBase< W >
int _nbod
 Number of bodies.
 
int _nsys
 Number of systems.
 
BodyArray _body
 Coalesced array of Body.
 
SysArray _sys
 Coalesced array of Sys.
 

Detailed Description

template<int W, template< class T > class _Allocator>
struct swarm::EnsembleAlloc< W, _Allocator >

Allocator based version of ensemble containing memory management routines It takes an allocator as a parameter and uses the allocator for allocate, deallocate and copying the ensemble.

The allocated memories are protected by shared pointers.

Definition at line 12 of file ensemble_alloc.hpp.


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