|
GLAMERDOC++
Gravitational Lensing Code Library
|
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 |
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
|
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]; }
|
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]; }
|
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; }
|
inline |
| p1 | bottom, left, back corner of box |
| p2 | top, right, front corner of box |
1.8.18