26 #ifndef GRALE_MONOPOLEGRID2_H
28 #define GRALE_MONOPOLEGRID2_H
30 #include "graleconfig.h"
31 #include "monopolebasisfunction.h"
32 #include <errut/errorbase.h>
33 #include <serut/serializationinterface.h>
41 class GravitationalLens;
43 class GRALE_IMPORTEXPORT MonopoleGrid2 :
public errut::ErrorBase
49 bool init(
const ImagesData &avoidImages,
const ImagesData &deflectionPoints,
50 const Real2DFunction &target,
const GravitationalLens &differenceDeflection,
51 Vector2D<double> center,
double areaSize,
int subDiv = 32,
double zeroPointFactor = 2.0);
53 int getNumberOfBasisFunctions()
const {
return m_monoPoleFunctions.size(); }
54 void setBasisWeights(
const std::vector<double> &w) {
if (w.size() == m_monoPoleWeights.size()) m_monoPoleWeights = w; }
56 double getZeroPoint(
int i)
const {
return m_monoPoleFunctions[i].getZeroPoint(); }
57 double getLengthScale(
int i)
const {
return m_monoPoleFunctions[i].getLengthScale(); }
58 Vector2D<double> getPosition(
int i)
const {
return m_monoPoleCenters[i]; }
60 void prepareFitnessCalculation();
61 void calculateFitness(
double *pTotalDeflection,
double *pNegative,
double scale);
63 bool write(serut::SerializationInterface &si)
const;
64 bool read(serut::SerializationInterface &si);
68 std::vector<MonopoleBasisFunction> m_monoPoleFunctions;
69 std::vector<Vector2D<double> > m_monoPoleCenters;
70 std::vector<double> m_monoPoleWeights;
71 std::vector<std::vector<int> > m_pixelDependencies;
72 std::vector<std::vector<int> > m_pointDependencies;
73 std::vector<std::vector<Vector2D<double> > > m_pointMonoPoleDeflections;
75 std::vector<double> m_targetMap;
76 std::vector<double> m_monoPoleMap;
78 std::vector<Vector2D<double> > m_differenceDeflections;
79 std::vector<Vector2D<double> > m_monoPoleTotalDelections;
81 Vector2D<double> m_bottomLeft;
88 #endif // GRALE_MONOPOLEGRID2_H