GyotoDefs.h File Reference

Gyoto ubiquitous macros and typedefs. More...

#include "GyotoConfig.h"
#include <float.h>

Go to the source code of this file.

Namespaces

namespace  Gyoto
 

Namespace for the Gyoto library.


Defines

#define sincos(t, s, c)   (undefined)
 Replacement for GNU extension sincos.
#define GYOTO_STRINGIFY(a)   GYOTO_STRINGIFY_ARGUMENT(a)
 Stringify macro content.
#define GYOTO_STRINGIFY_ARGUMENT(a)   #a
 Stringify argument.
Default values for various things



#define GYOTO_DEFAULT_X_SIZE   1024
 Default size for arrays in a Worldline.
#define GYOTO_DEFAULT_DELTA   0.01
 Default value for the initial step in the integration loop.
#define GYOTO_DEFAULT_DELTA_MAX   DBL_MAX
 Default value for the maximum step in the integration loop.
#define GYOTO_DEFAULT_DELTA_MIN   DBL_MIN
 Default value for the minimum step in the integration loop.
#define GYOTO_DEFAULT_DELTA_MAX_OVER_R   1.
 Default value for delta_max_over_r_.
#define GYOTO_DEFAULT_ABSTOL   1e-6
#define GYOTO_DEFAULT_RELTOL   1e-6
#define GYOTO_DEFAULT_MAXITER   100000
 Default value for Gyoto::Worldline::maxiter_.
#define GYOTO_T_TOL   1e-4
 Precision on the determination of a date.
#define GYOTO_KERR_HORIZON_SECURITY   0.01
#define GYOTO_SCREEN_DMAX   DBL_MAX
 Default value for Screen::dmax_.
#define GYOTO_PREC   15
 Precision when outputting double values.
#define GYOTO_WIDTH   25
 Field width when outputting double values.
#define GYOTO_DEFAULT_PLUGINS   "stdplug,nofail:lorene"
 Default list of default plug-ins to load...
Physical constants



#define GYOTO_C   299792458.
 Celerity of light (m/s).
#define GYOTO_C_CGS   2.99792458e10
 Celerity of light (cm/s).
#define GYOTO_C2_CGS   8.98755178736817668096e+20
 Celerity of light squared c^2 in cgs.
#define GYOTO_C2_CGS_M1   1.1126500560536184087938986e-21
 Inverse of celerity of light squared in cgs.
#define GYOTO_G   6.67428e-11
 Gravitational constant (SI = m^3 * kg^-1 * s-2).
#define GYOTO_G_CGS   6.67428e-8
 Gravitational constant (cgs: cm^3 * g^-1 * s-2).
#define GYOTO_G_OVER_C_SQUARE   7.426138e-28
 G/c^2=6.67428e-11/299792458.^2.
#define GYOTO_G_OVER_C_SQUARE_CGS   7.426138e-29
 G/c^2 in cgs units.
#define GYOTO_PLANCK   6.62606896e-34
 Planck's constant (h) in SI (J.s=kg.m^2/s).
#define GYOTO_PLANCK_CGS   6.62606896e-27
 Planck's constant (h) in c.g.s (g.cm^2/s).
#define GYOTO_PLANCK_OVER_C_SQUARE   7.372496e-51
 h/c^2 in SI (kg.s)
#define GYOTO_BOLTZMANN   1.3806504e-23
 Boltzmann's constant (k) in SI (J/K).
#define GYOTO_BOLTZMANN_CGS   1.3806504e-16
 Boltzmann's constant (k) in cgs (erg/K).
#define GYOTO_STEFANBOLTZMANN_CGS   5.670373e-5
 Stefan-Boltzmann's constant (sigma) in cgs (erg/cm2/s/K4).
#define GYOTO_PLANCK_OVER_BOLTZMANN   4.7992373e-11
 h/k (K.s = K/Hz)
#define GYOTO_GAS_CST   8.3144621
 ideal gas constant R in SI
#define GYOTO_GAS_CST_CGS   8.3144621e7
 ideal gas constant R in erg/(K mol)
#define GYOTO_AVOGADRO   6.0221413e23
 Avogadro constant.
#define GYOTO_THOMSON_CGS   6.6524e-25
 Thomson cross-section in cgs.
#define GYOTO_ALPHA_F   0.00729927
 Fine structure constant (=1/137).
#define GYOTO_PROTON_MASS_CGS   1.67262158e-24
 proton mass in cgs
