Gyoto
GyotoDefs.h
Go to the documentation of this file.
1 
5 /*
6  Copyright 2011-2015, 2017-2020 Thibaut Paumard & Frédéric Vincent
7 
8  This file is part of Gyoto.
9 
10  Gyoto is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  Gyoto is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef __GyotoDefs_H_
25 #define __GyotoDefs_H_
26 
27 #include <float.h>
28 #include <vector>
29 
30 #include "GyotoConfig.h"
31 #include "GyotoAnsi.h"
32 
42 #if !HAVE_SINCOS
43 #define sincos(t, s, c) *s=sin(t); *c=cos(t)
44 #else
45 # ifdef DOXYGEN_RUN
46 # define sincos(t, s, c) (undefined)
47 # endif
48 #endif
49 
50 /* Typedef for various Gyoto data types */
51 namespace Gyoto {
52  typedef std::vector<double> state_t;
53 
54  //\{
77  typedef unsigned int Quantity_t;
79 
80  /* Generic */
81 
82 #define GYOTO_QUANTITY_NONE 0
83 
85 #define GYOTO_QUANTITY_INTENSITY 1<<0
86 #define GYOTO_QUANTITY_EMISSIONTIME 1<<1
88 
92 #define GYOTO_QUANTITY_MIN_DISTANCE 1<<2
93 #define GYOTO_QUANTITY_FIRST_DMIN 1<<3
95 #define GYOTO_QUANTITY_REDSHIFT 1<<4
97 
101 #define GYOTO_QUANTITY_IMPACTCOORDS 1<<5
102 #define GYOTO_QUANTITY_SPECTRUM 1<<6
104 #define GYOTO_QUANTITY_SPECTRUM_STOKES_Q 1<<7
106 #define GYOTO_QUANTITY_SPECTRUM_STOKES_U 1<<8
108 #define GYOTO_QUANTITY_SPECTRUM_STOKES_V 1<<9
110 #define GYOTO_QUANTITY_BINSPECTRUM 1<<10
112 #define GYOTO_QUANTITY_NBCROSSEQPLANE 1<<11
114  /* Astrobj-specific */
116 #define GYOTO_QUANTITY_USER1 1<<31
117 #define GYOTO_QUANTITY_USER2 1<<30
119 #define GYOTO_QUANTITY_USER3 1<<29
121 #define GYOTO_QUANTITY_USER4 1<<28
123 #define GYOTO_QUANTITY_USER5 1<<27
125 #define GYOTO_QUANTITY_SPECTRAL (GYOTO_QUANTITY_SPECTRUM | GYOTO_QUANTITY_SPECTRUM_STOKES_Q | GYOTO_QUANTITY_SPECTRUM_STOKES_U | GYOTO_QUANTITY_SPECTRUM_STOKES_V | GYOTO_QUANTITY_BINSPECTRUM)
127 #define GYOTO_QUANTITY_SPECTRUM_STOKES (GYOTO_QUANTITY_SPECTRUM | GYOTO_QUANTITY_SPECTRUM_STOKES_Q | GYOTO_QUANTITY_SPECTRUM_STOKES_U | GYOTO_QUANTITY_SPECTRUM_STOKES_V)
129  //\}
130 
144  //\{
146  typedef unsigned int Verbosity_t;
147 
149 #define GYOTO_DEFAULT_DEBUG_MODE 0
150 
152 
157 #define GYOTO_QUIET_VERBOSITY 1
158 
160 
166 #define GYOTO_SEVERE_VERBOSITY 3
167 
169 
175 #define GYOTO_WARNING_VERBOSITY GYOTO_SEVERE_VERBOSITY
176 
178 
184 #define GYOTO_DEFAULT_VERBOSITY 5
185 
187 
193 #define GYOTO_INFO_VERBOSITY 10
194 
196 
203 #define GYOTO_DEBUG_VERBOSITY 3000
204 
206 
215 #define GYOTO_QUIET if (Gyoto::verbose() >= GYOTO_QUIET_VERBOSITY) \
216  Gyoto::AnsiScope::cout()
217 
219 
224 #define GYOTO_SEVERE if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) \
225  Gyoto::AnsiScope::cerr() \
226  << GYOTO_ANSI_SEVERE_TAG << "SEVERE: " \
227  << GYOTO_ANSI_SEVERE
228 
230 
235 #define GYOTO_WARNING if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) \
236  Gyoto::AnsiScope::cerr() \
237  << GYOTO_ANSI_WARNING_TAG << "WARNING: " \
238  << GYOTO_ANSI_WARNING
239 
241 
249 #define GYOTO_MSG \
250  if (Gyoto::verbose() >= GYOTO_DEFAULT_VERBOSITY) \
251  Gyoto::AnsiScope::cout() << GYOTO_ANSI_RESET
252 
254 
262 #define GYOTO_INFO if (Gyoto::verbose() >= GYOTO_INFO_VERBOSITY) \
263  Gyoto::AnsiScope::cerr() \
264  << GYOTO_ANSI_INFO_TAG << "INFO: " << GYOTO_ANSI_INFO
265 
267 
274 #define GYOTO_WARNING_UDUNITS(from, to) \
275  GYOTO_WARNING << "unit ignored (trying to convert from \"" << from \
276  << "\" to " \
277  << to \
278  << "\" ), you may have more chance recompiling Gyoto with --with-udunits\n"
279 
281 
293 #define GYOTO_DEBUG_EXPR(a) \
294  if (GYOTO_DEBUG_MODE) GYOTO_DEBUG_THIS_EXPR(a)
295 
297 
308 #define GYOTO_DEBUG_THIS_EXPR(a) \
309  GYOTO_DEBUG_THIS \
310  << GYOTO_ANSI_DEBUG_VARIABLE << #a \
311  << GYOTO_ANSI_DEBUG << "=" \
312  << GYOTO_ANSI_DEBUG_VALUE << a << std::endl
313 
315 
331 #define GYOTO_DEBUG_ARRAY(a,n) \
332  if (GYOTO_DEBUG_MODE) GYOTO_DEBUG_THIS_ARRAY(a, n)
333 
335 
351 #define GYOTO_DEBUG_THIS_ARRAY(a,n) { \
352  GYOTO_DEBUG_THIS \
353  << GYOTO_ANSI_DEBUG_VARIABLE << #a \
354  << GYOTO_ANSI_DEBUG << "="; \
355  std::cerr << GYOTO_ANSI_DEBUG_VALUE << "[" << a[0] ; \
356  for (size_t _gyoto_debug_array_i=1; _gyoto_debug_array_i < n; \
357  ++_gyoto_debug_array_i) \
358  std::cerr << "," << a[_gyoto_debug_array_i] ; \
359  std::cerr << "]" << GYOTO_ANSI_RESET << std::endl ;}
360 
362 
370 #define GYOTO_DEBUG_THIS Gyoto::AnsiScope::cerr() \
371  << GYOTO_ANSI_DEBUG_TAG << "DEBUG: " \
372  << GYOTO_ANSI_DEBUG_PRETTY_FUNCTION << __PRETTY_FUNCTION__ \
373  << GYOTO_ANSI_DEBUG_TAG << ": " \
374  << GYOTO_ANSI_DEBUG
375 
377 
386 #define GYOTO_DEBUG if (GYOTO_DEBUG_MODE) GYOTO_DEBUG_THIS
387 
389 
393 #define GYOTO_IF_DEBUG if (GYOTO_DEBUG_MODE) {
394 
396 
400 #define GYOTO_ENDIF_DEBUG }
401 
403 #define GYOTO_DEBUG_MODE Gyoto::debug()
404 
405  //\}
406  //\{
419  typedef unsigned int CoordKind_t;
420 #define GYOTO_COORDKIND_UNSPECIFIED 0
421 #define GYOTO_COORDKIND_CARTESIAN 1
422 #define GYOTO_COORDKIND_SPHERICAL 2
423  //\}
424 }
425 
426 //{
431 #define GYOTO_DEFAULT_X_SIZE 1024
432 
433 
440 #define GYOTO_DEFAULT_DELTA 0.01
441 
445 #define GYOTO_DEFAULT_DELTA_MAX DBL_MAX
446 
450 #define GYOTO_DEFAULT_DELTA_MIN DBL_MIN
451 
460 #define GYOTO_DEFAULT_DELTA_MAX_OVER_R 1.
461 
462 #define GYOTO_DEFAULT_ABSTOL 1e-6
463 #define GYOTO_DEFAULT_RELTOL 1e-6
464 #define GYOTO_DEFAULT_NORMTOL 1e-3
465 
469 #define GYOTO_DEFAULT_MAXITER 100000
470 
476 #define GYOTO_T_TOL 1e-4 //1e-7 //1e-4
477 
478 #define GYOTO_KERR_HORIZON_SECURITY 0.01
479 
481 #define GYOTO_SCREEN_DMAX DBL_MAX
482 
483 //For displays with setw and setprecision
485 #define GYOTO_PREC 15
486 #define GYOTO_WIDTH 25
488 
489 /* Plugins Stuff */
491 #ifndef GYOTO_DEFAULT_PLUGINS
492 #define GYOTO_DEFAULT_PLUGINS "stdplug,nowarn:lorene"
493 #endif
494 
495 #ifndef GYOTO_PLUGIN_SFX
496 #define GYOTO_PLUGIN_SFX "so"
497 #endif
498 
499 //\}
500 
501 //\{
505 #define GYOTO_C 299792458.
507 #define GYOTO_C_CGS 2.99792458e10
509 #define GYOTO_C2_CGS 8.98755178736817668096e+20
511 #define GYOTO_C2_CGS_M1 1.1126500560536184087938986e-21
513 #define GYOTO_G 6.67428e-11
515 #define GYOTO_G_CGS 6.67428e-8
517 #define GYOTO_G_OVER_C_SQUARE 7.4261380161175445989e-28
519 #define GYOTO_G_OVER_C_SQUARE_CGS 7.4261380161175445989e-29
521 #define GYOTO_PLANCK 6.62606896e-34
523 #define GYOTO_PLANCK_CGS 6.62606896e-27
525 #define GYOTO_PLANCK_OVER_C_SQUARE 7.3724959997591407964e-51
527 #define GYOTO_BOLTZMANN 1.3806504e-23
529 #define GYOTO_BOLTZMANN_CGS 1.3806504e-16
531 #define GYOTO_STEFANBOLTZMANN_CGS 5.670373e-5
533 #define GYOTO_PLANCK_OVER_BOLTZMANN 4.7992373449498869688e-11
535 #define GYOTO_GAS_CST 8.3144621
537 #define GYOTO_GAS_CST_CGS 8.3144621e7
539 #define GYOTO_AVOGADRO 6.0221413e23
541 #define GYOTO_THOMSON_CGS 6.6524e-25
543 #define GYOTO_ALPHA_F 0.00729927
545 #define GYOTO_PROTON_MASS_CGS 1.67262158e-24
547 #define GYOTO_ELECTRON_MASS_CGS 9.10938188e-28
549 #define GYOTO_ELECTRON_CLASSICAL_RADIUS_CGS 2.8179e-13
551 #define GYOTO_ELEMENTARY_CHARGE_CGS 4.80320427e-10
553 #define GYOTO_EULER_MASCHERONI 0.577216
555 #define GYOTO_ATOMIC_MASS_UNIT_CGS 1.660537781e-24
557 #define GYOTO_INU_CGS_TO_SI 0.001
559 #define GYOTO_JNU_CGS_TO_SI (GYOTO_INU_CGS_TO_SI * 100.)
561 #define GYOTO_ANU_CGS_TO_SI 100.
563 
565 #define GYOTO_SUN_MASS 1.98843e30
566 #define GYOTO_SUN_MASS_CGS 1.98843e33
568 #define GYOTO_SUN_RADIUS 6.955e8
570 #define GYOTO_KPC 3.08568025e19
572 #define GYOTO_ASTRONOMICAL_UNIT 1.49597870700e11
574 #define GYOTO_LIGHT_YEAR 9.4607304725808e15
576 
578 #define GYOTO_RADEG 57.2957795130823
579 #define GYOTO_DEGRAD 0.0174532925199433
581 #define GYOTO_MINRAD 2.908882086657216e-04
583 #define GYOTO_SECRAD 4.848136811095360e-06
585 #define GYOTO_MASRAD 4.848136811095360e-09
587 #define GYOTO_MUASRAD 4.848136811095360e-12
589 
591 #define GYOTO_eV2Hz 2.417989348e+14
592 
593 //\}
594 
595 //\{
599 #define obskind_t unsigned int
601 #define GYOTO_OBSKIND_ATINFINITY 0
603 #define GYOTO_OBSKIND_KEPLERIAN 1
605 #define GYOTO_OBSKIND_ZAMO 2
607 #define GYOTO_OBSKIND_VELOCITYSPECIFIED 3
609 #define GYOTO_OBSKIND_FULLYSPECIFIED 4
611 //\}
612 
614 #define GYOTO_STRINGIFY(a) GYOTO_STRINGIFY_ARGUMENT(a)
615 
617 #define GYOTO_STRINGIFY_ARGUMENT(a) #a
618 
619 #ifndef GYOTO_NO_DEPRECATED
620 #warning Using deprecated method names.\
621  Define GYOTO_NO_DEPRECATED to disable.
622 //\{
631 # define getMetric metric
632 # define setMetric metric
633 # define setScreen screen
634 # define getScreen screen
635 # define getRmax rMax
636 # define setRmax rMax
637 # define getMass mass
638 # define setMass mass
639 # define getCoordKind coordKind
640 # define setCoordKind coordKind
641 # define getKind kind
642 # define setKind kind
643 # define getSpin spin
644 # define setSpin spin
645 # define getIntegKind integKind
646 # define setIntegKind integKind
647 # define getFileName fileName
648 # define setFileName fileName
649 # define getDistance distance
650 # define setDistance distance
651 # define getPALN PALN
652 # define setPALN PALN
653 # define getArgument argument
654 # define setArgument argument
655 # define getInclination inclination
656 # define setInclination inclination
657 # define getAstrobj astrobj
658 # define setAstrobj astrobj
659 # define getSpectrometer spectrometer
660 # define setSpectrometer spectrometer
661 # define getSpectrum spectrum
662 # define setSpectrum spectrum
663 # define getOpacity opacity
664 # define setOpacity opacity
665 # define setDelta delta
666 # define getDelta delta
667 # define setDelta delta
668 # define getDelta delta
669 # define setDangle2 dangle2
670 # define getDangle2 dangle2
671 # define setDangle1 dangle1
672 # define getDangle1 dangle1
673 # define setAnglekind anglekind
674 # define getTmin tMin
675 # define setTmin tMin
676 # define getTime time
677 # define setTime time
678 # define getFreqObs freqObs
679 # define setFreqObs freqObs
680 # define getFieldOfView fieldOfView
681 # define setFieldOfView fieldOfView
682 # define getRadius radius
683 # define setRadius radius
684 # define getLargeRadius largeRadius
685 # define setLargeRadius largeRadius
686 # define getSmallRadius smallRadius
687 # define setSmallRadius smallRadius
688 # define getCentralDensity centralDensity
689 # define setCentralDensity centralDensity
690 # define getDmax dMax
691 # define setDmax dMax
692 # define getTemperature temperature
693 # define setTemperature temperature
694 # define getScaling scaling
695 # define setScaling scaling
696 # define getPatternVelocity patternVelocity
697 # define setPatternVelocity patternVelocity
698 # define getLambda lambda
699 # define setLambda lambda
700 # define getCentralTempOverVirial centralTempOverVirial
701 # define setCentralTempOverVirial centralTempOverVirial
702 # define getBeta beta
703 # define setBeta beta
704 # define getConstant constant
705 # define setConstant constant
706 # define getExponent exponent
707 # define setExponent exponent
708 # define getFlag_radtransf opticallyThin
709 # define setFlag_radtransf opticallyThin
710 # define getNThreads nThreads
711 # define setNThreads nThreads
712 # define getResolution resolution
713 # define setResolution resolution
714 # define getNSamples nSamples
715 # define setNSamples nSamples
716 # define getSpectralOverSampling spectralOversampling
717 # define setSpectralOverSampling spectralOversampling
718 # define setBinSpectrumConverter binSpectrumConverter
719 # define setSpectrumConverter spectrumConverter
720 # define setIntensityConverter intensityConverter
721 # define getSafetyValue safetyValue;
722 # define setSafetyValue safetyValue;
723 # define setInnerRadius innerRadius;
724 # define getInnerRadius innerRadius;
725 # define setOuterRadius outerRadius;
726 # define getOuterRadius outerRadius;
727 # define setThickness thickness;
728 # define getThickness thickness;
729 # define setDir dir;
730 # define getDir dir;
731 # define setBand band;
732 # define setObserverKind observerKind;
733 # define getObserverKind observerKind;
734 //\}
735 #endif
736 
737 #endif
unsigned int Verbosity_t
Type for verbosity levels.
Definition: GyotoDefs.h:146
Compile-time configuration.
unsigned int CoordKind_t
Type for coordinate system kinds.
Definition: GyotoDefs.h:419
Namespace for the Gyoto library.
Definition: GyotoAnsi.h:245
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:78