Gyoto
GyotoDefs.h
Go to the documentation of this file.
1 
5 /*
6  Copyright 2011 Thibaut Paumard
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 
39 #if !HAVE_SINCOS
40 #define sincos(t, s, c) *s=sin(t); *c=cos(t)
41 #else
42 # ifdef DOXYGEN_RUN
43 # define sincos(t, s, c) (undefined)
44 # endif
45 #endif
46 
47 /* Typedef for various Gyoto data types */
48 namespace Gyoto {
49  //\{
72  typedef unsigned int Quantity_t;
74 
75  /* Generic */
76 
77 #define GYOTO_QUANTITY_NONE 0
78 
80 #define GYOTO_QUANTITY_INTENSITY 1
81 #define GYOTO_QUANTITY_EMISSIONTIME 2
83 
87 #define GYOTO_QUANTITY_MIN_DISTANCE 4
88 #define GYOTO_QUANTITY_FIRST_DMIN 8
90 #define GYOTO_QUANTITY_REDSHIFT 16
92 
96 #define GYOTO_QUANTITY_IMPACTCOORDS 32
97 #define GYOTO_QUANTITY_SPECTRUM 512
99 #define GYOTO_QUANTITY_BINSPECTRUM 1024
101  /* Astrobj-specific */
103 #define GYOTO_QUANTITY_USER1 32768
104 #define GYOTO_QUANTITY_USER2 16384
106 #define GYOTO_QUANTITY_USER3 8192
108 #define GYOTO_QUANTITY_USER4 4096
110 #define GYOTO_QUANTITY_USER5 2048
112  //\}
113 
127  //\{
129  typedef unsigned int Verbosity_t;
130 
132 #define GYOTO_DEFAULT_DEBUG_MODE 0
133 
135 
140 #define GYOTO_QUIET_VERBOSITY 1
141 
143 
149 #define GYOTO_SEVERE_VERBOSITY 3
150 
152 
158 #define GYOTO_WARNING_VERBOSITY GYOTO_SEVERE_VERBOSITY
159 
161 
167 #define GYOTO_DEFAULT_VERBOSITY 5
168 
170 
176 #define GYOTO_INFO_VERBOSITY 10
177 
179 
186 #define GYOTO_DEBUG_VERBOSITY 3000
187 
189 
198 #define GYOTO_QUIET if (Gyoto::verbose() >= GYOTO_QUIET_VERBOSITY) std::cout
199 
201 
206 #define GYOTO_SEVERE if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"SEVERE: "
207 
209 
214 #define GYOTO_WARNING if(Gyoto::verbose()>=GYOTO_SEVERE_VERBOSITY) std::cerr<<"WARNING: "
215 
217 
225 #define GYOTO_MSG if (Gyoto::verbose() >= GYOTO_DEFAULT_VERBOSITY) std::cout
226 
228 
236 #define GYOTO_INFO if (Gyoto::verbose() >= GYOTO_INFO_VERBOSITY) std::cerr<<"INFO: "
237 
239 
246 #define GYOTO_WARNING_UDUNITS(from, to) \
247  GYOTO_WARNING << "unit ignored (trying to convert from \"" << from \
248  << "\" to " \
249  << to \
250  << "\"), you may have more chance recompiling Gyoto with --with-udunits\n"
251 
253 
265 #define GYOTO_DEBUG_EXPR(a) GYOTO_DEBUG << #a << "=" << a << std::endl
266 
268 
284 #define GYOTO_DEBUG_ARRAY(a,n) if (GYOTO_DEBUG_MODE) { \
285  std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": " \
286  << #a << "=[" << a[0] ; \
287  for (size_t _gyoto_debug_array_i=1; _gyoto_debug_array_i < n; ++_gyoto_debug_array_i) \
288  std::cerr << "," << a[_gyoto_debug_array_i] ; \
289  std::cerr << "]" << std::endl ;}
290 
292 
301 #define GYOTO_DEBUG if (GYOTO_DEBUG_MODE) std::cerr << "DEBUG: " << __PRETTY_FUNCTION__ << ": "
302 
304 
308 #define GYOTO_IF_DEBUG if (GYOTO_DEBUG_MODE) {
309 
311 
315 #define GYOTO_ENDIF_DEBUG }
316 
318 #define GYOTO_DEBUG_MODE Gyoto::debug()
319 
320  //\}
321  //\{
334  typedef unsigned int CoordKind_t;
335 #define GYOTO_COORDKIND_UNSPECIFIED 0
336 #define GYOTO_COORDKIND_CARTESIAN 1
337 #define GYOTO_COORDKIND_SPHERICAL 2
338  //\}
339 }
340 
341 //{
346 #define GYOTO_DEFAULT_X_SIZE 1024
347 
348 
355 #define GYOTO_DEFAULT_DELTA 0.01
356 
360 #define GYOTO_DEFAULT_DELTA_MAX DBL_MAX
361 
365 #define GYOTO_DEFAULT_DELTA_MIN DBL_MIN
366 
375 #define GYOTO_DEFAULT_DELTA_MAX_OVER_R 1.
376 
377 #define GYOTO_DEFAULT_ABSTOL 1e-6
378 #define GYOTO_DEFAULT_RELTOL 1e-6
379 
383 #define GYOTO_DEFAULT_MAXITER 100000
384 
390 #define GYOTO_T_TOL 1e-4 //1e-7 //1e-4
391 
392 #define GYOTO_KERR_HORIZON_SECURITY 0.01
393 
395 #define GYOTO_SCREEN_DMAX DBL_MAX
396 
397 //For displays with setw and setprecision
399 #define GYOTO_PREC 15
400 #define GYOTO_WIDTH 25
402 
403 /* Plugins Stuff */
405 #ifndef GYOTO_DEFAULT_PLUGINS
406 #define GYOTO_DEFAULT_PLUGINS "stdplug,nofail:lorene"
407 #endif
408 
409 #ifndef GYOTO_PLUGIN_SFX
410 #define GYOTO_PLUGIN_SFX "so"
411 #endif
412 
413 //\}
414 
415 //\{
419 #define GYOTO_C 299792458.
421 #define GYOTO_C_CGS 2.99792458e10
423 #define GYOTO_C2_CGS 8.98755178736817668096e+20
425 #define GYOTO_C2_CGS_M1 1.1126500560536184087938986e-21
427 #define GYOTO_G 6.67428e-11
429 #define GYOTO_G_CGS 6.67428e-8
431 #define GYOTO_G_OVER_C_SQUARE 7.426138e-28
433 #define GYOTO_G_OVER_C_SQUARE_CGS 7.426138e-29
435 #define GYOTO_PLANCK 6.62606896e-34
437 #define GYOTO_PLANCK_CGS 6.62606896e-27
439 #define GYOTO_PLANCK_OVER_C_SQUARE 7.372496e-51
441 #define GYOTO_BOLTZMANN 1.3806504e-23
443 #define GYOTO_BOLTZMANN_CGS 1.3806504e-16
445 #define GYOTO_STEFANBOLTZMANN_CGS 5.670373e-5
447 #define GYOTO_PLANCK_OVER_BOLTZMANN 4.7992373e-11
449 #define GYOTO_GAS_CST 8.3144621
451 #define GYOTO_GAS_CST_CGS 8.3144621e7
453 #define GYOTO_AVOGADRO 6.0221413e23
455 #define GYOTO_THOMSON_CGS 6.6524e-25
457 #define GYOTO_ALPHA_F 0.00729927
459 #define GYOTO_PROTON_MASS_CGS 1.67262158e-24
461 #define GYOTO_ELECTRON_MASS_CGS 9.10938188e-28
463 #define GYOTO_ELECTRON_CLASSICAL_RADIUS_CGS 2.8179e-13
465 #define GYOTO_ELEMENTARY_CHARGE_CGS 4.80320427e-10
467 #define GYOTO_EULER_MASCHERONI 0.577216
469 #define GYOTO_ATOMIC_MASS_UNIT_CGS 1.660537781e-24
471 #define GYOTO_INU_CGS_TO_SI 0.001
473 #define GYOTO_JNU_CGS_TO_SI (GYOTO_INU_CGS_TO_SI * 100.)
475 #define GYOTO_ANU_CGS_TO_SI 100.
477 
479 #define GYOTO_SUN_MASS 1.98843e30
480 #define GYOTO_SUN_MASS_CGS 1.98843e33
482 #define GYOTO_SUN_RADIUS 6.955e8
484 #define GYOTO_KPC 3.08568025e19
486 #define GYOTO_ASTRONOMICAL_UNIT 1.49597870700e11
488 #define GYOTO_LIGHT_YEAR 9.4607304725808e15
490 
492 #define GYOTO_RADEG 57.2957795130823
493 #define GYOTO_DEGRAD 0.0174532925199433
495 #define GYOTO_MINRAD 2.908882086657216e-04
497 #define GYOTO_SECRAD 4.848136811095360e-06
499 #define GYOTO_MASRAD 4.848136811095360e-09
501 #define GYOTO_MUASRAD 4.848136811095360e-12
503 
505 #define GYOTO_eV2Hz 2.417989348e+14
506 
507 //\}
508 
510 #define GYOTO_STRINGIFY(a) GYOTO_STRINGIFY_ARGUMENT(a)
511 
513 #define GYOTO_STRINGIFY_ARGUMENT(a) #a
514 
515 #ifndef GYOTO_NO_DEPRECATED
516 #warning Using deprecated method names.\
517  Define GYOTO_NO_DEPRECATED to disable.
518 //\{
527 # define getMetric metric
528 # define setMetric metric
529 # define setScreen screen
530 # define getScreen screen
531 # define getRmax rMax
532 # define setRmax rMax
533 # define getMass mass
534 # define setMass mass
535 # define getCoordKind coordKind
536 # define setCoordKind coordKind
537 # define getKind kind
538 # define setKind kind
539 # define getSpin spin
540 # define setSpin spin
541 # define getIntegKind integKind
542 # define setIntegKind integKind
543 # define getFileName fileName
544 # define setFileName fileName
545 # define getDistance distance
546 # define setDistance distance
547 # define getPALN PALN
548 # define setPALN PALN
549 # define getArgument argument
550 # define setArgument argument
551 # define getInclination inclination
552 # define setInclination inclination
553 # define getAstrobj astrobj
554 # define setAstrobj astrobj
555 # define getSpectrometer spectrometer
556 # define setSpectrometer spectrometer
557 # define getSpectrum spectrum
558 # define setSpectrum spectrum
559 # define getOpacity opacity
560 # define setOpacity opacity
561 # define setDelta delta
562 # define getDelta delta
563 # define setDelta delta
564 # define getDelta delta
565 # define setDangle2 dangle2
566 # define getDangle2 dangle2
567 # define setDangle1 dangle1
568 # define getDangle1 dangle1
569 # define setAnglekind anglekind
570 # define getTmin tMin
571 # define setTmin tMin
572 # define getTime time
573 # define setTime time
574 # define getFreqObs freqObs
575 # define setFreqObs freqObs
576 # define getFieldOfView fieldOfView
577 # define setFieldOfView fieldOfView
578 # define getRadius radius
579 # define setRadius radius
580 # define getLargeRadius largeRadius
581 # define setLargeRadius largeRadius
582 # define getSmallRadius smallRadius
583 # define setSmallRadius smallRadius
584 # define getCentralDensity centralDensity
585 # define setCentralDensity centralDensity
586 # define getDmax dMax
587 # define setDmax dMax
588 # define getTemperature temperature
589 # define setTemperature temperature
590 # define getScaling scaling
591 # define setScaling scaling
592 # define getPatternVelocity patternVelocity
593 # define setPatternVelocity patternVelocity
594 # define getLambda lambda
595 # define setLambda lambda
596 # define getCentralTempOverVirial centralTempOverVirial
597 # define setCentralTempOverVirial centralTempOverVirial
598 # define getBeta beta
599 # define setBeta beta
600 # define getConstant constant
601 # define setConstant constant
602 # define getExponent exponent
603 # define setExponent exponent
604 # define getFlag_radtransf opticallyThin
605 # define setFlag_radtransf opticallyThin
606 # define getNThreads nThreads
607 # define setNThreads nThreads
608 # define getResolution resolution
609 # define setResolution resolution
610 # define getNSamples nSamples
611 # define setNSamples nSamples
612 # define getSpectralOverSampling spectralOversampling
613 # define setSpectralOverSampling spectralOversampling
614 # define setBinSpectrumConverter binSpectrumConverter
615 # define setSpectrumConverter spectrumConverter
616 # define setIntensityConverter intensityConverter
617 # define getSafetyValue safetyValue;
618 # define setSafetyValue safetyValue;
619 # define setInnerRadius innerRadius;
620 # define getInnerRadius innerRadius;
621 # define setOuterRadius outerRadius;
622 # define getOuterRadius outerRadius;
623 # define setThickness thickness;
624 # define getThickness thickness;
625 # define setDir dir;
626 # define getDir dir;
627 # define setBand band;
628 # define setObserverKind observerKind;
629 # define getObserverKind observerKind;
630 //\}
631 #endif
632 
633 #endif
unsigned int Verbosity_t
Type for verbosity levels.
Definition: GyotoDefs.h:129
Compile-time configuration.
unsigned int CoordKind_t
Type for coordinate system kinds.
Definition: GyotoDefs.h:334
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:73