#define GYOTO_ELECTRON_MASS_CGS   9.10938188e-28
 electron mass in cgs
#define GYOTO_ELECTRON_CLASSICAL_RADIUS_CGS   2.8179e-13
 electron classical radius in cgs
#define GYOTO_ELEMENTARY_CHARGE_CGS   4.80320427e-10
 elementary charge in cgs (erg^{1/2} cm^{1/2})
#define GYOTO_EULER_MASCHERONI   0.577216
 Euler-Mascheroni constant.
#define GYOTO_ATOMIC_MASS_UNIT_CGS   1.660537781e-24
 atomic mass unit in cgs
#define GYOTO_INU_CGS_TO_SI   0.001
 Factor to convert I from c.g.s. to SI.
#define GYOTO_SUN_MASS   1.98843e30
 Sun mass (kg).
#define GYOTO_SUN_MASS_CGS   1.98843e33
 Sun mass (g).
#define GYOTO_SUN_RADIUS   6.955e8
 Sun radius (m).
#define GYOTO_KPC   3.08568025e19
 Kiloparsec (m).
#define GYOTO_ASTRONOMICAL_UNIT   1.49597870700e11
 Astronomical Unit (m).
#define GYOTO_LIGHT_YEAR   9.4607304725808e15
 Light-year (m).
#define GYOTO_RADEG   57.2957795130823
 Convert from radians to degrees.
#define GYOTO_DEGRAD   0.0174532925199433
 Convert from degrees to radians.
#define GYOTO_MINRAD   2.908882086657216e-04
 Convert from arcminutes to radians.
#define GYOTO_SECRAD   4.848136811095360e-06
 Convert from arcseconds to radians.
#define GYOTO_MASRAD   4.848136811095360e-09
 Convert from milliarcseconds to radians.
#define GYOTO_MUASRAD   4.848136811095360e-12
 Convert from microarcseconds to radians.
#define GYOTO_eV2Hz   2.417989348e+14
 Convert from eV to Hz.
Renamed methods

Define GYOTO_NO_DEPRECATED to disable these macros and the warning. For instance:

 make CPPFLAGS=-DGYOTO_NO_DEPRECATED


#define getMetric   metric
#define setMetric   metric
#define setScreen   screen
#define getScreen   screen
#define getRmax   rMax
#define setRmax   rMax
#define getMass   mass
#define setMass   mass
#define getCoordKind   coordKind
#define setCoordKind   coordKind
#define getKind   kind
#define setKind   kind
#define getSpin   spin
#define setSpin   spin
#define getIntegKind   integKind
#define setIntegKind   integKind
#define getFileName   fileName
#define setFileName   fileName
#define getDistance   distance
#define setDistance   distance
#define getPALN   PALN
#define setPALN   PALN
#define getArgument   argument
#define setArgument   argument
#define getInclination   inclination
#define setInclination   inclination
#define getAstrobj   astrobj
#define setAstrobj   astrobj
#define getSpectrometer   spectrometer
#define setSpectrometer   spectrometer
#define getSpectrum   spectrum
#define setSpectrum   spectrum
#define getOpacity   opacity
#define setOpacity   opacity
#define setDelta   delta
#define getDelta   delta
#define setDelta   delta
#define getDelta   delta
#define setDelta0   delta0
#define getDelta0   delta0
#define setAlpha0   alpha0
#define getAlpha0   alpha0
#define setAnglekind   anglekind
#define getTmin   tMin
#define setTmin   tMin
#define getTime   time
#define setTime   time
#define getFreqObs   freqObs
#define setFreqObs   freqObs
#define getFieldOfView   fieldOfView
#define setFieldOfView   fieldOfView
#define getRadius   radius
#define setRadius   radius
#define getLargeRadius   largeRadius
#define setLargeRadius   largeRadius
#define getSmallRadius   smallRadius
#define setSmallRadius   smallRadius
#define getCentralDensity   centralDensity
#define setCentralDensity   centralDensity
#define getDmax   dMax
#define setDmax   dMax
#define getTemperature   temperature
#define setTemperature   temperature
#define getScaling   scaling
#define setScaling   scaling
#define getPatternVelocity   patternVelocity
#define setPatternVelocity   patternVelocity
#define getLambda   lambda
#define setLambda   lambda
#define getCentralTempOverVirial   centralTempOverVirial
#define setCentralTempOverVirial   centralTempOverVirial
#define getBeta   beta
#define setBeta   beta
#define getConstant   constant
#define setConstant   constant
#define getExponent   exponent
#define setExponent   exponent
#define getFlag_radtransf   opticallyThin
#define setFlag_radtransf   opticallyThin
#define getNThreads   nThreads
#define setNThreads   nThreads
#define getResolution   resolution
#define setResolution   resolution
#define getNSamples   nSamples
#define setNSamples   nSamples
#define getSpectralOverSampling   spectralOversampling
#define setSpectralOverSampling   spectralOversampling
#define setBinSpectrumConverter   binSpectrumConverter
#define setSpectrumConverter   spectrumConverter
#define setIntensityConverter   intensityConverter
#define getSafetyValue   safetyValue;
#define setSafetyValue   safetyValue;
#define setInnerRadius   innerRadius;
#define getInnerRadius   innerRadius;
#define setOuterRadius   outerRadius;
#define getOuterRadius   outerRadius;
#define setThickness   thickness;
#define getThickness   thickness;
#define setDir   dir;
#define getDir   dir;
#define setBand   band;
#define setObserverKind   observerKind;
#define getObserverKind   observerKind;

