Gyoto
|
A null geodesic transporting light. More...
#include <GyotoPhoton.h>
Classes | |
class | Refined |
Refine last step of integration in a Photon. More... |
Public Member Functions | |
virtual std::string | className () const |
"Photon" | |
virtual std::string | className_l () const |
"photon" | |
Photon () | |
Default constructor. | |
Photon (const Photon &) | |
Copy constructor. | |
Photon * | clone () const |
Photon (SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, double *coord) | |
same as Photon() followed by setInitialCondition() | |
Photon (SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, SmartPointer< Screen > screen, double d_alpha, double d_delta) | |
same as Photon() followed by setInitialCondition() | |
virtual | ~Photon () |
Destructor. | |
virtual double | getMass () const |
Return 0. | |
void | setAstrobj (SmartPointer< Astrobj::Generic >) |
Set Astrobj. | |
SmartPointer< Astrobj::Generic > | getAstrobj () const |
Get Astrobj. | |
void | setSpectrometer (SmartPointer< Spectrometer > spr) |
SmartPointer< Spectrometer > | getSpectrometer () const |
double | getFreqObs () const |
void | operator= (const Photon &) |
Assignment to another Photon. | |
void | setInitialCondition (SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, const double coord[8]) |
Set or re-set the initial condition prior to integration. | |
void | setInitialCondition (SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, SmartPointer< Screen > screen, double d_alpha, double d_delta) |
Set or re-set the initial condition prior to integration. | |
int | hit (Astrobj::Properties *data=NULL) |
Integrate the geodesic and tell whether this photon hits the object. | |
double | findMin (Functor::Double_constDoubleArray *object, double t1, double t2, double &tmin, double threshold=DBL_MIN) |
Find minimum of photon–object distance. | |
void | findValue (Functor::Double_constDoubleArray *object, double value, double tinside, double &toutside) |
Find date for which the photon is at a given distance from the object. | |
void | fillElement (FactoryMessenger *fmp) |
called from Factory | |
void | resetTransmission () |
double | getTransmission (size_t i) const |
get transmission for freqobs | |
double const * | getTransmission () const |
get pointer to transmission array | |
virtual void | transmit (size_t i, double t) |
int | getImin () const |
int | getImax () const |
int | getI0 () const |
void | setMetric (SmartPointer< Metric::Generic >) |
Set metric Smartpointer. | |
SmartPointer< Metric::Generic > | getMetric () const |
Get metric. | |
void | setInitCoord (const double coord[8], int dir=0) |
Set Initial coordinate. | |
void | reset () |
Forget integration, keeping initial contition. | |
void | setDelta (const double delta) |
Set delta. | |
double | getTlim () const |
Get tlim value. | |
void | setTlim (double tlim) |
Set tlim to a given value. | |
double const * | getCst () const |
Returns the worldline's cst of motion (if any) | |
void | setCst (double const *cst, size_t const ncsts) |
void | setInitialCondition (SmartPointer< Metric::Generic > gg, const double coord[8], const int dir) |
Set or re-set the initial condition prior to integration. | |
void | getInitialCoord (double dest[8]) const |
get initial coordinate | |
void | getCoord (size_t index, double dest[8]) const |
get coordinates corresponding to index | |
void | getCoord (double const *const dates, size_t const n_dates, double *const x1dest, double *const x2dest, double *const x3dest, double *const x0dot=NULL, double *const x1dot=NULL, double *const x2dot=NULL, double *const x3dot=NULL) |
void | getCoord (double *x0, double *x1, double *x2, double *x3) const |
void | getCartesianPos (size_t index, double dest[4]) const |
get Cartesian expression of 4-position at index. | |
void | xFill (double tlim) |
Fill x0, x1... by integrating the Worldline from previously set inittial condition to time tlim. | |
int | get_nelements () const |
void | get_t (double *dest) const |
void | getCartesian (double const *const dates, size_t const n_dates, double *const x, double *const y, double *const z, double *const xprime=NULL, double *const yprime=NULL, double *const zprime=NULL) |
void | get_xyz (double *x, double *y, double *z) const |
void | getSkyPos (SmartPointer< Screen > screen, double *dalpha, double *ddellta, double *dD) const |
void | get_dot (double *x0dot, double *x1dot, double *x2dot, double *x3dot) const |
void | get_prime (double *x1prime, double *x2prime, double *x3prime) const |
void | save_txyz (char *fichierxyz) const |
Save in a file. | |
void | save_txyz (char *const filename, double const t1, double const mass_sun, double const distance_kpc, std::string const unit, SmartPointer< Screen > sc=NULL) |
Save, converted. |
Protected Types | |
typedef Gyoto::SmartPointer < Gyoto::SmartPointee > | Subcontractor_t (Gyoto::FactoryMessenger *) |
A subcontractor builds an object upon order from the Factory. |
Protected Member Functions | |
Photon (Photon *orig, size_t i0, int dir, double step_max) | |
Used by Photon::Refined::Refined. | |
void | xAllocate () |
Allocate x0, x1 etc. with default size. | |
void | xAllocate (size_t size) |
Allocate x0, x1 etc. with a specified size. | |
size_t | xExpand (int dir) |
Expand x0, x1 etc... to hold more elements. | |
void | incRefCount () |
Increment the reference counter. Warning: Don't mess with the counter. | |
int | decRefCount () |
Decrement the reference counter and return current value. Warning: Don't mess with the counter. | |
int | getRefCount () |
Get the current number of references. |
Protected Attributes | |
SmartPointer < Gyoto::Astrobj::Generic > | object_ |
The astronomical target. | |
double | freq_obs_ |
Photon's frequency in observer's frame. | |
double | transmission_freqobs_ |
integrated optical transmission | |
SmartPointer< Spectrometer > | spectro_ |
double * | transmission_ |
SmartPointer < Gyoto::Metric::Generic > | metric_ |
The Gyoto::Metric in this part of the universe. | |
double * | x0_ |
t or T | |
double * | x1_ |
r or x | |
double * | x2_ |
theta or y | |
double * | x3_ |
phi or z | |
double * | x0dot_ |
tdot or Tdot | |
double * | x1dot_ |
rdot or xdot | |
double * | x2dot_ |
thetadot or ydot | |
double * | x3dot_ |
phidot or zdot | |
size_t | x_size_ |
Size of x0, x1... arrays. | |
size_t | imin_ |
Minimum index for which x0, x1... have been computed. | |
size_t | i0_ |
Index of initial condition in array. | |
size_t | imax_ |
Maximum index for which x0, x1... have been computed. | |
double | delta_ |
Initial integrating step ; defaults to 0.01. | |
double | tlim_ |
Minimum time for integration, stop integration if t<tlim ; defaults to 0. | |
double * | cst_ |
Worldline's csts of motion (if any) | |
size_t | cst_n_ |
Number of constants of motion. |
Private Member Functions | |
void | _allocateTransmission () |
Friends | |
class | Gyoto::SmartPointer< Gyoto::Photon > |
A null geodesic transporting light.
This is the central object for ray-tracing.
|
inherited |
A subcontractor builds an object upon order from the Factory.
Various classes need to provide a subcontractor to be able to instanciate themselves upon order from the Factory. A subcontractor is a function (often a static member function) which accepts a pointer to a FactoryMessenger as unique parameter, communicates with the Factory using this messenger to read an XML description of the object to build, and returns this objet. SmartPointee::Subcontractor_t* is just generic enough a typedef to cast to and from other subcontractor types: Astrobj::Subcontractor_t, Metric::Subcontractor_t, Spectrum::Subcontractor_t. A subcontractor needs to be registered using the relevant Register() function: Astrobj::Register(), Metric::Register(), Spectrum::Register().
Gyoto::Photon::Photon | ( | ) |
Default constructor.
Allocates the default size (GYOTO_DEFAULT_X_SIZE) for x1, x2 etc.
double Gyoto::Photon::findMin | ( | Functor::Double_constDoubleArray * | object, |
double | t1, | ||
double | t2, | ||
double & | tmin, | ||
double | threshold = DBL_MIN |
||
) |
Find minimum of photon–object distance.
Return the minimum of object->Astrobj::operator()(this->getCoord()) between t1 and t2. The date of this minimum is returned in tmin.
object | the distance to minimize is given by object->Astrobj::operator()() |
t1 | date |
t2 | date |
tmin | on output, date correspondig to the minimum |
threshold | stop searching for a minimum if a value < threshold is found (very often, we just want to find a date below the threshold, not the accurate minimum). |
void Gyoto::Photon::findValue | ( | Functor::Double_constDoubleArray * | object, |
double | value, | ||
double | tinside, | ||
double & | toutside | ||
) |
Find date for which the photon is at a given distance from the object.
object | the object |
value | the value to find |
a | date for which object->Astrobj::operator()(Photon::getCoord()) is < value |
on | input: a date for which object->Astrobj::operator()(Photon::getCoord()) is > value. on output, (*object)(getCoord(toutside)) is < value, very close to value. toutside is closer to tinside on output than on input. |
|
inherited |
Get the 6 Cartesian coordinates (x, y, z, dx/dt, dy/dt, dz/dt) for specific dates. The coordinates will be computed using the integrator, so they will be as accurate as possible. Transforming to Cartesian coordinates is not necessarily meaningful.
dates,: | the list of dates for which the coordinates are to be computed; |
n_dates,: | the number of dates to compute ; |
x*,: | arrays in which to store the result. These pointer may be set to NULL to retrieve only part of the information. They must be pre-allocated. |
Reimplemented in Gyoto::Astrobj::Star.
|
inherited |
Get 8-coordinates for spcific dates. The coordinates will be computed using the integrator, so they will be as accurate as possible. Some heuristics are used to speed up the process and it is presumably faster to call this routine with a sorted list of dates. The line will be integrated further as required. An error will be thrown if it is not possible to reach a certain date.
dates,: | the list of dates for which the coordinates are to be computed; |
n_dates,: | the number of dates to compute ; |
x*,: | arrays in which to store the result. These pointer may be set to NULL to retrieve only part of the information. They must be pre-allocated. |
|
inherited |
Get all the pre-computed 8 coordinates (e.g. thanks to a prior call to xFill()) of this worldline.
|
inherited |
Returns the worldline's cst of motion (if any)
Return pointer to array holding the previously set Metric-specific constants of motion
double Gyoto::Photon::getTransmission | ( | size_t | i | ) | const |
get transmission for freqobs
Get either the transmission at freqObs (with i=-1) or the transmission at spectro_->getMidpoints()[i].
i | channel number of the requested frequency, -1 for getFreqObs(). |
double const* Gyoto::Photon::getTransmission | ( | ) | const |
get pointer to transmission array
For i!=-1: getTansmission()[i] == getTransmission(size_t i)
void Gyoto::Photon::resetTransmission | ( | ) |
Set transmission to 1 for each channel as well as scalar transmission
|
inherited |
Set Metric-specific constants of motion
void Gyoto::Photon::setInitialCondition | ( | SmartPointer< Metric::Generic > | gg, |
SmartPointer< Astrobj::Generic > | obj, | ||
const double | coord[8] | ||
) |
Set or re-set the initial condition prior to integration.
Set initial condition for this Photon :
gg | : Gyoto::SmartPointer to the Gyoto::Metric in this universe; |
obj | : Gyoto::SmartPointer to the target Gyoto::Astrobj; |
coord | : 8 element array containing the initial condition, i.e. the 4-position and the 4-velocity of the Photon at the receiving end; |
void Gyoto::Photon::setInitialCondition | ( | SmartPointer< Metric::Generic > | gg, |
SmartPointer< Astrobj::Generic > | obj, | ||
SmartPointer< Screen > | screen, | ||
double | d_alpha, | ||
double | d_delta | ||
) |
Set or re-set the initial condition prior to integration.
Set initial condition for this Photon :
gg | Gyoto::SmartPointer to the Gyoto::Metric in this universe; |
obj | Gyoto::SmartPointer to the target Gyoto::Astrobj; |
t0 | Arrival date at observer's position |
d_alpha | Direction of arrival (RA offset) in radians |
d_delta | Direction of arrival (Dec offset) in radians |
|
inherited |
Set or re-set the initial condition prior to integration.
Set initial condition for this Photon :
gg | : Gyoto::SmartPointer to the Gyoto::Metric in this universe; |
coord | : 8 element array containing the initial condition, i.e. the 4-position and the 4-velocity of the Photon at the receiving end; |
sys | : an integer stating in which coordinate system coord is given. |
|
virtual |
Update transmission in a given channel:
getTransmission(size_t i) *= t.
i | channel number. -1 for getFreqObs(). |
t | transmission of this fluid element. |
Reimplemented in Gyoto::Photon::Refined.
|
protectedinherited |
Allocate x0, x1 etc. with default size.
The default size is GYOTO_DEFAULT_X_SIZE
|
protectedinherited |
Allocate x0, x1 etc. with a specified size.
size | : number of cells in each array x0, x1 etc. |
|
protectedinherited |
Expand x0, x1 etc... to hold more elements.
Double the size of arrays x0, x1 etc. and copy old version of the array in the first half if dir =1 and in the second half if dir =-1.
dir | : 1 to expand after last element, -1 to expand before first element |