Gyoto::Scenery Class Reference

Ray-tracing scene. More...

`#include <GyotoScenery.h>`

Inheritance diagram for Gyoto::Scenery:

## Public Types

enum | mpi_tag { give_task , read_scenery , terminate , raytrace , raytrace_done , ready , impactcoords , noimpactcoords }
| Tags that may be sent to communicate with workers using MPI_Send().
typedef Gyoto::SmartPointer< Gyoto::SmartPointee > | Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)
| A subcontractor builds an object upon order from the Factory.

## Public Member Functions

void | mpiSpawn (int nbchildren)
| Spawn gyoto-mpi-worker processes.
void | mpiTerminate ()
| Terminate worker processes.
void | mpiClone ()
| Send a copy of self to the mpi workers.
void | mpiTask (mpi_tag &tag)
| Send a tag to workers.
virtual Property const * | getProperties () const
| Get list of properties.
| Scenery ()
| Set everything to defaults.
| Scenery (const Scenery &o)
| Copy constructor.
Scenery * | clone () const
| Cloner.
| Scenery (SmartPointer< Metric::Generic >, SmartPointer< Screen >, SmartPointer< Astrobj::Generic >)
| Constructor setting Scenery::gg_, Scenery::screen_, and Scenery::obj_.
SmartPointer< Metric::Generic > | metric () const
| Get ph_.Worldline::metric_.
void | metric (SmartPointer< Metric::Generic >)
| Set Scenery::gg_.
SmartPointer< Screen > | screen () const
| Get Scenery::screen_.
void | screen (SmartPointer< Screen >)
| Set Scenery::screen_.
SmartPointer< Astrobj::Generic > | astrobj () const
| Get ph_.obj_.
void | astrobj (SmartPointer< Astrobj::Generic >)
| Set ph_.obj_.
SmartPointer< Photon > | clonePhoton () const
| Get clone of template Photon.
SmartPointer< Photon > | clonePhoton (size_t i, size_t j)
| Get clone of template Photon, intitializing it to pixel.
SmartPointer< Photon > | clonePhoton (double a, double d)
| Get clone of template Photon, intitializing it to direction.
void | updatePhoton ()
| Update values in cached Photon.
double | delta () const
| Get default step in geometrical units.
double | delta (const std::string &unit) const
| Get default step in specified units.
void | delta (double)
| set default step in geometrical units
void | delta (double, const std::string &unit)
| set default step in specified units
void | initCoord (std::vector< double > c)
std::vector< double > | initCoord () const
void | setRequestedQuantities (Quantity_t quant)
| Set Scenery::quantities_.
void | requestedQuantitiesString (std::string const &squant)
| Set Scenery::quantities_ from string.
Quantity_t | getRequestedQuantities () const
| Get Scenery::quantities_.
std::string | requestedQuantitiesString () const
| Get a string representation of Scenery::quantities_.
size_t | getScalarQuantitiesCount (Quantity_t *q=NULL) const
| Get number of requested quantities of scalar nature.
size_t | getSpectralQuantitiesCount (Quantity_t *q=NULL) const
| Get number of requested quantities of spectral nature.
double | tMin () const
| Get ph_.tmin_.
double | tMin (const std::string &unit) const
| Get ph_.tmin_ in specified unit.
void | tMin (double)
| Set ph_.tmin_.
void | tMin (double, const std::string &unit)
| Set ph_.tmin_ in specified unit.
void | adaptive (bool mode)
| Set ph_.adaptive_.
bool | adaptive () const
| Get ph_.adaptive_.
void | integrator (std::string type)
| Passed to ph_.
std::string | integrator () const
| Passed to ph_.
double | deltaMin () const
| Passed to ph_.
void | deltaMin (double h1)
| Passed to ph_.
double | deltaMax () const
| Passed to ph_.
void | deltaMax (double h1)
| Passed to ph_.
double | deltaMaxOverR () const
| Passed to ph_.
void | deltaMaxOverR (double t)
| Passed to ph_.
void | absTol (double)
| Passed to ph_.
double | absTol () const
| Passed to ph_.
void | relTol (double)
| Passed to ph_.
double | relTol () const
| Passed to ph_.
void | maxCrossEqplane (double)
| Passed to ph_.
double | maxCrossEqplane () const
| Passed to ph_.
void | secondary (bool sec)
| Set ph_.secondary_.
bool | secondary () const
| Get ph_.secondary_.
void | integ31 (bool integ)
| Set WorldlinIntegState integ_31_.
bool | integ31 () const
| Get WorldlinIntegState integ_31_.
void | parallelTransport (bool pt)
| Set ph_.parallel_transport_.
bool | parallelTransport () const
| Get ph_.parallel_transport_.
void | maxiter (size_t miter)
| Set ph_.maxiter_.
size_t | maxiter () const
| Get ph_.maxiter_.
void | nThreads (size_t)
| Set nthreads_;.
size_t | nThreads () const
| Get nthreads_;.
void | nProcesses (size_t)
| Set nprocesses_;.
size_t | nProcesses () const
| Get nprocesses_;.
void | intensityConverter (std::string unit)
| Set Scenery::intensity_converter_.
void | spectrumConverter (std::string unit)
| Set Scenery::spectrum_converter_.
void | binSpectrumConverter (std::string unit)
| Set Scenery::binspectrum_converter_.
void | setPropertyConverters (Gyoto::Astrobj::Properties *prop)
| Copy converters to Astrobj::Properties instance.
void | rayTrace (Screen::Coord2dSet &ij, Astrobj::Properties *data, double *impactcoords=NULL)
| Perform ray-tracing.
void | operator() (size_t i, size_t j, Astrobj::Properties *data, double *impactcoords=NULL, Photon *ph=NULL)
| Ray-trace a single pixel in Scenery::screen_.
void | operator() (double alpha, double delta, Astrobj::Properties *data, Photon *ph=NULL)
| Ray-trace single direction.
void | fillProperty (FactoryMessenger *fmp, Property const &p) const
| Output a single Property to XML.
void | fillElement (FactoryMessenger *fmp) const
| Fill the XML element for this Object.
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.
virtual bool | isThreadSafe () const
| Whether this class is thread-safe.
virtual void | set (Property const &p, Value val)
| Set Value of a Property.
virtual void | set (Property const &p, Value val, std::string const &unit)
| Set Value (expressed in unit) of a Property.
virtual void | set (std::string const &pname, Value val)
| Set Value of a Property.
virtual void | set (std::string const &pname, Value val, std::string const &unit)
| Set Value (expressed in unit) of a Property.
virtual Value | get (Property const &p) const
| Get Value of a Property.
virtual Value | get (std::string const &pname) const
| Get Value of a Property.
virtual Value | get (Property const &p, std::string const &unit) const
| Get Value of a Property, converted to unit.
virtual Value | get (std::string const &pname, std::string const &unit) const
| Get Value of a Property, converted to unit.
Property const * | property (std::string const pname) const
| Find property by name.
virtual void | setParameters (Gyoto::FactoryMessenger *fmp)
| Main loop for parsing Properties from XML description.
virtual int | setParameter (std::string name, std::string content, std::string unit)
| Set parameter by name.
virtual void | setParameter (Gyoto::Property const &p, std::string const &name, std::string const &content, std::string const &unit)
| Set parameter by Property (and name).
std::string | describeProperty (Gyoto::Property const &p) const
| Format desrciption for a property.
void | help () const
| Print (to stdout) some help on this class.
virtual std::string | kind () const
| Get kind_.

