GLAMERDOC++
Gravitational Lensing Code Library
|
9 #ifndef __GLAMER__gridmap__
10 #define __GLAMER__gridmap__
16 #include "concave_hull.h"
35 GridMap(
LensHndl lens,
unsigned long N1d,
const double center[2],
double range);
36 GridMap(
LensHndl lens ,
unsigned long Nx ,
const PosType center[2] ,PosType rangeX ,PosType rangeY);
38 GridMap(
unsigned long N1d,
const double center[2],
double range);
76 void ClearSurfaceBrightnesses();
78 size_t getNumberOfPoints()
const {
return Ngrid_init*Ngrid_init2;}
84 double getYRange()
const {
return x_range*axisratio;}
100 ,std::string filename
124 Point_2d getCenter(){
return center;}
126 Point * operator[](
size_t i){
return i_points.data() + i;};
130 Ngrid_init = grid.Ngrid_init;
131 Ngrid_init2 = grid.Ngrid_init2;
132 pointID = grid.pointID;
133 axisratio = grid.axisratio;
134 x_range = grid.x_range;
136 std::swap(i_points,grid.i_points);
137 std::swap(s_points,grid.s_points);
139 center = grid.center;
144 Ngrid_init = grid.Ngrid_init;
145 Ngrid_init2 = grid.Ngrid_init2;
146 pointID = grid.pointID;
147 axisratio = grid.axisratio;
148 x_range = grid.x_range;
150 i_points = grid.i_points;
151 s_points = grid.s_points;
153 center = grid.center;
157 Ngrid_init = grid.Ngrid_init;
158 Ngrid_init2 = grid.Ngrid_init2;
159 pointID = grid.pointID;
160 axisratio = grid.axisratio;
161 x_range = grid.x_range;
163 std::swap(i_points,grid.i_points);
164 std::swap(s_points,grid.s_points);
166 center = grid.center;
172 Triangle(
size_t i,
size_t j,
size_t k){
178 size_t & operator[](
int i){
return index[i];}
187 std::list<RAY> find_images(std::vector<Point_2d> &ys
188 ,std::vector<int> &multiplicity
194 ,std::vector<Point_2d> &image_points
195 ,std::vector<Triangle> &triangles
207 ,std::vector<bool> &hits_edge
210 size_t N=Ngrid_init*Ngrid_init2;
211 std::vector<Point_2d> source_points(N);
212 for(
size_t i=0 ; i<N ; ++i) source_points[i] = i_points[i];
214 std::vector<int> multiplicities(N);
215 find_images(source_points,multiplicities);
217 std::vector<bool> bitmap(N,
false);
218 for(
size_t i=0 ; i<N ; ++i){
219 if(multiplicities[i] > 1) bitmap[i] =
true;
222 Utilities::find_boundaries<Point_2d>(bitmap,Ngrid_init,boundaries,hits_edge);
290 void find_crit(std::vector<std::vector<Point_2d> > &points
291 ,std::vector<bool> &hits_boundary
292 ,std::vector<CritType> &crit_type
321 bool incurve(
long k,std::vector<Point_2d> &curve)
const;
324 std::vector<Point> NewPointArray(
size_t N){
325 std::vector<Point> p(N);
330 void xygridpoints(
Point *points,
double range,
const double *center,
long Ngrid
331 ,
short remove_center);
337 unsigned long pointID;
342 std::vector<Point> i_points;
343 std::vector<Point> s_points;
346 bool to_refine(
long i,
long j,
double total,
double f)
const ;
347 static std::mutex grid_mutex;
349 void _find_images_(
Point_2d *ys,
int *multiplicity,
long Nys,std::list<RAY> &rays)
const;
352 void limited_image_search(
Point_2d &y
353 ,std::vector<size_t> &cell_numbers
354 ,std::vector<Triangle> &triangles
358 #endif // defined(__GLAMER__gridmap__)
void writePixelMapUniform(PixelMap &map, LensingVariable lensvar)
Definition: gridmap.cpp:463
PosType EinsteinArea() const
returns the area (radians^2) of the region with negative magnification at resolution of fixed grid
Definition: gridmap.cpp:630
Base class for all sources.
Definition: source.h:45
double getXRange() const
return initial range of gridded region. This is the distance from the first ray in a row to the last ...
Definition: gridmap.h:83
Point_2d centroid() const
returns centroid of flux on the grid
Definition: gridmap.cpp:1246
PixelMap getPixelMapFlux(int res) const
returns a PixelMap with the flux in pixels at a resolution of res times the original resolution
Definition: gridmap.cpp:172
void printFITS(std::string filename, bool Xflip=false, bool verbose=false)
Output the pixel map as a fits file.
Definition: pixelize.cpp:1248
Point_2d source_point(size_t index)
get the image point for a index number
Definition: gridmap.h:74
Class for representing points or vectors in 2 dimensions. Not that the dereferencing operator is over...
Definition: point.h:48
void deLens()
resets to state without lensing
Definition: gridmap.cpp:158
A simplified version of the Grid structure for making non-adaptive maps of the lensing quantities (ka...
Definition: gridmap.h:31
double magnificationTr() const
calculate the LOCAL magnification by triangel method weighted by interpolated surface brightness
Definition: gridmap.cpp:662
void find_boundaries_of_caustics(std::vector< std::vector< Point_2d > > &boundaries, std::vector< bool > &hits_edge)
finds the boundary of the region on the source plane where there are more than one image
Definition: gridmap.h:206
PosType magnificationFlux(Source &source) const
Definition: gridmap.cpp:651
void writeFits(LensingVariable lensvar, std::string filensame)
fits output of lensing quantities at the resolution of the GridMap
Definition: gridmap.cpp:384
double AddPointSource(const Point_2d &y, double flux)
add flux to the rays that are nearest to the source on the source plane for each image
Definition: gridmap.cpp:773
GridMap ReInitialize(LensHndl lens)
reshoot the rays for example when the source plane has been changed
Definition: gridmap.cpp:144
Point_2d image_point(size_t index)
get the image point for a index number
Definition: gridmap.h:72
int getInitNgrid() const
return initial number of grid points in each direction
Definition: gridmap.h:81
double getResolution() const
resolution in radians, this is range / (N-1)
Definition: gridmap.h:86
void find_crit(std::vector< std::vector< Point_2d > > &points, std::vector< bool > &hits_boundary, std::vector< CritType > &crit_type)
Find critical curves. This is usually not used outside of ImageFinding::find_crit()
Definition: gridmap.cpp:801
double AdaptiveRefreshSurfaceBrightnesses(Lens &lens, Source &source)
Definition: gridmap.cpp:257
GridMap(LensHndl lens, unsigned long N1d, const double center[2], double range)
Constructor for initializing square grid.
Definition: gridmap.cpp:89
void writeFitsUniform(const PosType center[], size_t Nx, size_t Ny, LensingVariable lensvar, std::string filename)
Definition: gridmap.cpp:549
double RefreshSurfaceBrightnesses(SourceHndl source)
Recalculate surface brightness at every point without changing the positions of the gridmap or any le...
Definition: gridmap.cpp:242
PixelMap writePixelMap(LensingVariable lensvar)
make pixel map of lensing quantities at the resolution of the GridMap
Definition: gridmap.cpp:392
A point on the source or image plane that contains a position and the lensing quantities.
Definition: point.h:414
Image structure that can be manipulated and exported to/from fits files.
Definition: image_processing.h:48
LensingVariable
output lensing variables
Definition: standard.h:89
double AddSurfaceBrightnesses(SourceHndl source)
Recalculate surface brightness just like GridMap::RefreshSurfaceBrightness but the new source is adde...
Definition: gridmap.cpp:328
Lens & operator=(Lens &&lens)
Definition: lens.h:513
void writeFitsUniform(LensingVariable lensvar, std::string filename)
this will make a fits map of the grid as is.
Definition: gridmap.h:98
A class to represents a lens with multiple planes.
Definition: lens.h:71
double AreaCellOnSourcePlane(size_t k) const
area of a cell (pixel size region with its lower left at point k) on source plane - calculated by tri...
Definition: gridmap.cpp:759