GRALE
arealensinversiongafactoryparams.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_AREALENSINVERSIONGAFACTORYPARAMS_H
27 
28 #define GRALE_AREALENSINVERSIONGAFACTORYPARAMS_H
29 
30 #include "graleconfig.h"
31 #include "lensinversiongafactoryparams.h"
32 #include "vector2d.h"
33 #include <list>
34 #include <string>
35 
36 namespace grale
37 {
38 
39 class ImagesDataExtended;
40 
41 class GRALE_IMPORTEXPORT AreaLensInversionGAFactoryParams : public LensInversionGAFactoryParams
42 {
43 public:
44  AreaLensInversionGAFactoryParams();
45  ~AreaLensInversionGAFactoryParams();
46 
47  void init(int maxgenerations, const std::list<ImagesDataExtended *> &images, double D_d,
48  Vector2D<double> center, double areasize, bool copyimages);
49 
50  int getMaximumNumberOfGenerations() const { return maxgenerations; }
51  double getD_d() const { return D_d; }
52  double getAreaSize() const { return areasize; }
53  Vector2D<double> getCenter() const { return center; }
54  const std::list<ImagesDataExtended *> &getImages() const { return images; }
55 
56  bool write(serut::SerializationInterface &si) const;
57  bool read(serut::SerializationInterface &si);
58 
59  // Override this if a derived implementation is used!
60  virtual AreaLensInversionGAFactoryParams *createCopy() const { AreaLensInversionGAFactoryParams *p = new AreaLensInversionGAFactoryParams(); p->init(maxgenerations, images, D_d, center, areasize, true); return p; }
61  virtual bool loadExtraParameters(const std::string &fname);
62 protected:
63  virtual bool writeInternal(serut::SerializationInterface &si) const { return true; }
64  virtual bool readInternal(serut::SerializationInterface &si) { return true; }
65 private:
66  int maxgenerations;
67  bool deleteimages;
68  double D_d;
69  double areasize;
70  Vector2D<double> center;
71  std::list<ImagesDataExtended *> images;
72 };
73 
74 } // end namespace
75 
76 #endif // GRALE_AREALENSINVERSIONGAFACTORYPARAMS_H