## Static Public Member Functions

static void | mpiWorker ()
| Become an MPI worker.
static SmartPointer< Scenery > | Subcontractor (Gyoto::FactoryMessenger *)
| Instanciate Scenery from an XML description.

## Public Attributes

| GYOTO_OBJECT_THREAD_SAFETY
boost::mpi::communicator * | mpi_team_
| Team of processes for MPI.
| GYOTO_WORLDLINE

## Static Public Attributes

static bool | am_worker
| True in instance of gyoto-mpi-worker, otherwise false.
static GYOTO_OBJECT Property const | properties []

## Protected Member Functions

virtual void | kind (const std::string)
| Set kind_.

## Protected Attributes

SmartPointer< Screen > | screen_
double | delta_
Gyoto::Quantity_t | quantities_
| Quantities to compute.
Gyoto::Photon | ph_
| Template Photon.
size_t | nthreads_
| Number of parallel threads to use in rayTrace().
int | nprocesses_
| Number of parallel processes to use in rayTrace().
Gyoto::SmartPointer< Gyoto::Units::Converter > | intensity_converter_
| See Astrobj::Properties::intensity_converter_.
Gyoto::SmartPointer< Gyoto::Units::Converter > | spectrum_converter_
| See Astrobj::Properties::intensity_converter_.
Gyoto::SmartPointer< Gyoto::Units::Converter > | binspectrum_converter_
| See Astrobj::Properties::intensity_converter_.
std::string | kind_
| The "kind" that is output in the XML entity.
std::vector< std::string > | plugins_
| The plug-ins that needs to be loaded to access this instance's class.

