GRALE
polynomialmassprofilelens.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_POLYNOMIALMASSPROFILELENS_H
31 
32 #define GRALE_POLYNOMIALMASSPROFILELENS_H
33 
34 #include "graleconfig.h"
35 #include "symmetriclens.h"
36 #include <vector>
37 #include <list>
38 
39 // Here, the profile refers to the profile of the total mass M(theta)
40 
41 namespace grale
42 {
43 
44 class GRALE_IMPORTEXPORT PolynomialPart
45 {
46 public:
47  PolynomialPart();
48  PolynomialPart(double xOffset, double yOffset, double xScale, double yScale, double xEnd, const std::vector<double> &coefficients);
49  PolynomialPart(const PolynomialPart &polynomialPart);
50  ~PolynomialPart();
51  double getXOffset() const { return m_xOffset; }
52  double getYOffset() const { return m_yOffset; }
53  double getXScale() const { return m_xScale; }
54  double getYScale() const { return m_yScale; }
55  double getEndPosition() const { return m_xEnd; }
56  const std::vector<double> &getCoefficients() const { return m_coefficients; }
57  const std::vector<double> &getOffsetCoefficients() const { return m_offsetCoefficients; }
58 
59  PolynomialPart &operator=(const PolynomialPart &p);
60 private:
61  void calculateOffsetCoefficients();
62 
63  double m_xOffset;
64  double m_yOffset;
65  double m_xScale;
66  double m_yScale;
67  double m_xEnd;
68  std::vector<double> m_coefficients;
69  std::vector<double> m_offsetCoefficients;
70 };
71 
72 class GRALE_IMPORTEXPORT PolynomialMassProfileLensParams : public GravitationalLensParams
73 {
74 public:
75  PolynomialMassProfileLensParams();
76  ~PolynomialMassProfileLensParams();
77  void addPolynomialPart(const PolynomialPart &p);
78  const std::list<PolynomialPart> &getPolynomialParts() const { return m_polynomialParts; }
79 
80  bool write(serut::SerializationInterface &si) const;
81  bool read(serut::SerializationInterface &si);
82  GravitationalLensParams *createCopy() const;
83 private:
84  std::list<PolynomialPart> m_polynomialParts;
85 };
86 
87 class GRALE_IMPORTEXPORT PolynomialZeroMassLensParams : public PolynomialMassProfileLensParams
88 {
89 public:
90  PolynomialZeroMassLensParams(double D_d, double densityScale, double angularRadius, double zeroPoint);
91  ~PolynomialZeroMassLensParams();
92 };
93 
94 class GRALE_IMPORTEXPORT PolynomialTimeDelayLensParams : public PolynomialMassProfileLensParams
95 {
96 public:
97  PolynomialTimeDelayLensParams(double theta1, double theta2, double timeDiff, double zLens);
98  ~PolynomialTimeDelayLensParams();
99 };
100 
127 class GRALE_IMPORTEXPORT PolynomialMassProfileLens : public SymmetricLens
128 {
129 public:
132 
133  bool getProjectedPotential(double D_s, double D_ds, Vector2D<double> theta,
134  double *pPotentialValue) const;
135 protected:
136  bool processParameters(const GravitationalLensParams *pLensParams);
137  double getMassInside(double thetaLength) const;
138  double getProfileSurfaceMassDensity(double thetaLength) const;
139 private:
140  std::vector<PolynomialPart> m_polynomialParts;
141  std::vector<double> m_potentialOffsets;
142  double m_totalMass;
143  double m_totalPotential;
144  double m_endPosition;
145 };
146 
147 } // end namespace
148 
149 #endif // GRALE_POLYNOMIALMASSPROFILELENS_H
150