GRALESHELL

cmdlenses.h

00001 /*
00002 
00003   This file is a part of GRALESHELL, a program to facilitate the simulation
00004   and inversion of gravitational lenses, based on the GRALE library.
00005 
00006   Copyright (C) 2008-2012 Jori Liesenborgs
00007 
00008   Contact: jori.liesenborgs@gmail.com
00009   
00010   This program is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU General Public License as published by
00012   the Free Software Foundation; either version 2 of the License, or
00013   (at your option) any later version.
00014   
00015   This program is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018   GNU General Public License for more details.
00019   
00020   You should have received a copy of the GNU General Public License
00021   along with this program; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023   
00024 */
00025 
00026 #ifndef CMDLENSES_H
00027 
00028 #define CMDLENSES_H
00029 
00030 #include <shellp/shellcommand.h>
00031 #include <shellp/shellcmdrealarg.h>
00032 #include <shellp/shellcmdstringarg.h>
00033 #include <shellp/shellcmdboolarg.h>
00034 #include <shellp/shellcmdintarg.h>
00035 #include <vector>
00036 
00037 class CmdLens : public shellp::ShellCommand
00038 {
00039 protected:
00040         CmdLens(const std::string &cmdname);
00041 public:
00042         ~CmdLens();
00043 protected:
00044         double GetD_d() const                                                   { return distarg->getValue(); }
00045 private:
00046         shellp::ShellCmdRealArg *distarg;
00047 };
00048 
00049 class CmdLensPointmass : public CmdLens
00050 {
00051 public:
00052         CmdLensPointmass(const std::string &cmdname);
00053         ~CmdLensPointmass();
00054         bool execute();
00055 private:
00056         shellp::ShellCmdRealArg *massarg;
00057 };
00058 
00059 class CmdLensPlummer : public CmdLens
00060 {
00061 public:
00062         CmdLensPlummer(const std::string &cmdname);
00063         ~CmdLensPlummer();
00064         bool execute();
00065 private:
00066         shellp::ShellCmdRealArg *massarg;
00067         shellp::ShellCmdRealArg *widtharg;
00068 };
00069 
00070 class CmdLensGauss : public CmdLens
00071 {
00072 public:
00073         CmdLensGauss(const std::string &cmdname);
00074         ~CmdLensGauss();
00075         bool execute();
00076 private:
00077         shellp::ShellCmdRealArg *massarg;
00078         shellp::ShellCmdRealArg *widtharg;
00079 };
00080 
00081 class CmdLensMultiplePlummers : public CmdLens
00082 {
00083 public:
00084         CmdLensMultiplePlummers(const std::string &cmdname);
00085         ~CmdLensMultiplePlummers();
00086         bool execute();
00087 private:
00088         shellp::ShellCmdStringArg *fnamearg;
00089         std::vector<shellp::ShellCmdArg *> plumargs;
00090         shellp::ShellCmdRealArg *massarg,*widtharg,*xposarg,*yposarg;
00091 };
00092 
00093 class CmdLensNSIE : public CmdLens
00094 {
00095 public:
00096         CmdLensNSIE(const std::string &cmdname);
00097         ~CmdLensNSIE();
00098         bool execute();
00099 private:
00100         shellp::ShellCmdRealArg *Varg,*Farg,*corearg;
00101 };
00102 
00103 class CmdLensNSIS : public CmdLens
00104 {
00105 public:
00106         CmdLensNSIS(const std::string &cmdname);
00107         ~CmdLensNSIS();
00108         bool execute();
00109 private:
00110         shellp::ShellCmdRealArg *Varg,*corearg;
00111 };
00112 
00113 class CmdLensSIE : public CmdLens
00114 {
00115 public:
00116         CmdLensSIE(const std::string &cmdname);
00117         ~CmdLensSIE();
00118         bool execute();
00119 private:
00120         shellp::ShellCmdRealArg *Varg,*Farg;
00121 };
00122 
00123 class CmdLensSIS : public CmdLens
00124 {
00125 public:
00126         CmdLensSIS(const std::string &cmdname);
00127         ~CmdLensSIS();
00128         bool execute();
00129 private:
00130         shellp::ShellCmdRealArg *Varg;
00131 };
00132 
00133 class CmdLensMassSheetDegeneracy : public shellp::ShellCommand
00134 {
00135 public:
00136         CmdLensMassSheetDegeneracy(const std::string &cmdName);
00137         ~CmdLensMassSheetDegeneracy();
00138         bool execute();
00139 private:
00140         shellp::ShellCmdRealArg *m_pDsArg;
00141         shellp::ShellCmdRealArg *m_pDdsArg;
00142         shellp::ShellCmdRealArg *m_pLambdaArg;
00143 };
00144 
00145 class CmdLensMassDiskDegeneracy : public shellp::ShellCommand
00146 {
00147 public:
00148         CmdLensMassDiskDegeneracy(const std::string &cmdName);
00149         ~CmdLensMassDiskDegeneracy();
00150         bool execute();
00151 private:
00152         shellp::ShellCmdRealArg *m_pDsArg;
00153         shellp::ShellCmdRealArg *m_pDdsArg;
00154         shellp::ShellCmdRealArg *m_pLambdaArg;
00155         shellp::ShellCmdRealArg *m_pCenterXArg;
00156         shellp::ShellCmdRealArg *m_pCenterYArg;
00157         shellp::ShellCmdRealArg *m_pAngularRadiusArg;
00158 };
00159 
00160 class CmdLensMassSheet : public CmdLens
00161 {
00162 public:
00163         CmdLensMassSheet(const std::string &cmdName);
00164         ~CmdLensMassSheet();
00165         bool execute();
00166 private:
00167         shellp::ShellCmdRealArg *m_pDsArg;
00168         shellp::ShellCmdRealArg *m_pDdsArg;
00169 };
00170 
00171 class CmdLensMassDisk : public CmdLens
00172 {
00173 public:
00174         CmdLensMassDisk(const std::string &cmdName);
00175         ~CmdLensMassDisk();
00176         bool execute();
00177 private:
00178         shellp::ShellCmdRealArg *m_pDsArg;
00179         shellp::ShellCmdRealArg *m_pDdsArg;
00180         shellp::ShellCmdRealArg *m_pAngularRadiusArg;
00181 };
00182 
00183 class CmdLensComposite : public shellp::ShellCommand
00184 {
00185 public:
00186         CmdLensComposite(const std::string &cmdName);
00187         ~CmdLensComposite();
00188         bool execute();
00189 private:
00190         std::vector<shellp::ShellCmdArg *> m_lensArgs;
00191         shellp::ShellCmdRealArg *m_pCenterXArg;
00192         shellp::ShellCmdRealArg *m_pCenterYArg;
00193         shellp::ShellCmdRealArg *m_pAngleArg;
00194         shellp::ShellCmdRealArg *m_pScaleArg;
00195         shellp::ShellCmdStringArg *m_pFileNameArg;
00196 };
00197 
00198 class CmdLensLoadSave : public shellp::ShellCommand
00199 {
00200 protected:
00201         CmdLensLoadSave(const std::string &cmdname);
00202 public:
00203         ~CmdLensLoadSave();
00204 protected:
00205         std::string GetFileName() const                                                 { return fnamearg->getValue(); }
00206 private:
00207         shellp::ShellCmdStringArg *fnamearg;
00208 };
00209 
00210 class CmdLensLoad : public CmdLensLoadSave
00211 {
00212 public:
00213         CmdLensLoad(const std::string &cmdname);
00214         ~CmdLensLoad();
00215         bool execute();
00216 };
00217 
00218 class CmdLensSave : public CmdLensLoadSave
00219 {
00220 public:
00221         CmdLensSave(const std::string &cmdname);
00222         ~CmdLensSave();
00223         bool execute();
00224 };
00225 
00226 class CmdLensPlot : public shellp::ShellCommand
00227 {
00228 public:
00229         CmdLensPlot(const std::string &cmdname);
00230         ~CmdLensPlot();
00231 protected:
00232         std::string GetFileName() const                                         { return fnamearg->getValue(); }
00233         double GetX1() const                                                    { return x1arg->getValue(); }
00234         double GetY1() const                                                    { return y1arg->getValue(); }
00235         double GetX2() const                                                    { return x2arg->getValue(); }
00236         double GetY2() const                                                    { return y2arg->getValue(); }
00237         int GetNumX() const                                                     { return numxarg->getValue(); }
00238         int GetNumY() const                                                     { return numyarg->getValue(); }
00239         
00240         shellp::ShellCmdStringArg *fnamearg;
00241         shellp::ShellCmdRealArg *x1arg,*y1arg,*x2arg,*y2arg;
00242         shellp::ShellCmdIntArg *numxarg,*numyarg;
00243 };
00244 
00245 class CmdLensPlotGnuplot : public CmdLensPlot
00246 {
00247 public:
00248         CmdLensPlotGnuplot(const std::string &cmdname);
00249         ~CmdLensPlotGnuplot();
00250         bool execute();
00251 private:
00252         shellp::ShellCmdBoolArg *arg3d,*colorarg;
00253         shellp::ShellCmdStringArg *xlabelarg,*ylabelarg;
00254 };
00255 
00256 class CmdLensPlotFITS : public CmdLensPlot
00257 {
00258 public:
00259         CmdLensPlotFITS(const std::string &cmdname);
00260         ~CmdLensPlotFITS();
00261         bool execute();
00262 };
00263 
00264 class CmdLensPlotProfile : public shellp::ShellCommand
00265 {
00266 public:
00267         CmdLensPlotProfile(const std::string &cmdname);
00268         ~CmdLensPlotProfile();
00269         bool execute();
00270 private:
00271         shellp::ShellCmdStringArg *fnamearg;
00272         shellp::ShellCmdRealArg *xarg;
00273         shellp::ShellCmdRealArg *yarg;
00274         shellp::ShellCmdRealArg *radiusarg;
00275         shellp::ShellCmdIntArg *rsteparg;
00276         shellp::ShellCmdIntArg *asteparg;
00277         shellp::ShellCmdBoolArg *flagarg;
00278 };
00279 
00280 class CmdLensAverage : public shellp::ShellCommand
00281 {
00282 public:
00283         CmdLensAverage(const std::string &cmdname);
00284         ~CmdLensAverage();
00285         bool execute();
00286 private:
00287         shellp::ShellCmdBoolArg *checkdistarg;
00288         std::vector<shellp::ShellCmdArg *> fileargs;
00289         shellp::ShellCmdStringArg *fnamearg;
00290 };
00291 
00292 class CmdLensSquare : public CmdLens
00293 {
00294 public:
00295         CmdLensSquare(const std::string &cmdname);
00296         ~CmdLensSquare();
00297         bool execute();
00298 private:
00299         shellp::ShellCmdRealArg *massarg;
00300         shellp::ShellCmdRealArg *widtharg;
00301 };
00302 
00303 class CmdLensMultipleSquares : public CmdLens
00304 {
00305 public:
00306         CmdLensMultipleSquares(const std::string &cmdname);
00307         ~CmdLensMultipleSquares();
00308         bool execute();
00309 private:
00310         shellp::ShellCmdStringArg *fnamearg;
00311         std::vector<shellp::ShellCmdArg *> squareargs;
00312         shellp::ShellCmdRealArg *massarg,*widtharg,*xposarg,*yposarg;
00313 };
00314 
00315 class CmdLensMultipleSquaresFits : public CmdLens
00316 {
00317 public:
00318         CmdLensMultipleSquaresFits(const std::string &cmdname);
00319         ~CmdLensMultipleSquaresFits();
00320         bool execute();
00321 private:
00322         shellp::ShellCmdStringArg *m_pFileArg;
00323         shellp::ShellCmdRealArg *m_pWidthArg;
00324         shellp::ShellCmdRealArg *m_pTotalMassArg;
00325 };
00326 
00327 class CmdLensMultipleGaussians : public CmdLens
00328 {
00329 public:
00330         CmdLensMultipleGaussians(const std::string &cmdname);
00331         ~CmdLensMultipleGaussians();
00332         bool execute();
00333 private:
00334         shellp::ShellCmdStringArg *fnamearg;
00335         std::vector<shellp::ShellCmdArg *> squareargs;
00336         shellp::ShellCmdRealArg *massarg,*widtharg,*xposarg,*yposarg;
00337 };
00338 
00339 class CmdLensMultipleWendland : public CmdLens
00340 {
00341 public:
00342         CmdLensMultipleWendland(const std::string &cmdName);
00343         ~CmdLensMultipleWendland();
00344         bool execute();
00345 private:
00346         shellp::ShellCmdStringArg *m_pFileNameArg;
00347         std::vector<shellp::ShellCmdArg *> m_params;
00348         shellp::ShellCmdBoolArg *m_pFlagArg;
00349         shellp::ShellCmdRealArg *m_pHeightArg, *m_pAngularScaleArg, *m_pXArg, *m_pYArg;
00350 };
00351 
00352 class CmdLensScaleDegeneracy : public CmdLens
00353 {
00354 public:
00355         CmdLensScaleDegeneracy(const std::string &cmdName);
00356         ~CmdLensScaleDegeneracy();
00357         bool execute();
00358 private:
00359         static void Interpolate(std::vector<double> &points, int refIndex, int stopIndex);
00360         
00361         shellp::ShellCmdRealArg *m_pCenterXArg;
00362         shellp::ShellCmdRealArg *m_pCenterYArg;
00363 };
00364 
00365 class CmdLensGetLensPlane : public shellp::ShellCommand
00366 {
00367 public:
00368         CmdLensGetLensPlane(const std::string &cmdName);
00369         ~CmdLensGetLensPlane();
00370         bool execute();
00371 };
00372 
00373 class CmdLensGetImagePlane : public shellp::ShellCommand
00374 {
00375 public:
00376         CmdLensGetImagePlane(const std::string &cmdName);
00377         ~CmdLensGetImagePlane();
00378         bool execute();
00379 };
00380 
00381 class CmdLensGetLensPlaneGrid : public shellp::ShellCommand
00382 {
00383 public:
00384         CmdLensGetLensPlaneGrid(const std::string &cmdName);
00385         ~CmdLensGetLensPlaneGrid();
00386         bool execute();
00387 };
00388 
00389 class CmdLensTimeDelayAdjust : public CmdLens
00390 {
00391 public:
00392         CmdLensTimeDelayAdjust(const std::string &cmdName);
00393         ~CmdLensTimeDelayAdjust();
00394         bool execute();
00395 private:
00396         shellp::ShellCmdRealArg *m_pTimeDiffArg;
00397         shellp::ShellCmdRealArg *m_pLensZArg;
00398         shellp::ShellCmdRealArg *m_pThetaStopArg;
00399         shellp::ShellCmdRealArg *m_pThetaStartArg;
00400 };
00401 
00402 class CmdLensMagnificationAdjust : public shellp::ShellCommand
00403 {
00404 public:
00405         CmdLensMagnificationAdjust(const std::string &cmdName);
00406         ~CmdLensMagnificationAdjust();
00407         bool execute();
00408 private:
00409         shellp::ShellCmdRealArg *m_pXArg;
00410         shellp::ShellCmdRealArg *m_pYArg;
00411         shellp::ShellCmdRealArg *m_pTargetMagnificationArg;
00412         shellp::ShellCmdRealArg *m_pMaxWidthArg;
00413         shellp::ShellCmdRealArg *m_pPotentialScaleArg;
00414         shellp::ShellCmdBoolArg *m_pConstantTimeDelayArg;
00415 
00416 };
00417 
00418 class CmdLensTestLens : public CmdLens
00419 {
00420 public:
00421         CmdLensTestLens(const std::string &cmdName);
00422         ~CmdLensTestLens();
00423         bool execute();
00424 };
00425 
00426 class CmdLensNFW : public CmdLens
00427 {
00428 public:
00429         CmdLensNFW(const std::string &cmdname);
00430         ~CmdLensNFW();
00431         bool execute();
00432 private:
00433         shellp::ShellCmdRealArg *m_pDensScale;
00434         shellp::ShellCmdRealArg *m_pAngularRadiusScale;
00435 };
00436 
00437 class CmdLensEllipticNFW : public CmdLens
00438 {
00439 public:
00440         CmdLensEllipticNFW(const std::string &cmdname);
00441         ~CmdLensEllipticNFW();
00442         bool execute();
00443 private:
00444         shellp::ShellCmdRealArg *m_pDensScale;
00445         shellp::ShellCmdRealArg *m_pAngularRadiusScale;
00446         shellp::ShellCmdRealArg *m_pEllipticityArg;
00447 };
00448 
00449 class CmdLensSersic : public CmdLens
00450 {
00451 public:
00452         CmdLensSersic(const std::string &cmdname);
00453         ~CmdLensSersic();
00454         bool execute();
00455 private:
00456         shellp::ShellCmdRealArg *m_pDensScaleArg;
00457         shellp::ShellCmdRealArg *m_pAngularScaleArg;
00458         shellp::ShellCmdRealArg *m_pSersicIndexArg;
00459 };
00460 
00461 class CmdLensEllipticSersic : public CmdLens
00462 {
00463 public:
00464         CmdLensEllipticSersic(const std::string &cmdname);
00465         ~CmdLensEllipticSersic();
00466         bool execute();
00467 private:
00468         shellp::ShellCmdRealArg *m_pDensScaleArg;
00469         shellp::ShellCmdRealArg *m_pAngularScaleArg;
00470         shellp::ShellCmdRealArg *m_pSersicIndexArg;
00471         shellp::ShellCmdRealArg *m_pEllipticityArg;
00472 };
00473 
00474 #endif // CMDLENSES_H
00475