## Private Attributes

int | refCount
| Reference counter.
pthread_mutex_t | mutex_
| A mutex.

## Friends

class | Gyoto::SmartPointer< Gyoto::Scenery >

## Detailed Description

Ray-tracing scene.

An Scenery contains:

- a Metric: used in Astrobj, Screen and Photon;
- a Screen: sets the field-of-view, the position of the camera, the observation time, and the Spectrometer;
- an Astrobj: light emitter.

In addition, Quantities may be specified (or the default Quantity will be produced: generally Intensity). Not all Astrobj implement all Quantities. The order in which Quantities are listed is not relevant (it is not stored). Possible Quantities:

- Intensity: the intensity that reaches the object, integrated over the line-of-sight;
- EmissionTime: date of emission;
- MinDistance: minimum distance between the Photon reaching each pixel and the Astrobj;
- FirstDistMin: last closest approach between Photon and Astrobj;
- Redshift;
- ImpactCoords: 8-coordinates of the object and photon at impact;
- Spectrum: Iν computed at various values frequencies, corresponding to the Screen's Spectrometer.
- BinSpectrum: ∫ν1ν2Iνdν computed between various (ν1, ν2 pairs corresponding to the Screen's Spectrometer. This is what a physical spectrometer measures.

In addition, it is possible to ray-trace an image using several cores on a single machine (if Gyoto has been compiled with POSIX threads support). The number of threads can be specified using NThreads entity. Setting NThreads to 0 is equivalent to setting it to 1. Beware that setting NThreads to a number higher than the actual number of cores available on the machine usually leads to a decrease in performance.

Finally, Scenery accepts a number of numerical tuning parameters that are passed directly to the underlying photons (actually, the Scenery object holds a Photon instance which stores many parameters, including the Metric and Astrobj): Adaptive/NonAdaptive, Delta, MinimumTime, MaxIter, PrimaryOnly.

Thus a fully populated Scenery XML looks like that (the values are examples, they are not necessary the default nor the best or even good values):

<?xml version="1.0" encoding="UTF-8"
standalone="no"?> <Scenery>
<Metric kind = "MetricKind">
<MetricProperties/>
</Metric>
<Screen>
<ScreenProperties/>
</Screen>
<Astrobj kind = "AstrobjKind">
<AstrobjParameters/>
</Astrobj>
<Quantities> Spectrum Intensity ...</Quantities>
<NThreads> 2 </NThreads>
Next come the numerical tuning parameters:
Integration step, initial in case of adaptive, reset for
for each ray being traced:
<Delta unit="geometrical"> 1 </Delta>
Adaptive or NonAdaptive:
<Adaptive/>
The integrator to use for integrating the photons:
<Integrator>runge_kutta_fehlberg78</Integrator>
The "Legacy" integrator is coded in
Metric::Generic::myrk4_adaptive(), may be re-implemented in othe
metrics, and therefore takes its tuning parameters in the Metric
section. The other integrators (runge_kutta_fehlberg78,
runge_kutta_cash_karp54, runge_kutta_dopri5,
runge_kutta_cash_karp54_classic) accept the following tuning
parameters, directly in the Scenery section:
Absolute and relative tolerance for the adaptive step:
<AbsTol>1e-11</AbsTol>
<RelTol>1e-11</RelTol>
Normally, you should not need to tune the other three. If you need
to, try using a higher order integrator:
maximum integration step:
<DeltaMax> 100 </DeltaMax>
delta_max/R where R is the current distance to the origin:
<DeltaMaxOverR> 0.1 </DeltaMaxOverR>
minimum step:
<DeltaMin>1e-20</DeltaMin>
A few safe-guards to avoid infinite loops:
Maximum number of iterations for each ray:
<Maxiter> 1000000 </Maxiter>
Minimum date a photon may reach backwards in time:
<MinimumTime unit="yr">25e3</MinimumTime>
This one is an experimental, poorly specified feature:
<!--PrimaryOnly/-->
</Scenery>
Gyoto::Metric::Generic::myrk4_adaptive
virtual int myrk4_adaptive(Gyoto::Worldline *line, state_t const &coord, double lastnorm, double normref, state_t &coordnew, double h0, double &h1, double deltamax=GYOTO_DEFAULT_DELTA_MAX) const
RK4 integrator with adaptive step.
Gyoto::Object::kind
virtual void kind(const std::string)
Set kind_.
Gyoto::Scenery::adaptive
void adaptive(bool mode)
Set ph_.adaptive_.
Gyoto::Scenery::Scenery
Scenery()
Set everything to defaults.
Gyoto::Scenery::integrator
void integrator(std::string type)
Passed to ph_.
Gyoto::Screen
The camera with which the Astrobj is observed.
Definition GyotoScreen.h:176
Gyoto::Astrobj
Access to astronomical objects.
Definition GyotoAstrobj.h:49
Gyoto::Metric
Access to metrics.
Definition GyotoAstrobj.h:47
Gyoto::Spectrum
Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star).
Definition GyotoBlackBodySpectrum.h:35

