30 #ifndef GRALE_GRAVITATIONALLENS_H
32 #define GRALE_GRAVITATIONALLENS_H
34 #include "graleconfig.h"
36 #include <serut/serializationinterface.h>
50 virtual bool write(serut::SerializationInterface &si)
const { setErrorString(
"Not implemented");
return false; }
53 virtual bool read(serut::SerializationInterface &si) { setErrorString(
"Not implemented");
return false; }
121 double &ayy,
double &axy)
const;
124 static double getInverseMagnification(
double D_s,
double D_ds,
double axx,
125 double ayy,
double axy) {
double f = D_ds/D_s;
return (1.0-f*axx)*(1.0-f*ayy)-f*f*axy*axy; }
128 static void getShearInfo(
double D_s,
double D_ds,
double axx,
double ayy,
129 double axy,
double *pShearAngle,
double *pShearSize) {
double f = D_ds/D_s;
double g1 = 0.5*(axx-ayy);
double g2 = axy;
Vector2D<double> gVector(g1, g2);
double g = gVector.getLength();
if (g2 >= 0) *pShearAngle = 0.5*ACOS(g1/g);
else *pShearAngle = -0.5*ACOS(g1/g); *pShearSize = g*f; }
132 static void getShearInfo(
double gamma1,
double gamma2,
133 double *pShearAngle,
double *pShearSize) {
Vector2D<double> gVector(gamma1, gamma2);
double g = gVector.getLength();
if (gamma2 >= 0) *pShearAngle = 0.5*ACOS(gamma1/g);
else *pShearAngle = -0.5*ACOS(gamma1/g); *pShearSize = g; }
142 virtual double getInverseMagnification(
double D_s,
double D_ds,
Vector2D<double> theta)
const;
153 bool getTimeDelay(
double z_d,
double D_s,
double D_ds,
Vector2D<double> theta,
155 virtual bool getProjectedPotential(
double D_s,
double D_ds,
Vector2D<double> theta,
156 double *pPotentialValue)
const;
167 bool write(serut::SerializationInterface &si)
const;
173 static bool read(serut::SerializationInterface &si,
GravitationalLens **pLens, std::string &errorString);
176 bool save(
const std::string &fileName)
const;
181 static bool load(
const std::string &fileName,
GravitationalLens **pLens, std::string &errorString);
189 virtual bool getSuggestedScales(
double *pDeflectionScale,
double *pPotentialScale)
const;
190 virtual bool getCLParameterCounts(
int *pNumIntParams,
int *pNumFloatParams)
const;
191 virtual bool getCLParameters(
double deflectionScale,
double potentialScale,
int *pIntParams,
float *pFloatParams)
const;
193 std::string getCLLensProgram(std::string &subRoutineName)
const;
207 virtual std::string getCLProgram(std::string &subRoutineName)
const;
209 virtual int getCLSubLenses()
const {
return -1; }
214 virtual bool processParameters(
const GravitationalLensParams *params) = 0;
216 std::string getCLLensQuantitiesStructure()
const;
221 GravitationalLensParams *m_pParameters;
222 double m_derivDistScale;
227 #endif // GRALE_GRAVITATIONALLENS_H