Swarm-NG  1.1
swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::Body Struct Reference

Concrete structure of Body This class is specifically designed to be used with CoalescedStruct array. More...

#include <ensemble.hpp>

Public Member Functions

GENERIC double & mass ()
 Mass of the body.
 
GENERIC const double & mass () const
 Mass of the body (constant accessor)
 
GENERIC Component & operator[] (const int &i)
 Index into components 0 is x, 1 is y, 2 is z Example b[0].pos() is x-coordinate of position and b[3].vel() is z-coordinate of velocity.
 
GENERIC const Component & operator[] (const int &i) const
 Constant accessor for indexing into body. c.f. to regular accessor.
 
GENERIC double & attribute (const int &i)
 Accessing extra attributes of the array.
 
GENERIC double distance_to_origin_squared ()
 Square distance of the planet to (0,0,0)
 
GENERIC double speed_squared ()
 Square of magnitude of velocity.
 
GENERIC void get (double &x, double &y, double &z, double &vx, double &vy, double &vz)
 Get all position and velocities at once.
 

Detailed Description

template<int _CHUNK_SIZE, int _NUM_BODY_ATTRIBUTES = NUM_PLANET_ATTRIBUTES, int _NUM_SYS_ATTRIBUTES = NUM_SYSTEM_ATTRIBUTES>
struct swarm::EnsembleBase< _CHUNK_SIZE, _NUM_BODY_ATTRIBUTES, _NUM_SYS_ATTRIBUTES >::Body

Concrete structure of Body This class is specifically designed to be used with CoalescedStruct array.

One instance of this body will contain information for CHUNK_SIZE bodies. However, The accessors only return information for the first element of each array. For instantiation outside ensemble the CHUNK_SIZE should be set to 1.

Definition at line 131 of file ensemble.hpp.


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