GLAMERDOC++
Gravitational Lensing Code Library
|
Object used to calculate the force or deflection caused by a collection of "particles" by the tree method. More...
#include <forceTree.h>
Public Member Functions | |
TreeForce (PosType **xp, IndexType Npoints, float *masses, float *rsph, bool Multimass, bool Multisize, PosType my_kappa_background=0, int bucket=5, int dimensions=2, bool median=false, PosType theta=0.1) | |
TreeForce (PosType **xp, IndexType Npoints, LensHalo *my_halos, bool Multisize=true, PosType my_kappa_bk=0.0, int bucket=5, int dimensions=2, bool median=false, PosType theta=0.1) | |
float * | CalculateSPHsmoothing (int N) |
calculated sph smoothing and store them in the tree, also provide pointer to them | |
void | force2D (PosType const *ray, PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi) |
calculate the deflection and lensing propertie | |
Public Member Functions inherited from TreeSimple< PType > | |
TreeSimple (PType *xp, IndexType Npoints, int bucket=5, int dimensions=2, bool median=true) | |
template<typename T > | |
void | PointsWithinCircle (T center[2], float radius, std::list< unsigned long > &neighborkist) |
Finds the points within a circle around center and puts their index numbers in a list. | |
template<typename T > | |
void | PointsWithinEllipse (T center[2], float a_max, float a_min, float posangle, std::list< unsigned long > &neighborkist) |
Finds the points within an ellipse around center and puts their index numbers in a list. | |
template<typename T > | |
T | NNDistance (T *ray, int Nneighbors) const |
Finds the nearest N neighbors and puts their index numbers in an array, also returns the distance to the Nth neighbor for calculating smoothing. | |
template<typename T > | |
void | PointsWithinEllipse (T *ray, float rmax, float rmin, float posangle, std::list< unsigned long > &neighborlist) |
template<typename T > | |
void | PointsWithinCircle (T *ray, float rmax, std::list< unsigned long > &neighborlist) |
Protected Member Functions | |
void | CalcMoments () |
void | rotate_coordinates (PosType **coord) |
simple rotates the coordinates in the xp array | |
virtual PosType | alpha_h (PosType r2s2, PosType sigma) |
virtual PosType | kappa_h (PosType r2s2, PosType sigma) |
virtual PosType | gamma_h (PosType r2s2, PosType sigma) |
virtual PosType | phi_o (PosType r2, PosType sigma) |
Protected Member Functions inherited from TreeSimple< PType > | |
TreeNBStruct< PType > * | BuildTreeNB (PType *xxp, IndexType Nparticles, IndexType *particles, int Ndimensions, PosType theta) |
void | _BuildTreeNB (TreeNBStruct< PType > *tree, IndexType nparticles, IndexType *particles) |
template<typename T > | |
void | _findleaf (T *ray, TreeSimple::iterator &it) const |
template<typename T > | |
void | _PointsWithin (T *ray, float *rmax, std::list< unsigned long > &neighborkist) |
template<typename T > | |
void | _NearestNeighbors (T *ray, int Nneighbors, unsigned long *neighbors, PosType *rneighbors) |
BranchNB * | NewBranchNB (IndexType *particles, IndexType nparticles, PosType boundary_p1[], PosType boundary_p2[], PosType center[], int level, unsigned long branchNBnumber) |
void | FreeBranchNB (BranchNB *branchNB) |
TreeNBStruct< PType > * | NewTreeNB (IndexType *particles, IndexType nparticles, PosType boundary_p1[], PosType boundary_p2[], PosType center[], short Ndimensions) |
void | freeTreeNB (TreeNBStruct< PType > *tree) |
short | emptyTreeNB (TreeNBStruct< PType > *tree) |
void | _freeTreeNB (TreeNBStruct< PType > *tree, short child) |
bool | isEmptyNB (TreeNBStruct< PType > *tree) |
bool | atTopNB (TreeNBStruct< PType > *tree) |
bool | noChildNB (TreeNBStruct< PType > *tree) |
bool | offEndNB (TreeNBStruct< PType > *tree) |
void | getCurrentNB (TreeNBStruct< PType > *tree, IndexType *particles, IndexType *nparticles) |
unsigned long | getNbranchesNB (TreeNBStruct< PType > *tree) |
void | moveTopNB (TreeNBStruct< PType > *tree) |
void | moveUpNB (TreeNBStruct< PType > *tree) |
void | moveToChildNB (TreeNBStruct< PType > *tree, int child) |
void | insertChildToCurrentNB (TreeNBStruct< PType > *tree, IndexType *particles, IndexType nparticles, PosType boundary_p1[], PosType boundary_p2[], PosType center[], int child) |
void | attachChildToCurrentNB (TreeNBStruct< PType > *tree, BranchNB &data, int child) |
bool | TreeNBWalkStep (TreeNBStruct< PType > *tree, bool allowDescent) |
bool | atLeaf () |
template<typename T > | |
bool | inbox (const T *center, PosType *p1, PosType *p2) const |
Protected Attributes | |
bool | init |
provides a way to change the profiles of the particles, by default Gaussian | |
bool | MultiMass |
true if particles have different masses. | |
bool | MultiRadius |
true if particles have different sizes. | |
float * | masses |
Array of particle masses. | |
float * | rsph |
Array of particle sizes. | |
PosType | kappa_background |
PosType | force_theta |
bool | haloON |
LensHalo * | halos |
Protected Attributes inherited from TreeSimple< PType > | |
int | Ndim |
int | incell |
TreeNBStruct< PType > * | tree |
IndexType * | index |
IndexType | Nparticles |
bool | median_cut |
int | Nbucket |
PosType | realray [3] |
PType * | xxp |
Object used to calculate the force or deflection caused by a collection of "particles" by the tree method.
The particles can be point masses or have multiple sizes in which case they have a Gaussian profile. They can also have the same mass or multiple masses.
xp[][], masses[] and rsph[] need to be allocated before a TreeForce is constructed and de-allocated after it is destructed. If the boolean flags are set to false these arrays need only be one element long. Multiple TreeForces can be made from the same particles. Do not rotate the particles without reconstructing a TreeForce.
Most of the code in the earlier TreeNBForce.c is duplicated here as private methods and a few public ones.
The default value of theta = 0.1 generally gives better than 1% accuracy on alpha. The shear and kappa is always more accurate than the deflection.
TreeForce::TreeForce | ( | PosType ** | xp, |
IndexType | Npoints, | ||
float * | masses, | ||
float * | rsph, | ||
bool | Multimass, | ||
bool | Multisize, | ||
PosType | my_kappa_background = 0, | ||
int | bucket = 5, | ||
int | dimensions = 2, | ||
bool | median = false, | ||
PosType | theta = 0.1 ) |
my_kappa_background | background kappa that is subtracted |
TreeForce::TreeForce | ( | PosType ** | xp, |
IndexType | Npoints, | ||
LensHalo * | my_halos, | ||
bool | Multisize = true, | ||
PosType | my_kappa_bk = 0.0, | ||
int | bucket = 5, | ||
int | dimension = 2, | ||
bool | median = false, | ||
PosType | theta = 0.1 ) |
xp | positions of the halos xp[0..Npoints-1][0..1 or 2] |
Npoints | number of halos |
my_halos | array with internal properties of halos |
Multisize | flag false if only one halo size and structure should be used, default is true |
my_kappa_bk | Background convergence to be subtracted |
bucket | maximum number of halos in a leaf of the tree |
dimension | 2 or 3, dimension of tree, default 2 |
median | If true will divide branches at the median position of the particles, if false an equal area cut is used, default false |
theta | Opening angle used in tree force calculation |
void TreeForce::force2D | ( | PosType const * | ray, |
PosType * | alpha, | ||
KappaType * | kappa, | ||
KappaType * | gamma, | ||
KappaType * | phi ) |
calculate the deflection and lensing propertie
TreeNBForce2D calculates the defection, convergence and shear using the plane-lens approximation with 3D SPH smoothing of the density rsph must be calculated before doing this with FindRSPH or by other means. tangent[3] - the direction of light rays or orientation of the simulation tree can be either a 3d or 2d tree although 2d is more efficient need to change the projected cm in _TreeNBForce to us 3d tree
The output alpha[] is in units of mass_scale/Mpc, ie it needs to be divided by Sigma_crit and multiplied by mass_scale to be the defelction in the lens equation expressed on the lens plane or multiplied by 4*pi*G*mass_scale to get the deflection angle caused by the plane lens.
intersecting, subtract the point particle
|
protected |
A uniform mass sheet in units of mass_scale/Mpc^2 used to subtract of the contribution of the particles to the mean density of the universe