## Member Typedef Documentation

## Subcontractor_t

typedef Gyoto::SmartPointer< Gyoto::SmartPointee > Gyoto::SmartPointee::Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)

inherited

A subcontractor builds an object upon order from the Factory.

Various classes need to provide a subcontractor to be able to instantiate 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().

## Constructor & Destructor Documentation

## Scenery()

Gyoto::Scenery::Scenery | ( | SmartPointer< Metric::Generic > | ,
|  | SmartPointer< Screen > | ,
|  | SmartPointer< Astrobj::Generic > | )

Constructor setting Scenery::gg_, Scenery::screen_, and Scenery::obj_.

To ensure consistency, the Metric will be forcibly attached to the Screen and to the Astrobj (if they are not NULL).

## Member Function Documentation

## astrobj()

void Gyoto::Scenery::astrobj | ( | SmartPointer< Astrobj::Generic > |  | ) |

Set ph_.obj_.

The Metric attached to the Scenery will be attached to the Astrobj

## clonePhoton()

SmartPointer< Photon > Gyoto::Scenery::clonePhoton | ( |  | ) | const

Get clone of template Photon.

Clone the internal Photon

## describeProperty()

std::string Gyoto::Object::describeProperty | ( | Gyoto::Property const & | p | ) | const

inherited

Format desrciption for a property.

Returns a string containing the name(s) and type of the property, as well as whether it supports unit.

## fillElement()

void Gyoto::Scenery::fillElement | ( | FactoryMessenger * | fmp | ) | const

virtual

Fill the XML element for this Object.

The base implementation simply calls fillProperty() for each Property defined for the Object.

Derived classes should avoid overriding fillElement(). It may make sense occasionally, e.g. to make sure that the metric is output first.

To customize how a given Property is rendered, it is better to override fillProperty().

If this method is overridden, the implementation should in general call fillElement() on the direct base.

Reimplemented from Gyoto::Object.

## fillProperty()

void Gyoto::Scenery::fillProperty | ( | FactoryMessenger * | fmp,
|  | Property const & | p ) const

virtual

Output a single Property to XML.

The base implementation decides what to do based on the p.type. The format matches how setParameters() an setParameter() would interpret the XML descition.

