GRALESHELL
|
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 GRALESHELLINSTANCE_H 00027 00028 #define GRALESHELLINSTANCE_H 00029 00030 #include "unittypes.h" 00031 #include <shellp/shellinstance.h> 00032 #include <stdint.h> 00033 #include <string> 00034 #include <list> 00035 #include <map> 00036 00037 namespace grale 00038 { 00039 class GravitationalLens; 00040 class ImagePlane; 00041 class LensPlane; 00042 class SourcePlane; 00043 class SourceImage; 00044 class ImagesDataExtended; 00045 class Grid; 00046 class Cosmology; 00047 class OpenCLKernel; 00048 class RandomNumberGenerator; 00049 } 00050 00051 class GraleShellGAParams; 00052 00053 class GraleShellInstance : public shellp::ShellInstance 00054 { 00055 public: 00056 GraleShellInstance(); 00057 ~GraleShellInstance(); 00058 00059 double GetAngularUnit() const { return getUnitMultiplier(UNIT_ANGULAR); } 00060 double GetMassUnit() const { return getUnitMultiplier(UNIT_MASS); } 00061 double GetDistanceUnit() const { return getUnitMultiplier(UNIT_DISTANCE); } 00062 void SetAngularUnit(double u) { setUnitMultiplier(UNIT_ANGULAR, u); } 00063 void SetMassUnit(double u) { setUnitMultiplier(UNIT_MASS, u); } 00064 void SetDistanceUnit(double u) { setUnitMultiplier(UNIT_DISTANCE, u); } 00065 00066 grale::GravitationalLens *GetLens() { return lens; } 00067 grale::ImagePlane *GetImagePlane() { return imgplane; } 00068 grale::LensPlane *GetLensPlane() { return lensplane; } 00069 grale::SourcePlane *GetSourcePlane() { return srcplane; } 00070 grale::SourceImage *GetSource(uint16_t i) { std::map<uint16_t, grale::SourceImage *>::iterator it = sources.find(i); if (it == sources.end()) return 0; return (*it).second; } 00071 grale::ImagesDataExtended *GetImagesData() { return imagesdata; } 00072 void GetImagesDataList(std::list<grale::ImagesDataExtended *> &imgslist){ imgslist = imagesdatalist; } 00073 grale::Grid *GetGrid() { return grid; } 00074 GraleShellGAParams *GetGAParams() const { return gaparams; } 00075 grale::Cosmology *GetCosmology() { return m_pCosmology; } 00076 grale::OpenCLKernel *GetOpenCLKernel() { return m_pOpenCLKernel; } 00077 00078 void SetLens(grale::GravitationalLens *l); 00079 void SetSourcePlane(grale::SourcePlane *s, bool deletesources = true); 00080 void SetImagePlane(grale::ImagePlane *i); 00081 void SetLensPlane(grale::LensPlane *lp); 00082 void SetSource(uint16_t i, grale::SourceImage *s); 00083 void SetImagesData(grale::ImagesDataExtended *imgsdata); 00084 void AddToImagesDataList(grale::ImagesDataExtended *imgsdata); 00085 void ClearSources(); 00086 void ClearImagesDataList(); 00087 void SetGrid(grale::Grid *g); 00088 void SetGAParams(GraleShellGAParams *p); 00089 void SetCosmology(grale::Cosmology *pCosmology); 00090 void SetOpenCLKernel(grale::OpenCLKernel *pCLKernel); 00091 00092 const grale::RandomNumberGenerator *GetRandomNumberGenerator() const { return m_pRndGen; } 00093 private: 00094 bool FindSource(grale::SourceImage *s); 00095 bool FindImagesData(grale::ImagesDataExtended *i); 00096 00097 grale::GravitationalLens *lens; 00098 grale::ImagePlane *imgplane; 00099 grale::LensPlane *lensplane; 00100 grale::SourcePlane *srcplane; 00101 std::map<uint16_t, grale::SourceImage *> sources; 00102 grale::ImagesDataExtended *imagesdata; 00103 std::list<grale::ImagesDataExtended *> imagesdatalist; 00104 grale::Grid *grid; 00105 GraleShellGAParams *gaparams; 00106 grale::Cosmology *m_pCosmology; 00107 grale::OpenCLKernel *m_pOpenCLKernel; 00108 grale::RandomNumberGenerator *m_pRndGen; 00109 }; 00110 00111 #endif // GRALESHELLINSTANCE_H 00112