Gyoto
Classes | Typedefs | Functions | Variables
Gyoto::Astrobj Namespace Reference

Access to astronomical objects. More...

Classes

class  Generic
 Base class for astronomical object. More...
class  Properties
 Observable properties of an Astronomical object. More...
class  Complex
 Complex astronomical object. More...
class  Disk3D
 Geometrically thick disk read from FITS file. More...
class  Disk3D_BB
 Geometrically thick optically thin disk read from a set of FITS files. More...
class  DynamicalDisk
 Geometrically thin disk read from a set of FITS files. More...
class  FixedStar
 Fixed (i.e. non-moving) star (or spherical blob) More...
class  PageThorneDisk
 Geometrically thin disk in Kerr metric. More...
class  PatternDisk
 Geometrically thin disk read from FITS file. More...
class  PatternDiskBB
 Geometrically thin disk read from FITS file with black body spectrum and a power law extension up to some rmax_. More...
class  Standard
 Astronomical objects defined bya a potential/distance. More...
class  Star
 Mass-less, spherical object following a timelike geodesic. More...
class  ThinDisk
 Geometrically thin disks and rings. More...
class  ThinDiskPL
 Geometrically thin disk in Kerr metric. More...
class  Torus
 Optically thin or thick torus in circular rotation. More...
class  UniformSphere
 Optically thick or thin, spherical objects. More...

Typedefs

typedef SmartPointer
< Gyoto::Astrobj::Generic
Subcontractor_t (Gyoto::FactoryMessenger *)
 A function to build instances of a specific Astrobj::Generic sub-class.

Functions

template<typename T >
SmartPointer< Astrobj::GenericSubcontractor (FactoryMessenger *fmp)
 A template for Subcontractor_t functions.
Gyoto::Astrobj::Subcontractor_tgetSubcontractor (std::string name)
 Query the Astrobj register.
void initRegister ()
 Empty the Astrobj register.
void Register (std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
 Make an Astrobj kind known to the Factory.

Variables

Gyoto::Register::EntryRegister_
 The Astrobj register.

Detailed Description

Access to astronomical objects.

Objects which are supposed to be the target of the ray-tracing
code should inherit from the Gyoto::Astrobj::Generic class.

When implementing a new object, you must:
  - make sure the object can be loaded from XML by providing a
    Subcontractor_t using the Gyoto::Astrobj::Register(std::string
    name, Gyoto::Astrobj::Subcontractor_t* scp) function;
  - make sure this subcontractor is registerred in the initialization
    routine of your plug-in;
  - make sure  Generic::Impact() works (see below).

In addition, you should make sure that your object plays nicely in
the Yorick plug-in, which means:
  - implement the copy constructor and the Generic::clone() method;
  - implement the fillElement method, used for printing and saving to
    XML.

There are basically two ways of making Generic::Impact() work:
either by making the Astrobj a sub-class of the low-level
Gyoto::Astrobj::Generic class ans providing your own
Generic::Impact() function (which, in principle, should rely on
Generic::processHitQuantities()), or by making the Astrobj a
sub-class of the higher-level Gyoto::Astrobj::Standard class and
implementing two lower level, simpler functions which are
used by the Standard::Impact():
  - Standard::operator()() yields a distance or potential defining
    the interior of the object;
  - Standard::getVelocity() yields the velocity field of the fluid.

Generic::processHitQuantities() itself is an intermediate-level
function which you may choose to reimplement. It uses three
low-level, easy to implement functions:
  - Generic::emission();
  - Generic::integrateEmission();
  - Generic::transmission().
Default implementations of these three functions exist, they have
little physical relevance but allow quick 0-th order vizualisation
of your object.

To be usable, a Astrobj::Generic (or Astrobj::Standard) sub-classe should register an Astrobj::Subcontractor_t function using the Astrobj::Register() function. See also Writing plug-ins for Gyoto . If your clas implements setParameter() and/or, if necessary, setParameters(), registering it is normally done using the provided template:

Astrobj::Register("MyKind", &(Astrobj::Subcontractor<Astrobj::MyKind>));

Typedef Documentation

typedef SmartPointer<Gyoto::Astrobj::Generic> Gyoto::Astrobj::Subcontractor_t(Gyoto::FactoryMessenger *)

A function to build instances of a specific Astrobj::Generic sub-class.

This is a more specific version of the SmartPointee::Subcontractor_t type. An Astrobj::Subcontrator_t is called by the Gyoto::Factory to build an instance of the kind of astronomical object specified in an XML file (see Register()). The Factory and Subcontractor_t function communicate through a Gyoto::FactoryMessenger. A template is provided so that you may not have to code anything.

Function Documentation

Gyoto::Astrobj::Subcontractor_t* Gyoto::Astrobj::getSubcontractor ( std::string  name)

Query the Astrobj register.

Query the Astrobj register to get the Astrobj::Subcontractor_t correspondig to a given kind name. This function is normally called only from the Factory.

Parameters
namee.g. "Star"
Returns
pointer to the corresponding subcontractor.
void Gyoto::Astrobj::initRegister ( )

Empty the Astrobj register.

This must be called once.

void Gyoto::Astrobj::Register ( std::string  name,
Gyoto::Astrobj::Subcontractor_t scp 
)

Make an Astrobj kind known to the Factory.

Register a new Astrobj::Generic sub-class so that the Gyoto::Factory knows it.

Parameters
nameThe kind name which identifies this object type in an XML file, as in <Astrobj kind="name">
scpA pointer to the subcontractor, which will communicate whith the Gyoto::Factory to build an instance of the class from its XML description
template<typename T >
SmartPointer<Astrobj::Generic> Gyoto::Astrobj::Subcontractor ( FactoryMessenger *  fmp)

A template for Subcontractor_t functions.

Instead of reimplementing the wheel, your subcobtractor can simply be Gyoto::Astrobj::Subcontractor<MyKind>

Variable Documentation

Gyoto::Register::Entry* Gyoto::Astrobj::Register_

The Astrobj register.

Use the Astrobj::initRegister() once in your program to initiliaze it, the Astrobj::Register() function to fill it, and the Astrobj::getSubcontractor() function to query it.