GLAMERDOC++
Gravitational Lensing Code Library
uniform_lens.h
1 /*
2  * uniform_lens.h
3  *
4  * Created on: Jan 21, 2013
5  * Author: D. Leier
6  */
7 
8 #ifndef UNIFORM_LENS_H_
9 #define UNIFORM_LENS_H_
10 
11 #include "base_analens.h"
12 
25 class LensHaloUniform: public LensHalo{
26 public:
28  LensHaloUniform(double zlens
29  ,double Sigma
30  ,Point_2d &Shear
31  ,COSMOLOGY &cosmo
32  );
33 
34  ~LensHaloUniform();
35 
37  float getSigma() const {return perturb_modes[0];};
39  Point_2d getShear() const{
40  Point_2d p(perturb_modes[1],perturb_modes[2]);
41  return p;
42  }
43 
45  void resetGamma(const Point_2d &Shear
46  ){
47  perturb_modes[1] = Shear[0];
48  perturb_modes[2] = Shear[1];
49  }
50 
52  void resetKappa(double Sigma
53  ){
54  perturb_modes[0] = Sigma;;
55  }
56 
57  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType const *xcm,bool subtract_point=false,PosType screening = 1.0);
58 
60  perturb_modes[0] = h.perturb_modes[0];
61  perturb_modes[1] = h.perturb_modes[1];
62  perturb_modes[2] = h.perturb_modes[2];
63  }
64 
65  LensHaloUniform & operator=(const LensHaloUniform &h){
66  if(this == &h) return *this;
68  perturb_modes[0] = h.perturb_modes[0];
69  perturb_modes[1] = h.perturb_modes[1];
70  perturb_modes[2] = h.perturb_modes[2];
71  return *this;
72  }
73 
74 protected:
75 
76  PosType perturb_modes[3];
77  PosType lens_expand(PosType *mod,PosType const *x,PosType *alpha,KappaType *gamma,KappaType *phi);
78 };
79 
80 class LensHaloKappaDisk: public LensHalo{
81 public:
83  LensHaloKappaDisk(double zlens
84  ,double Sigma_in
85  ,double Rmax
86  ,const Point_2d ang_center
87  ,COSMOLOGY &cosmo
88  )
89  :LensHalo(zlens,cosmo),Sigma(Sigma_in)
90  {
91 
92  if(Rmax <= 0){
93  std::cerr << "LensHaloKappaDisk: Rmax cannot be <= 0" << std::endl;
94  throw std::invalid_argument("Rmax<=0");
95  }
96  LensHalo::setMass(PI*Rmax*Rmax*Sigma);
97  LensHalo::Rmax = Rmax;
98  LensHalo::setRsize(Rmax);
99  LensHalo::set_rsize(Rmax);
100  LensHalo::setTheta(ang_center);
101  }
102 
103  ~LensHaloKappaDisk(){};
104 
106  float getSigma() const {return Sigma;};
107 
108  LensHaloKappaDisk(const LensHaloKappaDisk &h):LensHalo(h){
109  Sigma = h.Sigma;
110  }
111 
112  LensHaloKappaDisk & operator=(const LensHaloKappaDisk &h){
113  if(this == &h) return *this;
115  Sigma = h.Sigma;
116  return *this;
117  }
118 
119  void force_halo(PosType *alpha,KappaType *kappa,KappaType *gamma,KappaType *phi,PosType const *xcm,bool subtract_point=false,PosType screening = 1.0){
120 
121  float tmp;
122  PosType tmp_mass;
123 
124  PosType r=sqrt(xcm[0]*xcm[0] + xcm[1]*xcm[1]);
125 
126  if(r < Rmax){
127  alpha[0] -= Sigma*xcm[0];
128  alpha[1] -= Sigma*xcm[1];
129  *kappa += Sigma;
130  }else{
131  tmp_mass = mass/PI/r/r; //Sigma * Rmax*Rmax/r/r;
132  alpha[0] -= tmp_mass*xcm[0];
133  alpha[1] -= tmp_mass*xcm[1];
134 
135  tmp = 2*tmp_mass/r/r;
136  gamma[0] -= 0.5*(xcm[0]*xcm[0] - xcm[1]*xcm[1])*tmp;
137  gamma[1] -= xcm[0]*xcm[1]*tmp;
138  }
139 
140  return;
141  }
142 protected:
143  double Sigma; // surface density
144 };
145 #endif /* UNIFORM_LENS_H_ */
LensHalo::operator=
LensHalo & operator=(const LensHalo &h)
Definition: lens_halos.cpp:169
LensHaloUniform
A uniform surface density and shear lens.
Definition: uniform_lens.h:25
LensHalo::force_halo
virtual void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
Definition: lens_halos.cpp:1528
LensHaloUniform::getSigma
float getSigma() const
surface density in Msun/Mpc^2
Definition: uniform_lens.h:37
LensHalo
A base class for all types of lensing "halos" which are any mass distribution that cause lensing.
Definition: lens_halos.h:56
Point_2d
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition: point.h:48
LensHaloUniform::getShear
Point_2d getShear() const
shear in Msun/Mpc^2
Definition: uniform_lens.h:39
LensHaloUniform::resetGamma
void resetGamma(const Point_2d &Shear)
reset the shear keeping the redshift of the plane fixed
Definition: uniform_lens.h:45
LensHaloUniform::force_halo
void force_halo(PosType *alpha, KappaType *kappa, KappaType *gamma, KappaType *phi, PosType const *xcm, bool subtract_point=false, PosType screening=1.0)
Definition: readfiles_uni.cpp:74
LensHalo::set_rsize
void set_rsize(float my_rsize)
set radius rsize beyond which interpolation values between alpha_ellip and alpha_iso are computed
Definition: lens_halos.h:240
LensHaloUniform::LensHaloUniform
LensHaloUniform(double zlens, double Sigma, Point_2d &Shear, COSMOLOGY &cosmo)
Direct constructor without any stars.
Definition: readfiles_uni.cpp:54
LensHalo::setTheta
void setTheta(PosType PosX, PosType PosY)
set the position of the Halo in radians
Definition: lens_halos.h:105
LensHaloUniform::lens_expand
PosType lens_expand(PosType *mod, PosType const *x, PosType *alpha, KappaType *gamma, KappaType *phi)
first two are shear
Definition: readfiles_uni.cpp:91
LensHaloUniform::resetKappa
void resetKappa(double Sigma)
reset the convergence keeping the redshift of the plane fixed
Definition: uniform_lens.h:52