GRALE
lensfitnessobject.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_LENSFITNESSOBJECT_H
31 
32 #define GRALE_LENSFITNESSOBJECT_H
33 
34 #include "graleconfig.h"
36 #include <errut/errorbase.h>
37 #include <vector>
38 #include <list>
39 
40 namespace grale
41 {
42 
43 class ImagesDataExtended;
44 
46 class GRALE_IMPORTEXPORT LensFitnessObject : public errut::ErrorBase
47 {
48 protected:
49  LensFitnessObject() { }
50 public:
51  virtual ~LensFitnessObject() { }
52 
73  virtual bool init(std::list<ImagesDataExtended *> &images, std::list<ImagesDataExtended *> &massScaleImages) = 0;
74 
86  virtual void postInit(const std::list<ImagesDataExtended *> &images, const std::list<ImagesDataExtended *> &massScaleImages,
87  double angularScale) { }
88 
92  virtual float calculateMassScaleFitness(const ProjectedImagesInterface &interface0) const = 0;
93 
96  virtual void calculateOverallFitness(const ProjectedImagesInterface &interface0, float *pFitnessValues) const = 0;
97 
100  virtual int getNumberOfFitnessComponents() const = 0;
101 
110  virtual int getImagesGroupSize() const = 0;
111 
112  // These are used in the factory initialization, to indicate what should be calculated and what original
113  // information should be store
119 
120 
136  virtual void getTotalCalcFlags(std::vector<bool> &deflectionFlags, std::vector<bool> &derivativeFlags, std::vector<bool> &potentialFlags) const = 0;
137 
142  virtual void getTotalStoreFlags(bool *pStoreIntens, bool *pStoreTimeDelay, bool *pStoreShearInfo) const = 0;
143 
146  virtual void getShortCalcFlags(std::vector<bool> &deflectionFlags, std::vector<bool> &derivativeFlags, std::vector<bool> &potentialFlags) const = 0;
147 
150  virtual void getShortStoreFlags(bool *pStoreIntens, bool *pStoreTimeDelay, bool *pStoreShearInfo) const = 0;
152 
153  // These are used in the genome fitness calculation. They all depend on the derivatives of the
154  // deflection angle, so they can only be used for sources that have the derivative calculation
155  // enabled in the ...CalcFlags functions below.
156  // These functions then use these derivatives to calculate other properties
164 
165 
166  virtual bool totalNeedInverseMagnifications() const = 0;
167 
169  virtual bool totalNeedShearComponents() const = 0;
170 
172  virtual bool totalNeedConvergence() const = 0;
173 
177  virtual const std::vector<bool> *getTotalInverseMagnificationFlags() const = 0;
178 
182  virtual const std::vector<bool> *getTotalShearComponentFlags() const = 0;
183 
187  virtual const std::vector<bool> *getTotalConvergenceFlags() const = 0;
188 
191  virtual bool shortNeedInverseMagnifications() const = 0;
192 
195  virtual bool shortNeedShearComponents() const = 0;
196 
199  virtual bool shortNeedConvergence() const = 0;
200 
203  virtual const std::vector<bool> *getShortInverseMagnificationFlags() const = 0;
204 
207  virtual const std::vector<bool> *getShortShearComponentFlags() const = 0;
208 
211  virtual const std::vector<bool> *getShortConvergenceFlags() const = 0;
213 };
214 
215 } // end namespace
216 
217 #endif // GRALE_LENSFITNESSOBJECT_H
218