Overriding this method should be avoided, but makes sense in some cases (for instance Screen::fillProperty() selects a different unit for Distance based on its magnitude, so that stellar sizes are expressed in solar radii while smaller sizes can be expressed in meters and larger sizes in parsecs).

Overriding implementation should fall-back on calling the implementation in the direct parent class:

class A: public Object {};
class B: public A {
using B::setParameter;
virtual void fillProperty(Gyoto::FactoryMessenger *fmp,
Property const &p) const ;
};
void B::fillProperty(Gyoto::FactoryMessenger *fmp,
Property const &p) const {
if (name=="Duff") fmp->doSomething();
else A::fillProperty(fmp, p);
}
Gyoto::FactoryMessenger
Factory / SmartPointee::Subcontractor_t interface.
Definition GyotoFactoryMessenger.h:92
Gyoto::Object::Object
Object(std::string const &kind)
Constructor setting kind.
Gyoto::Property
Property that can be set and got using standard methods.
Definition GyotoProperty.h:608

Reimplemented from Gyoto::Object.

## getProperties()

virtual Property const * Gyoto::Scenery::getProperties | ( |  | ) | const

virtual

Get list of properties.

This method is declared automatically by the GYOTO_OBJECT macro and defined automatically by the GYOTO_PROPERTY_END macro.

Reimplemented from Gyoto::Object.

## getScalarQuantitiesCount()

size_t Gyoto::Scenery::getScalarQuantitiesCount | ( | Quantity_t * | q = NULL | ) | const

Get number of requested quantities of scalar nature.

This is all quantities except Spectrum, BinSpectrum and ImpactCoords.

## getSpectralQuantitiesCount()

size_t Gyoto::Scenery::getSpectralQuantitiesCount | ( | Quantity_t * | q = NULL | ) | const

Get number of requested quantities of spectral nature.

This is Spectrum, SpectrumStokesQ, SpectrumStokesU, SpectrumStokesV and BinSpectrum.

## help()

void Gyoto::Object::help | ( |  | ) | const

inherited

Print (to stdout) some help on this class.

Describe all properties that this instance supports.

## isThreadSafe()

virtual bool Gyoto::Object::isThreadSafe | ( |  | ) | const

virtual inherited

Whether this class is thread-safe.

Return True if this object is thread-safe, i.e. if an instance and its clone can be used in parallel threads (in the context of Scenery::raytrace()). Known objects which are not thread-safe include Lorene metrics and everything from the Python plug-in.

The default implementation considers that the class itself is thread safe and recurses into the declared properties to check whether they are safe too. Classes that abide to the Object/Property paradigm and are themselves thread-safe have nothing special to do.

Objects that clone children in their copy constructor that are not declared as properties must take these children into account.

Classes that are never thread-safe must declare it. It acn be easily done using GYOTO_OBJECT_THREAD_SAFETY in the class declaration and GYOTO_PROPERTY_THREAD_UNSAFE in the class definition.

## kind() [1/2]

virtual std::string Gyoto::Object::kind | ( |  | ) | const

virtual inherited

Get kind_.

Reimplemented in Gyoto::Spectrometer::Uniform.

## kind() [2/2]

virtual void Gyoto::Object::kind | ( | const std::string |  | ) |

protected virtual inherited

Set kind_.

kind(const std::string) is protected because, for most Objects, it should not be changed in runtime. Set kind_

## metric()

void Gyoto::Scenery::metric | ( | SmartPointer< Metric::Generic > |  | ) |

Set Scenery::gg_.

The provided Metric will also be atached to the Screen and the Astrobj.

## mpiClone()

void Gyoto::Scenery::mpiClone | ( |  | ) |

Send a copy of self to the mpi workers.

Always call mpiClone() before ray-tracing if workers are running.

## mpiSpawn()

void Gyoto::Scenery::mpiSpawn | ( | int | nbchildren | ) |

Spawn gyoto-mpi-worker processes.

If nbchildren is -1 set mpi_team_ to MPI_COMM_WORLD else spawn nbchildren processes and set nprocesses_ accordingly. If a different number of workers are already running, terminate them first. If nbchildren is 0, just terminate running workers.