Observable quantities

Individual quantities are represented as a variable of this type. A combination of quantities is an ored list of Quantity_t, e.g.

To check wheter a given quantity is listed in a Quantity_t variable quant:

 if (quant & GYOTOQUANTITY_EMISSION) ...

List of all possible Quantity_t individual values and the corresponding string (see Gyoto::Scenery) with corresponding XML name:



#define GYOTO_QUANTITY_NONE   0
#define GYOTO_QUANTITY_INTENSITY   1
 Intensity: I at Scenery::freq_obs_.
#define GYOTO_QUANTITY_EMISSIONTIME   2
 EmissionTime: Emission date.
#define GYOTO_QUANTITY_MIN_DISTANCE   4
 MinDistance: Behaves like minimal distance between Photon and Astrobj.
#define GYOTO_QUANTITY_FIRST_DMIN   8
 FirstDmin: First Photon-Astrobj distance local minimum while integrating back in time.
#define GYOTO_QUANTITY_REDSHIFT   16
 Redshift: obs/em.
#define GYOTO_QUANTITY_IMPACTCOORDS   32
 ImpactCoords: Astrobj and Photon 8-coordinates at emission.
#define GYOTO_QUANTITY_SPECTRUM   512
 Spectrum: I at each frequency in Scenery::screen_->getMidpoints().
#define GYOTO_QUANTITY_BINSPECTRUM   1024
 Spectrum: 12I d in each frequency channel in Scenery::screen_.
#define GYOTO_QUANTITY_USER1   32768
 User1: Gyoto::Astrobj specific Gyoto::Quantity_t.
#define GYOTO_QUANTITY_USER2   16384
 User2: Gyoto::Astrobj specific Gyoto::Quantity_t.
#define GYOTO_QUANTITY_USER3   8192
 User3: Gyoto::Astrobj specific Gyoto::Quantity_t.
#define GYOTO_QUANTITY_USER4   4096
 User4: Gyoto::Astrobj specific Gyoto::Quantity_t.
#define GYOTO_QUANTITY_USER5   2048
 User5: Gyoto::Astrobj specific Gyoto::Quantity_t.
typedef unsigned int Gyoto::Quantity_t
 Type for observabke quantities.

Gyoto messages

Controling which messages are shown to the user

The user should be able to choose which messages are shown to her. In Gyoto, this is determined by a user-settable verbosity level (see Gyoto::verbose()) and a user-settable debug mode (see Goyto::debug()).

The following macros define various debug and verbosity level and provide short-cuts to display formatted messages only at a given verbosity level or in debug mode.



#define GYOTO_DEFAULT_DEBUG_MODE   0
 Default debug mode.
#define GYOTO_QUIET_VERBOSITY   1
 Quiet Gyoto::Verbosity_t.
#define GYOTO_SEVERE_VERBOSITY   3
 Severe warnings.
#define GYOTO_WARNING_VERBOSITY   GYOTO_SEVERE_VERBOSITY
 Warnings.
#define GYOTO_DEFAULT_VERBOSITY   5
 Default verbosity level.
#define GYOTO_INFO_VERBOSITY   10
 Informative messages.
#define GYOTO_DEBUG_VERBOSITY   3000
 Maximum verbosity level.
