GRALE
massdisklens.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of GRALE, a library to facilitate the simulation
4  and inversion of gravitational lenses.
5 
6  Copyright (C) 2008-2012 Jori Liesenborgs
7 
8  Contact: jori.liesenborgs@gmail.com
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 
24 */
25 
30 #ifndef GRALE_MASSDISKLENS_H
31 
32 #define GRALE_MASSDISKLENS_H
33 
34 #include "graleconfig.h"
35 #include "gravitationallens.h"
36 #include "constants.h"
37 
38 namespace grale
39 {
40 
41 class GRALE_IMPORTEXPORT MassDiskLensParams : public GravitationalLensParams
42 {
43 public:
44  MassDiskLensParams() { m_density = 0; m_angularRadius = 0; }
45  MassDiskLensParams(double density, double angularRadius) { m_density = density; m_angularRadius = angularRadius; }
46  MassDiskLensParams(double Dd, double Ds, double Dds, double angularRadius) { m_density = (SPEED_C*SPEED_C/(4.0*CONST_PI*CONST_G*Dd))*(Ds/Dds); m_angularRadius = angularRadius; }
47  double getDensity() const { return m_density; }
48  double getAngularRadius() const { return m_angularRadius; }
49  GravitationalLensParams *createCopy() const;
50  bool write(serut::SerializationInterface &si) const;
51  bool read(serut::SerializationInterface &si);
52 private:
53  double m_density, m_angularRadius;
54 };
55 
56 class GRALE_IMPORTEXPORT MassDiskLens : public GravitationalLens
57 {
58 public:
59  MassDiskLens();
60  ~MassDiskLens();
61 
62  bool getAlphaVector(Vector2D<double> theta, Vector2D<double> *pAlpha) const;
63  double getSurfaceMassDensity(Vector2D<double> theta) const;
64  bool getAlphaVectorDerivatives(Vector2D<double> theta, double &axx, double &ayy, double &axy) const;
65 
66  bool getProjectedPotential(double D_s, double D_ds, Vector2D<double> theta,
67  double *pPotentialValue) const;
68 protected:
69  bool processParameters(const GravitationalLensParams *pLensParams);
70 private:
71  double m_factor;
72  double m_scaleFactor;
73  double m_density;
74  double m_angularRadius;
75  double m_angularRadiusSquared;
76  double m_scaledMass;
77 };
78 
79 } // end namespace
80 
81 #endif // GRALE_MASSDISKLENS_H