GLAlgorithm Class Reference

General Lensing Algorithm. More...

#include <glellipse.h>


Public Member Functions

 GLAlgorithm ()
 Default Constructor.
 GLAlgorithm (double *observationParameters, double *lensParameters, double *sourceParameters, DensityProfile *density, Plane< Double > *_sourcePlane, int *glellipseBounds=0, double *offset=0)
 Parameter based constructor.
 GLAlgorithm (DensityProfile *density, double *sourceParameters, Plane< Double > *_sourcePlane, int *glellipseBounds=0, double *offset=0)
 Lens Density and Source based constructor.
 GLAlgorithm (Plane< math::Complex > *newDeflectionMap, double *observationParameters, double *sourceParameters, Plane< Double > *_sourcePlane)
 Deflection angle array based constructor.
 ~GLAlgorithm ()
 Destructor.
double * newLocation (double x, double y)
 Gives the point in the source frame the point (x,y) would be lensed to.
math::Complex deflection (double x, double y, double *offset)
 Gives the amount of deflection.
Double mapsToSource (double x, double y)
 Checks to see whether the point (x,y) maps to a source, if so, returns it's mass.
double massInElement (const double x, const double y) const
 Reads the source plane and give the mass in that space.
bool isLensMassElement (const double x, const double y) const
 Determines whether there is lens mass at the point (x,y).
bool createDeflectionMapPlane (int _leftBound=-1, int _rightBound=-1, int _lowerBound=-1, int _upperBound=-1, double *offset=0)
 Creates a plane creating the deflection angles.
Plane< math::Complex > * getDeflectionPlane ()
 Returns a pointer to the deflection plane.

Static Public Member Functions

static double abs (const double x)
 Absolute value of x.

Private Attributes

double * observationParameters
double * lensParameters
double * sourceParameters
DensityProfilemassDensity
Plane< math::Complex > * deflectionMap
Plane< Double > * sourcePlane


Detailed Description

General Lensing Algorithm.

This class handles lensing information and calculations. Created By David Coss, 2007


Constructor & Destructor Documentation

GLAlgorithm::GLAlgorithm (  ) 

Default Constructor.

All pointers set to null.

References deflectionMap, lensParameters, massDensity, observationParameters, sourceParameters, and sourcePlane.

GLAlgorithm::GLAlgorithm ( double *  observationParameters,
double *  lensParameters,
double *  sourceParameters,
DensityProfile density,
Plane< Double > *  _sourcePlane,
int *  glellipseBounds = 0,
double *  offset = 0 
)

Parameter based constructor.

This constructor should be used if the deflection angles have not yet been calculated.

Parameters:
observationParameters Set of General paramters (eg speed of light, solar mass).
lensParameters Lens Parameters (eg size, location).
sourceParameters Source parameters.
density DensityProfile (usually to be calculated by this constructor).
_sourcePlane Plane containing the sources.

References createDeflectionMapPlane(), deflectionMap, massDensity, and sourcePlane.

GLAlgorithm::GLAlgorithm ( DensityProfile density,
double *  sourceParameters,
Plane< Double > *  _sourcePlane,
int *  glellipseBounds = 0,
double *  offset = 0 
)

Lens Density and Source based constructor.

This is used if the density profile has already been calculated.

Parameters:
density DensityProfile of the lens.
sourceParameters Parameters of the source.
_sourcePlane The sources.

References createDeflectionMapPlane(), deflectionMap, DensityProfile::getLensParameters(), DensityProfile::getObservationParameters(), lensParameters, massDensity, observationParameters, sourceParameters, and sourcePlane.

GLAlgorithm::GLAlgorithm ( Plane< math::Complex > *  newDeflectionMap,
double *  observationParameters,
double *  sourceParameters,
Plane< Double > *  _sourcePlane 
)

Deflection angle array based constructor.

This constructor should be used the most. It is suggested (for speed of simulation) that he deflection angles be calculated, saved, and then reused as need. This construct provides deflection planes, via newDeflectionMap, to be used once calculated. Note: the 2 dimensional deflections are stored as Complex numbers with the horizontal and vertical deflections as the Real and Imaginary Parts, respectively.

