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 "GyotoConfig.h"
28 #include <float.h>
29 #include <vector>
30 
40 #if !HAVE_SINCOS
41 #define sincos(t, s, c) *s=sin(t); *c=cos(t)
42 #else
43 # ifdef DOXYGEN_RUN
44 # define sincos(t, s, c) (undefined)
45 # endif
46 #endif
47 
48 /* Typedef for various Gyoto data types */
49 namespace Gyoto {
50  typedef std::vector<double> state_t;
51 
52  //\{
75  typedef unsigned int Quantity_t;
77 
78  /* Generic */
79 
80 #define GYOTO_QUANTITY_NONE 0
81 
83 #define GYOTO_QUANTITY_INTENSITY 1<<0
84 #define GYOTO_QUANTITY_EMISSIONTIME 1<<1
86 
90 #define GYOTO_QUANTITY_MIN_DISTANCE 1<<2
91 #define GYOTO_QUANTITY_FIRST_DMIN 1<<3
93 #define GYOTO_QUANTITY_REDSHIFT 1<<4
95 
99 #define GYOTO_QUANTITY_IMPACTCOORDS 1<<5
100 #define GYOTO_QUANTITY_SPECTRUM 1<<6
102 #define GYOTO_QUANTITY_SPECTRUM_STOKES_Q 1<<7
104 #define GYOTO_QUANTITY_SPECTRUM_STOKES_U 1<<8
106 #define GYOTO_QUANTITY_SPECTRUM_STOKES_V 1<<9
108 #define GYOTO_QUANTITY_BINSPECTRUM 1<<10
110 #define GYOTO_QUANTITY_NBCROSSEQPLANE 1<<11
112  /* Astrobj-specific */
114 #define GYOTO_QUANTITY_USER1 1<<31
115 #define GYOTO_QUANTITY_USER2 1<<30
117 #define GYOTO_QUANTITY_USER3 1<<29
119 #define GYOTO_QUANTITY_USER4 1<<28
121 #define GYOTO_QUANTITY_USER5 1<<27
123 #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)
125 #define GYOTO_QUANTITY_SPECTRUM_STOKES (GYOTO_QUANTITY_SPECTRUM | GYOTO_QUANTITY_SPECTRUM_STOKES_Q | GYOTO_QUANTITY_SPECTRUM_STOKES_U | GYOTO_QUANTITY_SPECTRUM_STOKES_V)
127  //\}
128 
142  //\{
144  typedef unsigned int Verbosity_t;
145 
147 #define GYOTO_DEFAULT_DEBUG_MODE 0
148 
150 
155 #define GYOTO_QUIET_VERBOSITY 1
156 
158 
164 #define GYOTO_SEVERE_VERBOSITY 3
165 
167 
173 #define GYOTO_WARNING_VERBOSITY GYOTO_SEVERE_VERBOSITY
174 
176 
182 #define GYOTO_DEFAULT_VERBOSITY 5
183 
185 
191 #define GYOTO_INFO_VERBOSITY 10
192 
194 
201 #define GYOTO_DEBUG_VERBOSITY 3000
202 
204 
213 #define GYOTO_QUIET if (Gyoto::verbose() >= GYOTO_QUIET_VERBOSITY) std::cout
214 
216 
221 #define GYOTO_SEVERE if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"SEVERE: "
222 
224 
229 #define GYOTO_WARNING if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"WARNING: "
230 
232 
240 #define GYOTO_MSG if (Gyoto::verbose() >= GYOTO_DEFAULT_VERBOSITY) std::cout
241 
243 
251 #define GYOTO_INFO if (Gyoto::verbose() >= GYOTO_INFO_VERBOSITY) std::cerr<<"INFO: "
252 
254 
261 #define GYOTO_WARNING_UDUNITS(from, to) \
262  GYOTO_WARNING << "unit ignored (trying to convert from \"" << from \
263  << "\" to " \
264  << to \
265  << "\"), you may have more chance recompiling Gyoto with --with-udunits\n"
266 
268 
280 #define GYOTO_DEBUG_EXPR(a) GYOTO_DEBUG << #a << "=" << a << std::endl
281 
283 
294 #define GYOTO_DEBUG_THIS_EXPR(a) GYOTO_DEBUG_THIS << #a << "=" << a << std::endl
295 
297 
313 #define GYOTO_DEBUG_ARRAY(a,n) if (GYOTO_DEBUG_MODE) { \
314  std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": " \
315  << #a << "=[" << a[0] ; \
316  for (size_t _gyoto_debug_array_i=1; _gyoto_debug_array_i < n; ++_gyoto_debug_array_i) \
317  std::cerr << "," << a[_gyoto_debug_array_i] ; \
318  std::cerr << "]" << std::endl ;}
319 
321 
329 #define GYOTO_DEBUG_THIS std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": "
330 
332 
341 #define GYOTO_DEBUG if (GYOTO_DEBUG_MODE) GYOTO_DEBUG_THIS
342 
344 
348 #define GYOTO_IF_DEBUG if (GYOTO_DEBUG_MODE) {
349 
351 
355 #define GYOTO_ENDIF_DEBUG }
356 
358 #define GYOTO_DEBUG_MODE Gyoto::debug()
359 
360  //\}
361  //\{
374  typedef unsigned int CoordKind_t;
375 #define GYOTO_COORDKIND_UNSPECIFIED 0
376 #define GYOTO_COORDKIND_CARTESIAN 1
377 #define GYOTO_COORDKIND_SPHERICAL 2
378  //\}
379 }
380 
381 //{
386 #define GYOTO_DEFAULT_X_SIZE 1024
387 
388 
395 #define GYOTO_DEFAULT_DELTA 0.01
396 
400 #define GYOTO_DEFAULT_DELTA_MAX DBL_MAX
401 
405 #define GYOTO_DEFAULT_DELTA_MIN DBL_MIN
406 
415 #define GYOTO_DEFAULT_DELTA_MAX_OVER_R 1.
416 
417 #define GYOTO_DEFAULT_ABSTOL 1e-6
418 #define GYOTO_DEFAULT_RELTOL 1e-6
419 
423 #define GYOTO_DEFAULT_MAXITER 100000
424 
430 #define GYOTO_T_TOL 1e-4 //1e-7 //1e-4
431 
432 #define GYOTO_KERR_HORIZON_SECURITY 0.01
433 
435 #define GYOTO_SCREEN_DMAX DBL_MAX
436 
437 //For displays with setw and setprecision
439 #define GYOTO_PREC 15
440 #define GYOTO_WIDTH 25
442 
443 /* Plugins Stuff */
445 #ifndef GYOTO_DEFAULT_PLUGINS
446 #define GYOTO_DEFAULT_PLUGINS "stdplug,nofail:lorene"
447 #endif
448 
449 #ifndef GYOTO_PLUGIN_SFX
450 #define GYOTO_PLUGIN_SFX "so"
451 #endif
452 
453 //\}
454 
455 //\{
459 #define GYOTO_C 299792458.
461 #define GYOTO_C_CGS 2.99792458e10
463 #define GYOTO_C2_CGS 8.98755178736817668096e+20
465 #define GYOTO_C2_CGS_M1 1.1126500560536184087938986e-21
467 #define GYOTO_G 6.67428e-11
469 #define GYOTO_G_CGS 6.67428e-8
471 #define GYOTO_G_OVER_C_SQUARE 7.4261380161175445989e-28
473 #define GYOTO_G_OVER_C_SQUARE_CGS 7.4261380161175445989e-29
475 #define GYOTO_PLANCK 6.62606896e-34
477 #define GYOTO_PLANCK_CGS 6.62606896e-27
479 #define GYOTO_PLANCK_OVER_C_SQUARE 7.3724959997591407964e-51
481 #define GYOTO_BOLTZMANN 1.3806504e-23
483 #define GYOTO_BOLTZMANN_CGS 1.3806504e-16
485 #define GYOTO_STEFANBOLTZMANN_CGS 5.670373e-5
487 #define GYOTO_PLANCK_OVER_BOLTZMANN 4.7992373449498869688e-11
489 #define GYOTO_GAS_CST 8.3144621
491 #define GYOTO_GAS_CST_CGS 8.3144621e7
493 #define GYOTO_AVOGADRO 6.0221413e23
495 #define GYOTO_THOMSON_CGS 6.6524e-25
497 #define GYOTO_ALPHA_F 0.00729927
499 #define GYOTO_PROTON_MASS_CGS 1.67262158e-24
501 #define GYOTO_ELECTRON_MASS_CGS 9.10938188e-28
503 #define GYOTO_ELECTRON_CLASSICAL_RADIUS_CGS 2.8179e-13
505 #define GYOTO_ELEMENTARY_CHARGE_CGS 4.80320427e-10
507 #define GYOTO_EULER_MASCHERONI 0.577216
509 #define GYOTO_ATOMIC_MASS_UNIT_CGS 1.660537781e-24
511 #define GYOTO_INU_CGS_TO_SI 0.001
513 #define GYOTO_JNU_CGS_TO_SI (GYOTO_INU_CGS_TO_SI * 100.)
515 #define GYOTO_ANU_CGS_TO_SI 100.
517 
519 #define GYOTO_SUN_MASS 1.98843e30
520 #define GYOTO_SUN_MASS_CGS 1.98843e33
522 #define GYOTO_SUN_RADIUS 6.955e8
524 #define GYOTO_KPC 3.08568025e19
526 #define GYOTO_ASTRONOMICAL_UNIT 1.49597870700e11
528 #define GYOTO_LIGHT_YEAR 9.4607304725808e15
530 
532 #define GYOTO_RADEG 57.2957795130823
533 #define GYOTO_DEGRAD 0.0174532925199433
535 #define GYOTO_MINRAD 2.908882086657216e-04
537 #define GYOTO_SECRAD 4.848136811095360e-06
539 #define GYOTO_MASRAD 4.848136811095360e-09
541 #define GYOTO_MUASRAD 4.848136811095360e-12
543 
545 #define GYOTO_eV2Hz 2.417989348e+14
546 
547 //\}
548 
549 //\{
553 #define obskind_t unsigned int
555 #define GYOTO_OBSKIND_ATINFINITY 0
557 #define GYOTO_OBSKIND_KEPLERIAN 1
559 #define GYOTO_OBSKIND_ZAMO 2
561 #define GYOTO_OBSKIND_VELOCITYSPECIFIED 3
563 #define GYOTO_OBSKIND_FULLYSPECIFIED 4
565 //\}
566 
568 #define GYOTO_STRINGIFY(a) GYOTO_STRINGIFY_ARGUMENT(a)
569 
571 #define GYOTO_STRINGIFY_ARGUMENT(a) #a
572 
573 #ifndef GYOTO_NO_DEPRECATED
574 #warning Using deprecated method names.\
575  Define GYOTO_NO_DEPRECATED to disable.
576 //\{
585 # define getMetric metric
586 # define setMetric metric
587 # define setScreen screen
588 # define getScreen screen
589 # define getRmax rMax
590 # define setRmax rMax
591 # define getMass mass
592 # define setMass mass
593 # define getCoordKind coordKind
594 # define setCoordKind coordKind
595 # define getKind kind
596 # define setKind kind
597 # define getSpin spin
598 # define setSpin spin
599 # define getIntegKind integKind
600 # define setIntegKind integKind
601 # define getFileName fileName
602 # define setFileName fileName
603 # define getDistance distance
604 # define setDistance distance
605 # define getPALN PALN
606 # define setPALN PALN
607 # define getArgument argument
608 # define setArgument argument
609 # define getInclination inclination
610 # define setInclination inclination
611 # define getAstrobj astrobj
612 # define setAstrobj astrobj
613 # define getSpectrometer spectrometer
614 # define setSpectrometer spectrometer
615 # define getSpectrum spectrum
616 # define setSpectrum spectrum
617 # define getOpacity opacity
618 # define setOpacity opacity
619 # define setDelta delta
620 # define getDelta delta
621 # define setDelta delta
622 # define getDelta delta
623 # define setDangle2 dangle2
624 # define getDangle2 dangle2
625 # define setDangle1 dangle1
626 # define getDangle1 dangle1
627 # define setAnglekind anglekind
628 # define getTmin tMin
629 # define setTmin tMin
630 # define getTime time
631 # define setTime time
632 # define getFreqObs freqObs
633 # define setFreqObs freqObs
634 # define getFieldOfView fieldOfView
635 # define setFieldOfView fieldOfView
636 # define getRadius radius
637 # define setRadius radius
638 # define getLargeRadius largeRadius
639 # define setLargeRadius largeRadius
640 # define getSmallRadius smallRadius
641 # define setSmallRadius smallRadius
642 # define getCentralDensity centralDensity
643 # define setCentralDensity centralDensity
644 # define getDmax dMax
645 # define setDmax dMax
646 # define getTemperature temperature
647 # define setTemperature temperature
648 # define getScaling scaling
649 # define setScaling scaling
650 # define getPatternVelocity patternVelocity
651 # define setPatternVelocity patternVelocity
652 # define getLambda lambda
653 # define setLambda lambda
654 # define getCentralTempOverVirial centralTempOverVirial
655 # define setCentralTempOverVirial centralTempOverVirial
656 # define getBeta beta
657 # define setBeta beta
658 # define getConstant constant
659 # define setConstant constant
660 # define getExponent exponent
661 # define setExponent exponent
662 # define getFlag_radtransf opticallyThin
663 # define setFlag_radtransf opticallyThin
664 # define getNThreads nThreads
665 # define setNThreads nThreads
666 # define getResolution resolution
667 # define setResolution resolution
668 # define getNSamples nSamples
669 # define setNSamples nSamples
670 # define getSpectralOverSampling spectralOversampling
671 # define setSpectralOverSampling spectralOversampling
672 # define setBinSpectrumConverter binSpectrumConverter
673 # define setSpectrumConverter spectrumConverter
674 # define setIntensityConverter intensityConverter
675 # define getSafetyValue safetyValue;
676 # define setSafetyValue safetyValue;
677 # define setInnerRadius innerRadius;
678 # define getInnerRadius innerRadius;
679 # define setOuterRadius outerRadius;
680 # define getOuterRadius outerRadius;
681 # define setThickness thickness;
682 # define getThickness thickness;
683 # define setDir dir;
684 # define getDir dir;
685 # define setBand band;
686 # define setObserverKind observerKind;
687 # define getObserverKind observerKind;
688 //\}
689 #endif
690 
691 #endif
unsigned int Verbosity_t
Type for verbosity levels.
Definition: GyotoDefs.h:144
Compile-time configuration.
unsigned int CoordKind_t
Type for coordinate system kinds.
Definition: GyotoDefs.h:374
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:76