The approach of Gyoto to MPI is that a manager process (of rank 0 within a given MPI communicator) will distribute ray-tracing tasks across worker processes. Several scenarii are supported, including spawning instances of the gyoto-mpi-worker.version executable, where "version" matches the version component in the library name (typically a number, possibly followed by "unreleased").

In all cases, the manager process needs to call this function, either with -1 if the worker processes are already running or >1 if workers need to be spawned.

Parameters

  [in] | nbchildren | number of processes to spawn.

## mpiWorker()

void Gyoto::Scenery::mpiWorker | ( |  | ) |

static

Become an MPI worker.

Worker processes need to call this function after having called MPI_Init().

## operator()() [1/2]

void Gyoto::Scenery::operator() | ( | double | alpha,
|  | double | delta,
|  | Astrobj::Properties * | data,
|  | Photon * | ph = NULL )

Ray-trace single direction.

Almost identical to rayTrace(), but for a single direction.

If ph is passed, it is assumed to have been properly initialized (with the right metric and astrobj etc.) already. Else, use &Scenery::ph_.

## operator()() [2/2]

void Gyoto::Scenery::operator() | ( | size_t | i,
|  | size_t | j,
|  | Astrobj::Properties * | data,
|  | double * | impactcoords = NULL,
|  | Photon * | ph = NULL )

Ray-trace a single pixel in Scenery::screen_.

Almost identical to rayTrace(), but for a single pixel.

If ph is passed, it is assumed to have been properly initialized (with the right metric and astrobj etc.) already. Else, use &Scenery::ph_.

## property()

Property const * Gyoto::Object::property | ( | std::string const | pname | ) | const

inherited

Find property by name.

Look into the Property list for a Property whose name (or name_false, for a boolean Property) is pname. Return a const pointer to the first such property found, or NULL if none is found.

## rayTrace()

void Gyoto::Scenery::rayTrace | ( | Screen::Coord2dSet & | ij,
|  | Astrobj::Properties * | data,
|  | double * | impactcoords = NULL )

Perform ray-tracing.

For each directions specified, launch a Photon back in time to compute the various quantities.

At this time, the computed quantities depend on on the pointers in *data which are not NULL.

rayTrace() uses

- setPropertyConverters() to set the converters in *data;
- Astrobj::Properties::init() to initialize each cell in *data;
- Astrobj::Properties::operator++() to step through the arrays in *data.

data must have been instantiated prior to calling rayTrace and the various pointers in *data must be NULL or point to the first cell in an array of size at least Screen::npix_ squared.

If MPI support is built-in, MPI_Init() has been called, and nprocesses_ is ≥1, then rayTrace() will use several processes, launching them using mpiSpawn() if necessary.

Else, if Scenery::nthreads_ is ≥2 and Gyoto has been compiled with pthreads support, rayTrace() will use Scenery::nthreads_ threads and launch photons in parallel. This works only if the Astrobj::Generic::clone() and Metric::Generic::clone() methods have been properly implemented for the specific astrobj and metric kind, and if they are both thread-safe. At the moment, unfortunately, Lorene metrics are known to not be thread-safe.

Parameters

  [in] | ij | Screen::Coord2dSet specification of rays to trace. e.g.:

Screen::Range irange(imin, imax, di);
Screen::Range jrange(jmin, jmax, dj);
Screen::Grid ij(irange, jrange);
Gyoto::Screen::Grid
Class containing 2D-points organized in a grid.
Definition GyotoScreen.h:705
Gyoto::Screen::Range
1D coordinated specifier for a range
Definition GyotoScreen.h:751

Parameters

  [in,out] | data | Pointer to a preallocated Astrobj::Properties instance which sets which quantities must be computed and where to store the output.

  [in]

  impactcoords

  Optional pointer to an array of pre-computed impact coordinates. If impactcoords is provided, rayTracing is skipped and the quantities in *data are fill assuming that the impact coordinates are correct. This only makes sense in optically thick mode, when ray-tracing several sceneries for which the shape of the object is identical but their emission distributions are not. impactcoords can be computed using the ImpactCoords quantity.