#define GYOTO_QUIET   if (Gyoto::verbose() >= GYOTO_QUIET_VERBOSITY) std::cout
 Display a message to stdout even in quiet mode.
#define GYOTO_SEVERE   if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"SEVERE: "
 Display a severe level message to stderr.
#define GYOTO_WARNING   if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"WARNING: "
 Display a warning level message to stderr.
#define GYOTO_MSG   if (Gyoto::verbose() >= GYOTO_DEFAULT_VERBOSITY) std::cout
 Display normal message to stdout.
#define GYOTO_INFO   if (Gyoto::verbose() >= GYOTO_INFO_VERBOSITY) std::cerr<<"INFO: "
 Display informative message to stderr.
#define GYOTO_WARNING_UDUNITS(from, to)
 Unit ignored because libudunits2 was disabled.
#define GYOTO_DEBUG_EXPR(a)   GYOTO_DEBUG << #a << "=" << a << std::endl
 Output expression value in debug mode.
#define GYOTO_DEBUG_ARRAY(a, n)
 Output array content in debug mode.
#define GYOTO_DEBUG   if (GYOTO_DEBUG_MODE) std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": "
 Display debug message.
#define GYOTO_IF_DEBUG   if (GYOTO_DEBUG_MODE) {
 Start debug-only block.
#define GYOTO_ENDIF_DEBUG   }
 End debug-only block.
#define GYOTO_DEBUG_MODE   Gyoto::debug()
 Whether debug mode is activated (run-time).
typedef unsigned int Gyoto::Verbosity_t
 Type for verbosity levels.

Coordinate system kind

GYOTO_COORDKIND_CARTESIAN or GYOTO_COORDKIND_SPHERICAL

Every Gyoto::Metric has a coordinate system kind. It can be used by functions which need to express coordinates always in spherical or always in Cartesian form, with trivial conversion between the two.



#define GYOTO_COORDKIND_UNSPECIFIED   0
 Unspecified coordinate kind.
#define GYOTO_COORDKIND_CARTESIAN   1
 Cartesian-like coordinate system.
#define GYOTO_COORDKIND_SPHERICAL   2
 Spherical-like coordinate system.
typedef unsigned int Gyoto::CoordKind_t
 Type for coordinate system kinds.

Detailed Description

Gyoto ubiquitous macros and typedefs.


Define Documentation

#define GYOTO_DEBUG   if (GYOTO_DEBUG_MODE) std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": "

Display debug message.

Message is deiplayed only if GYOTO_DEBUG_MODE is true and is prepended with the word "DEBUG:" and the signature of the function.

 GYOTO_DEBUG << "message" << endl;
#define GYOTO_DEBUG_ARRAY ( a,
 ) 
Value:
if (GYOTO_DEBUG_MODE) {            \
    std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": "         \
              << #a << "=[" << a[0] ;                             \
    for (size_t _gyoto_debug_array_i=1; _gyoto_debug_array_i < n; ++_gyoto_debug_array_i) \
      std::cerr << "," << a[_gyoto_debug_array_i] ;                     \
    std::cerr << "]" << std::endl ;}

Output array content in debug mode.

Output, only in debug, name and content of array. For instance:

 int a[]= {1, 2, 3};
 GYOTO_DEBUG_ARRAY(a,3);

will essentially output, only in debug mode:

 DEBUG: <function signature>: a=[1,2,3]
Parameters:
a Array
n Number of elements to show (array must be at least this size).
#define GYOTO_DEBUG_EXPR (  )     GYOTO_DEBUG << #a << "=" << a << std::endl

Output expression value in debug mode.

Output, only in debug mode both code and value that code yield. For instance:

 int a=1, b=2;
 GYOTO_DEBUG_EXPR(a+b);

will essentially output, only in debug mode:

 DEBUG: <function signature>: a+b=3
#define GYOTO_DEBUG_VERBOSITY   3000

Maximum verbosity level.

In debug mode, all messages are displayed in addition to specific debug information.

To display debug messages, check GYOTO_DEBUG_MODE or use GYOTO_DEBUG for instance.

#define GYOTO_DEFAULT_DELTA   0.01

Default value for the initial step in the integration loop.

Since the step is (most of the time) adaptive, this default only has little influence, but sometimes, it matters. Also used in Scenery.

#define GYOTO_DEFAULT_DELTA_MAX_OVER_R   1.

Default value for delta_max_over_r_.

