GRALE
multiplewendlandlens.h
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 
26 #ifndef GRALE_MULTIPLEWENDLANDLENS_H
27 
28 #define GRALE_MULTIPLEWENDLANDLENS_H
29 
30 #include "graleconfig.h"
31 #include "gravitationallens.h"
32 #include <list>
33 
34 namespace grale
35 {
36 
37 class GRALE_IMPORTEXPORT WendlandLensInfo
38 {
39 public:
40  WendlandLensInfo() { m_heightFactor = 0; m_angularScale = 1; }
41  WendlandLensInfo(double heightFactor, double angularScale,
42  Vector2D<double> angularPosition) { m_heightFactor = heightFactor; m_angularScale = angularScale; m_angularPosition = angularPosition; }
43 
44  double getHeightFactor() const { return m_heightFactor; }
45  double getAngularScale() const { return m_angularScale; }
46  Vector2D<double> getAngularPosition() const { return m_angularPosition; }
47 private:
48  double m_heightFactor;
49  double m_angularScale;
50  Vector2D<double> m_angularPosition;
51 };
52 
53 class GRALE_IMPORTEXPORT MultipleWendlandLensParams : public GravitationalLensParams
54 {
55 public:
56  MultipleWendlandLensParams() { }
57  MultipleWendlandLensParams(const std::list<WendlandLensInfo> &phiXInfo,
58  const std::list<WendlandLensInfo> &phiYInfo) { m_phiXInfo = phiXInfo; m_phiYInfo = phiYInfo; }
59 
60  const std::list<WendlandLensInfo> &getPhiXInfo() const { return m_phiXInfo; }
61  const std::list<WendlandLensInfo> &getPhiYInfo() const { return m_phiYInfo; }
62 
63  void addPhiXInfo(const WendlandLensInfo &info) { m_phiXInfo.push_back(info); }
64  void addPhiYInfo(const WendlandLensInfo &info) { m_phiYInfo.push_back(info); }
65 
66  bool matchDeflections(const std::vector<Vector2D<double> > &deflectionPoints,
67  const std::vector<Vector2D<double> > &deflectionAngles,
68  double angularScale);
69 
70  GravitationalLensParams *createCopy() const;
71  bool write(serut::SerializationInterface &si) const;
72  bool read(serut::SerializationInterface &si);
73 private:
74  std::list<WendlandLensInfo> m_phiXInfo, m_phiYInfo;
75 };
76 
77 class GRALE_IMPORTEXPORT MultipleWendlandLens : public GravitationalLens
78 {
79 public:
80  MultipleWendlandLens();
81  ~MultipleWendlandLens();
82 
83  bool getAlphaVector(Vector2D<double> theta, Vector2D<double> *pAlpha) const;
84  double getSurfaceMassDensity(Vector2D<double> theta) const ;
85  bool getProjectedPotential(double D_s, double D_ds, Vector2D<double> theta, double *pPotentialValue) const;
86  bool getAlphaVectorDerivatives(Vector2D<double> theta, double &axx, double &ayy, double &axy) const;
87 
88  static double phiX(double r, double r2, double x, double y);
89  static double phiY(double r, double r2, double x, double y);
90  static double phiXX(double r, double r2, double x, double y);
91  static double phiXY(double r, double r2, double x, double y);
92  static double phiYY(double r, double r2, double x, double y);
93  static double phiXXX(double r, double r2, double x, double y);
94  static double phiXXY(double r, double r2, double x, double y);
95  static double phiXYY(double r, double r2, double x, double y);
96  static double phiYYY(double r, double r2, double x, double y);
97 protected:
98  bool processParameters(const GravitationalLensParams *pLensParams);
99 private:
100  std::vector<WendlandLensInfo> m_phiXInfo, m_phiYInfo;
101 };
102 
103 } // end namespace
104 
105 #endif // GRALE_MULTIPLEWENDLANDLENS_H