## requestedQuantitiesString()

void Gyoto::Scenery::requestedQuantitiesString | ( | std::string const & | squant | ) |

Set Scenery::quantities_ from string.

Parameters

  squant | Coma-separated list of quantities, e.g. "Spectrum MinDistance". The order is not relevant.

## screen()

void Gyoto::Scenery::screen | ( | SmartPointer< Screen > |  | ) |

Set Scenery::screen_.

The Metric attached to the Scenery will be attached to the Screen

## setParameter() [1/2]

virtual void Gyoto::Object::setParameter | ( | Gyoto::Property const & | p,
|  | std::string const & | name,
|  | std::string const & | content,
|  | std::string const & | unit )

virtual inherited

Set parameter by Property (and name).

This function is used when parsing an XML description, if Property (p) of this name is found (i.e. either p.name or p.name_false is equal to name). Implementation should fall-back on calling the direct's parent implementation:

class A: public Object {};
class B: public A {
using B::setParameter;
virtual void setParameter(Gyoto::Property const &p,
std::string name,
std::string content,
std::string unit);
};
void B::setParameter(Gyoto::Property const &p,
std::string name,
std::string content,
std::string unit) {
if (name=="Duff") doSomething(content, unit);
else A::setParameter(p, name, content, unit);
}

Parameters

  p | Property that matches name (p.name == name or p.name_false == name)
  name | XML name of the parameter (XML entity)
  content | string representation of the value
  unit | string representation of the unit

Reimplemented in Gyoto::Astrobj::PolishDoughnut.

## setParameter() [2/2]

virtual int Gyoto::Object::setParameter | ( | std::string | name,
|  | std::string | content,
|  | std::string | unit )

virtual inherited

Set parameter by name.

This function is used when parsing an XML description, if no Property of this name is found. Overriding implementation should fall-back on calling the direct's parent implementation:

class A: public Object {};
class B: public A {
using B::setParameter;
virtual int setParameter(std::string name,
std::string content,
std::string unit);
};
int B::setParameter(std::string name,
std::string content,
std::string unit) {
if (name=="Duff") doSomething(content, unit);
else return A::setParameter(name, content, unit);
return 0; // name was known
}

Parameters

  name | XML name of the parameter (XML entity). This may have a path component, e.g. "Astrobj::Radius", in which case a property named "Astrobj" will be sought in the current object, and setParameter will be called recusrively on this Astrobj with Radius as name.
  content | string representation of the value
  unit | string representation of the unit

Returns
  0 if this parameter is known, 1 if it is not.

Reimplemented in Gyoto::Astrobj::EquatorialHotSpot, Gyoto::Astrobj::Star, Gyoto::Metric::KerrKS, and Gyoto::Metric::RotStar3_1.

## setParameters()

virtual void Gyoto::Object::setParameters | ( | Gyoto::FactoryMessenger * | fmp | ) |

virtual inherited

Main loop for parsing Properties from XML description.

    This function queries the FactoryMessenger for elements to parse,
    and tries to matche each element to a Property to set it
    accordingly.

    Any class that tries to be buildable from XML must supply a
    subcontractor (for base classes such as Metric, Astrobj, Spectrum
    and Spectrometer, it is done as a template that must be
    specialized for each class).

    This subcontractor typically looks somewhat like this:

SmartPointer<Metric::Generic>
Gyoto::Metric::MyKind::Subcontractor(FactoryMessenger* fmp) {
SmartPointer<MyKind> gg = new MyKind();
gg -> setParameters(fmp);
return gg;
}
Gyoto::Object::setParameters
virtual void setParameters(Gyoto::FactoryMessenger *fmp)
Main loop for parsing Properties from XML description.
Gyoto::SmartPointer
Pointers performing reference counting.
Definition GyotoSmartPointer.h:135

    Although this is discouraged, it is possible to override the
    following functions to customize how XML entities are parsed:
      - setParameters() if low-level access to the
        FactoryMessenger is required;
      - setParameter(std::string name,
                     std::string content,
                     std::string unit)
        to interpret an entity that does not match a Property
        (e.g. alternative name);
      - setParameter(Gyoto::Property const &p,
                     std::string const &name,
                     std::string const &content,
                     std::string const &unit)
        to change how a Property is interpreted.

