GLAMERDOC++
Gravitational Lensing Code Library
Classes | Public Member Functions | List of all members
OTreeNB< PType, DType > Struct Template Reference

OTreeNB: Tree structure used for force calculation with particles (i.e. stars, Nbody or halos). More...

#include <oTreeNB.h>

Classes

struct  Branch
 classes More...
 
class  iterator
 A iterator class that allows for movement through the tree without changing anything in the tree itself. More...
 

Public Member Functions

 OTreeNB (PType *xp, IndexType nparticles)
 
unsigned long size ()
 
void build (int Nbucket)
 
void build_size (int Nbucket)
 
void calcMoments ()
 
void calcMoments (DType *masses)
 
template<typename HType >
void calcMoments (std::vector< HType > &halos)
 
void force2D (const PosType *ray, PosType particle_mass, PosType smooth_factor, PosType theta2, PosType inv_area, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi)
 
void force2D (const PosType *ray, DType *masses, PosType smooth_factor, PosType theta2, PosType inv_area, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi)
 
void force2D_hole (const PosType *ray, PosType particle_mass, PosType smooth_factor, PosType theta2, PosType inv_area, PosType rmin, PosType *xo, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi)
 
void force2D_hole (const PosType *ray, PType *masses, PosType smooth_factor, PosType theta2, PosType inv_area, PosType rmin, PosType *xo, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi)
 
template<typename HType >
void force2D_halo (const PosType *ray, HType *halos, PosType theta2, PosType inv_area, PosType rmin, const PosType *xo, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi)
 
size_t getUsedBranches ()
 
size_t getTotalBranches ()
 
iterator begin ()
 
int getDepth () const
 
void getBoundingBox (PType &p1, PType &p2) const
 

Detailed Description

template<typename PType = Point_3d<PosType>, typename DType = PosType>
struct OTreeNB< PType, DType >

OTreeNB: Tree structure used for force calculation with particles (i.e. stars, Nbody or halos).

type for particle positions and boundaries etc The tree also contains pointers to the list of positions, sizes and masses of the particles. Also flags for the number of dimensions the tree is defined in (2 or 3), and if multiple masses and sizes should be used.

The template parameter PType is the structure used to store the particle positions.
It must operators [0], [1], [2] and operator - defined. Point_3d<float> for example

Member Function Documentation

◆ calcMoments() [1/3]

template<typename PType = Point_3d<PosType>, typename DType = PosType>
void OTreeNB< PType, DType >::calcMoments ( )
inline

calculate quadropole moment of branch ?? needs to have mass Point_2d dxcm; branch->quad[0]=branch->quad[1]=branch->quad[2]=0; for(IndexType i=0;i<branch->nparticles;++i){ PType &x = xxp[branch->particles[i]]; dxcm[0] = x[0] - branch->xcm[0]; dxcm[1] = x[1] - branch->xcm[1];

double r2 = dxcm[0]*dxcm[0] + dxcm[1]*dxcm[1]; branch->quad[0] += (r2-2*dxcm[0]*dxcm[0]); branch->quad[1] += (r2-2*dxcm[1]*dxcm[1]); branch->quad[2] += -2*dxcm[0]*dxcm[1]; }

◆ calcMoments() [2/3]

template<typename PType = Point_3d<PosType>, typename DType = PosType>
void OTreeNB< PType, DType >::calcMoments ( DType *  masses)
inline

calculate quadropole moment of branch Point_2d dxcm; branch->quad[0]=branch->quad[1]=branch->quad[2]=0; for(IndexType i=0;i<branch->nparticles;++i){ IndexType j = branch->particles[i]; PType &x = xxp[j];

dxcm[0] = x[0] - branch->xcm[0]; dxcm[1] = x[1] - branch->xcm[1];

double r2 = dxcm[0]*dxcm[0] + dxcm[1]*dxcm[1]; branch->quad[0] += (r2-2*dxcm[0]*dxcm[0]) * masses[j]; branch->quad[1] += (r2-2*dxcm[1]*dxcm[1]) * masses[j]; branch->quad[2] += -2*dxcm[0]*dxcm[1] * masses[i]; }

◆ calcMoments() [3/3]

template<typename PType = Point_3d<PosType>, typename DType = PosType>
template<typename HType >
void OTreeNB< PType, DType >::calcMoments ( std::vector< HType > &  halos)
inline

calculate quadropole moment of branch Point_2d dxcm; branch->quad[0]=branch->quad[1]=branch->quad[2]=0; for(IndexType i=0;i<branch->nparticles;++i){ IndexType j = branch->particles[i]; PType &x = xxp[j];

dxcm[0] = x[0] - branch->xcm[0]; dxcm[1] = x[1] - branch->xcm[1]; double m = halos[j].get_mass();

double r2 = dxcm[0]*dxcm[0] + dxcm[1]*dxcm[1]; branch->quad[0] += (r2-2*dxcm[0]*dxcm[0]) * m; branch->quad[1] += (r2-2*dxcm[1]*dxcm[1]) * m; branch->quad[2] += -2*dxcm[0]*dxcm[1] * m; }

◆ getBoundingBox()

template<typename PType = Point_3d<PosType>, typename DType = PosType>
void OTreeNB< PType, DType >::getBoundingBox ( PType &  p1,
PType &  p2 
) const
inline
Parameters
p1bottom, left, back corner of box
p2top, right, front corner of box

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