Parameters:
newDeflectionMap Complex Deflections Plane
observationParameters General observation Parameters.
sourceParameters Source Parameters.
_sourcePlane Source Plane.

References deflectionMap, lensParameters, massDensity, and sourcePlane.

GLAlgorithm::~GLAlgorithm (  ) 

Destructor.

This destructor only sets the pointers to null, since they may be used in other parts of the program. So if they should be deleted, delete the outside of glalgorithm.

References lensParameters, massDensity, observationParameters, sourceParameters, and sourcePlane.


Member Function Documentation

static double GLAlgorithm::abs ( const double  x  )  [inline, static]

Absolute value of x.

Referenced by deflection(), and mapsToSource().

bool GLAlgorithm::createDeflectionMapPlane ( int  _leftBound = -1,
int  _rightBound = -1,
int  _lowerBound = -1,
int  _upperBound = -1,
double *  offset = 0 
)

Creates a plane creating the deflection angles.

If the plane was created correctly, true is returned. X and Y bounds were added to allow for parallel computing. The deflection map can be calculated a portion at a time. Then those portions may be added together to form a final grid.

Returns:
bool.
See also:
getDeflectionPlane()

References deflection(), deflectionMap, lensParameters, massDensity, observationParameters, Plane< T >::setValue(), sourceParameters, and VERBOSE_PRINT.

Referenced by GLAlgorithm().

math::Complex GLAlgorithm::deflection ( double  x,
double  y,
double *  offset 
)

Gives the amount of deflection.

The Deflection is given as Complex numbers with the horizontal and vertical deflections as the Real and Imaginary Parts, respectively.

offset is a 2-D vector containing the x and y offsets respectively. If offset = 0, then there is no offset. So offset can be null. Offset is a pixel offset (ie must match x and y's units).

Parameters:
x horizontal position in pixels from corner (zero indexed).
y vertical position in pixels from corner (zero indexed).
Returns:
Complex

These parameters are need from the file.

deflection is measured in arcseconds

References abs(), Cosmology::arcsecondsToCentimeters(), isLensMassElement(), lensParameters, massInElement(), and observationParameters.

Referenced by createDeflectionMapPlane().

Plane<math::Complex>* GLAlgorithm::getDeflectionPlane (  )  [inline]

Returns a pointer to the deflection plane.

Returns:
Plane<math::Complex>*
See also:
createDeflectionMapPlane()

References deflectionMap.

bool GLAlgorithm::isLensMassElement ( const double  x,
const double  y 
) const

Determines whether there is lens mass at the point (x,y).

Parameters:
x horizontal position.
y vertical position.
Returns:
bool.

References DensityProfile::isMassAtPoint(), and massDensity.

Referenced by deflection().

Double GLAlgorithm::mapsToSource ( double  x,
double  y 
)

Checks to see whether the point (x,y) maps to a source, if so, returns it's mass.

x and y in arcseconds.

Parameters:
x horizontal location
y vertical location.
Returns:
Double mass at source location.

References abs(), Plane< T >::getValue(), newLocation(), observationParameters, sourceParameters, and sourcePlane.

double GLAlgorithm::massInElement ( const double  x,
const double  y 
) const

Reads the source plane and give the mass in that space.

Parameters:
x horizontal position.
y vertical position.
Returns:
double mass at that position.

References DensityProfile::massAtPoint(), and massDensity.

Referenced by deflection().

double * GLAlgorithm::newLocation ( double  x,
double  y 
)

Gives the point in the source frame the point (x,y) would be lensed to.

Parameters:
x horizontal position in pixels from corner (zero indexed).
y vertical position in pixels from corner (zero indexed).

References deflectionMap, Plane< T >::getValue(), and observationParameters.

Referenced by mapsToSource().


Field Documentation

Plane<math::Complex>* GLAlgorithm::deflectionMap [private]

double* GLAlgorithm::lensParameters [private]

double* GLAlgorithm::sourceParameters [private]

Plane<Double>* GLAlgorithm::sourcePlane [private]


The documentation for this class was generated from the following files:

Generated on Sat Feb 6 12:43:20 2010 by  doxygen 1.5.7.1