Reimplemented in Gyoto::Astrobj::Complex, Gyoto::Astrobj::EquatorialHotSpot, Gyoto::Astrobj::Generic, Gyoto::Astrobj::OscilTorus, Gyoto::Astrobj::Star, Gyoto::Metric::Complex, Gyoto::Metric::Shift, Gyoto::Photon, Gyoto::Spectrometer::Complex, and Gyoto::Spectrometer::Uniform.

## setPropertyConverters()

void Gyoto::Scenery::setPropertyConverters | ( | Gyoto::Astrobj::Properties * | prop | ) |

Copy converters to Astrobj::Properties instance.

Copy Scenery::intensity_converter_, Scenery::spectrum_converter_ and Scenery::binspectrum_converter_ to there alter ego in *prop.

## setRequestedQuantities()

void Gyoto::Scenery::setRequestedQuantities | ( | Quantity_t | quant | ) |

Set Scenery::quantities_.

Parameters

  quant

  Bitwise OR of desired quantities, e.g.
  GYOTO_QUANTITY_SPECTRUM | GYOTO_QUANTITY_MIN_DISTANCE
  GYOTO_QUANTITY_MIN_DISTANCE
  #define GYOTO_QUANTITY_MIN_DISTANCE
  MinDistance: Behaves like minimal distance between Photon and Astrobj.
  Definition GyotoDefs.h:90
  GYOTO_QUANTITY_SPECTRUM
  #define GYOTO_QUANTITY_SPECTRUM
  Spectrum: Iν at each frequency in Scenery::screen_->getMidpoints().
  Definition GyotoDefs.h:101

## Member Data Documentation

## delta_

double Gyoto::Scenery::delta_

protected

Default integration step for the photons

## kind_

std::string Gyoto::Object::kind_

protected inherited

The "kind" that is output in the XML entity.

E.g. for an Astrobj, fillElement() will ensure

<Astrobj kind="kind_" ...>...</Astrobj>

is written.

## mpi_team_

boost::mpi::communicator* Gyoto::Scenery::mpi_team_

Team of processes for MPI.

Rank 0 is the manager, other ranks are workers, instances of the gyoto-mpi-worker executable.

## mutex_

pthread_mutex_t Gyoto::SmartPointee::mutex_

private inherited

A mutex.

When compiled with libpthread

## nthreads_

size_t Gyoto::Scenery::nthreads_

protected

Number of parallel threads to use in rayTrace().

When compiled with libpthread, Scenery::rayTrace() may compute several points of the image in parallel threads. This is the number of threads to use.

## ph_

Gyoto::Photon Gyoto::Scenery::ph_

protected

Template Photon.

Used internally to not always reallocate memory when operator() is called and to store all the parameters which affect the integration, except delta_.

## plugins_

std::vector<std::string> Gyoto::Object::plugins_

protected inherited

The plug-ins that needs to be loaded to access this instance's class.

E.g. for an Astrobj, fillElement() will ensure

<Astrobj ... plugin="plugins_">...</Astrobj>

is written.

## quantities_

Gyoto::Quantity_t Gyoto::Scenery::quantities_

protected

Quantities to compute.

Bitwise OR of quantities that will be computed, for instance:

GYOTO_QUANTITY_INTENSITY | GYOTO_QUANTITY_EMISSIONTIME | ...
GYOTO_QUANTITY_INTENSITY
#define GYOTO_QUANTITY_INTENSITY
Intensity: Iν at Scenery::freq_obs_.
Definition GyotoDefs.h:83
GYOTO_QUANTITY_EMISSIONTIME
#define GYOTO_QUANTITY_EMISSIONTIME
EmissionTime: Emission date.
Definition GyotoDefs.h:85

## screen_

SmartPointer<Screen> Gyoto::Scenery::screen_

protected

Screen, the camera for this scenery.

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

- GyotoScenery.h