GLAMERDOC++
Gravitational Lensing Code Library
planes.h
1 /*
2  * planes.h
3  *
4  * Created on: May 21, 2013
5  * Author: mpetkova
6  */
7 
8 #ifndef PLANES_H_
9 #define PLANES_H_
10 
11 #include "quadTree.h"
12 #include "quadTreeHalos.h"
13 #include "lens_halos.h"
14 
16 
17 class LensPlane{
18 public:
19  LensPlane(float redshift):z(redshift) {}
20  virtual ~LensPlane() {}
21 
22  virtual void force(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType *xx) = 0;
23 
24  virtual void addHalo(LensHalo* halo) = 0;
25  virtual void removeHalo(LensHalo* halo) = 0;
26 
27  virtual std::vector<LensHalo*> getHalos() = 0;
28  virtual std::vector<const LensHalo*> getHalos() const = 0;
29  virtual void getNeighborHalos(PosType ray[],PosType rmax,std::vector<LensHalo*> &neighbors) const{};
30 
31  float z;
32 };
33 
35 class LensPlaneTree : public LensPlane{
36 public:
37 
38  LensPlaneTree(float z,LensHalo **my_halos,IndexType Nhalos,PosType my_sigma_background,PosType my_inv_screening_scale = 0);
39 
40  LensPlaneTree(const LensPlaneTree &p);
42  std::swap(*this,p);
43  }
44 
45  ~LensPlaneTree();
46 
47  LensPlaneTree & operator=(const LensPlaneTree &p);
48  LensPlaneTree & operator=(LensPlaneTree &&p);
49 
50  void force(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType *xx);
51  void addHalo(LensHalo* halo);
52  void removeHalo(LensHalo* halo);
53 
54  std::vector<LensHalo*> getHalos();
55  std::vector<const LensHalo*> getHalos() const;
57  void getNeighborHalos(PosType ray[],PosType rmax,std::vector<LensHalo*> &neighbors) const;
58 
59 private:
60 
61  std::vector<LensHalo *> halos;
62  TreeQuadHalos<LensHalo> * halo_tree;
63 };
64 
71 public:
72  LensPlaneSingular(float z,LensHaloHndl *my_halos, IndexType Nhalos);
74  halos = p.halos;
75  }
77  std::swap(halos,p.halos);
78  }
80 
81  LensPlaneSingular & operator=(const LensPlaneSingular &p){
82  if(&p != this){
83  z = p.z;
84  halos = p.halos;
85  }
86  return *this;
87  }
88  LensPlaneSingular & operator=(LensPlaneSingular &&p){
89  if(&p != this){
90  z = p.z;
91  std::swap(halos,p.halos);
92  }
93  return *this;
94  }
95 
96  void force(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType *xx);
97 
98  void addHalo(LensHalo* halo);
99  void removeHalo(LensHalo* halo);
100 
101  std::vector<LensHalo*> getHalos();
102  std::vector<const LensHalo*> getHalos() const;
103  void getNeighborHalos(PosType ray[],PosType rmax,std::vector<LensHalo*> &neighbors) const;
104 
105 private:
106  std::vector<LensHalo*> halos;
107 };
108 
109 #endif /* PLANES_H_ */
LensPlaneSingular::force
void force(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType *xx)
returns the lensing quantities of a ray in physical coordinates
Definition: planes.cpp:114
LensPlane
Base class representing a plane in redshift onto which lenses are placed.
Definition: planes.h:17
TreeQuadHalos< LensHalo >
LensPlaneSingular
A LensPlane with a list of LensHalo's in it.
Definition: planes.h:70
LensHalo
A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
Definition: lens_halos.h:57
LensPlaneTree
A LensPlane with a TreeQuad on it to calculate the deflection caused by field lenses.
Definition: planes.h:35
LensPlaneTree::getNeighborHalos
void getNeighborHalos(PosType ray[], PosType rmax, std::vector< LensHalo * > &neighbors) const
Get the halos on this plane that are wthin rmax of ray[].
Definition: planes.cpp:88
LensPlaneSingular::addHalo
void addHalo(LensHalo *halo)
It is assumed that the position of halo is in physical Mpc.
Definition: planes.cpp:164