For investigations close to the event horizon, 0.5 is usually fine. If high accuracy is needed long after deflection (weak lensing), then this must be smaller. A good test is to look at a MinDistance map for a FixedStar: it must be smooth.

#define GYOTO_DEFAULT_VERBOSITY   5

Default verbosity level.

Normal messages are output to stdout if Gyoto::verbose()GYOTO_DEFAULT_VERBOSITY.

Use GYOTO_MSG to display messages at this level.

#define GYOTO_ENDIF_DEBUG   }

End debug-only block.

Code between GYOTO_IF_DEBUG and GYOTO_ENDIF_DEBUG is only executed in debug mode.

#define GYOTO_IF_DEBUG   if (GYOTO_DEBUG_MODE) {

Start debug-only block.

Code between GYOTO_IF_DEBUG and GYOTO_ENDIF_DEBUG is only executed in debug mode.

#define GYOTO_INFO   if (Gyoto::verbose() >= GYOTO_INFO_VERBOSITY) std::cerr<<"INFO: "

Display informative message to stderr.

Message will be shown to the user only if Gyoto::verbose() has been explicitely raised.

 GYOTO_MSG << "Message" << std::endl;
#define GYOTO_INFO_VERBOSITY   10

Informative messages.

Informative messages are output to stderr if Gyoto::verbose()GYOTO_INFO_VERBOSITY.

Use GYOTO_INFO to display messages at this level.

#define GYOTO_MSG   if (Gyoto::verbose() >= GYOTO_DEFAULT_VERBOSITY) std::cout

Display normal message to stdout.

The message will by default be shown to the user. To be reserved to messages shown at most once per Gyoto::Screen row.

 GYOTO_MSG << "Message" << std::endl;
#define GYOTO_QUANTITY_IMPACTCOORDS   32

ImpactCoords: Astrobj and Photon 8-coordinates at emission.

A 16-element vector. See Gyoto::Quantity_t.

#define GYOTO_QUANTITY_MIN_DISTANCE   4

MinDistance: Behaves like minimal distance between Photon and Astrobj.

Not always exactly a distance, though.

#define GYOTO_QUIET   if (Gyoto::verbose() >= GYOTO_QUIET_VERBOSITY) std::cout

Display a message to stdout even in quiet mode.

Only very few messages may be output to stdout at this level. This should be reserved to messages shown at most once in a run.

 GYOTO_QUIET << "Important message displayed once" << std::endl;
#define GYOTO_QUIET_VERBOSITY   1

Quiet Gyoto::Verbosity_t.

Only very few messages may be output to stdout at this level.

Use GYOTO_QUIET to display messages at this level.

#define GYOTO_SEVERE   if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"SEVERE: "

Display a severe level message to stderr.

 GYOTO_SEVERE << "Important warning" << std::endl;
#define GYOTO_SEVERE_VERBOSITY   3

Severe warnings.

Severe warning messages are output to stderr if Gyoto::verbose()GYOTO_SEVERE_VERBOSITY.

Use GYOTO_SEVERE to display messages at this level.

#define GYOTO_T_TOL   1e-4

Precision on the determination of a date.

E.g. in Gyoto::Photon::findMin(), Gyoto::Photon::findValue().

#define GYOTO_WARNING   if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"WARNING: "

Display a warning level message to stderr.

 GYOTO_WARNING << "Warning" << std::endl;
#define GYOTO_WARNING_UDUNITS ( from,
to   ) 
Value:
GYOTO_WARNING << "unit ignored (trying to convert from \"" << from \
                << "\" to "                                          \
                << to \
                << "\"), you may have more chance recompiling Gyoto with --with-udunits\n"

Unit ignored because libudunits2 was disabled.

Use this warning when a conversion has been dropped due to HAVE_UDUNITS being undefined.

Parameters:
from From unit.
to To unit.
#define GYOTO_WARNING_VERBOSITY   GYOTO_SEVERE_VERBOSITY

Warnings.

Warning messages are output to stderr if Gyoto::verbose()GYOTO_WARNING_VERBOSITY.

Use GYOTO_WARNING to display messages at this level.

#define sincos ( t,
s,
 )     (undefined)

Replacement for GNU extension sincos.

If HAVE_SINCOS is undefined, Gyoto provides a trivial implementation.

Parameters:
[in] t Angle in radian;
[out] s Adress where sin(t) should be stored;
[out] c Adress where cos(t) should be stored.

Generated on 22 Jul 2017 for Gyoto by  doxygen 1.6.1