Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1
8/*
9 Copyright 2011-2019 Thibaut Paumard, Frederic Vincent
10
11 This file is part of Gyoto.
12
13 Gyoto is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 Gyoto is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27
28#ifndef __GyotoAstrobj_H_
29#define __GyotoAstrobj_H_
30
31#include "GyotoConfig.h"
32
33#include <iostream>
34#include <fstream>
35#include <iomanip>
36#include <string>
37
38#include <GyotoDefs.h>
39#include <GyotoSmartPointer.h>
40#include <GyotoConverters.h>
41#include <GyotoObject.h>
42
43namespace Gyoto{
44 class Photon;
45 namespace Register { class Entry; }
46 namespace Metric { class Generic; }
47 class FactoryMessenger;
48 namespace Astrobj {
49 class Generic;
50 class Properties;
51
62 Subcontractor_t(Gyoto::FactoryMessenger*, std::vector<std::string> const &);
64
76 (FactoryMessenger* fmp, std::vector<std::string> const &plugin) {
77 SmartPointer<T> ao = new T();
78 ao -> plugins(plugin) ;
79#ifdef GYOTO_USE_XERCES
80 if (fmp) ao -> setParameters(fmp);
81#endif
82 return ao;
83 }
85
87
104 std::vector<std::string> &plugin,
105 int errmode = 0);
106
114
120
132 void Register(std::string name, Gyoto::Astrobj::Subcontractor_t* scp);
134 }
135}
136
197: public Gyoto::SmartPointee,
198 public Gyoto::Object
199{
201
202
203 // Data :
204 // -----
205private:
206
215
216 protected:
217
221 SmartPointer<Gyoto::Metric::Generic> gg_;
222
223
233 double rmax_;
234
242
244
247 // Constructors - Destructor
248 // -------------------------
249 public:
251
256
260 Generic(double radmax);
261
265 Generic(std::string kind);
266
270 Generic(const Generic& ) ;
271
288 virtual Generic* clone() const = 0 ;
289
290 virtual ~Generic() ;
291
292 // Accessors
293 // ---------
294 public:
298 virtual SmartPointer<Metric::Generic> metric() const;
299
303 virtual void metric(SmartPointer<Metric::Generic>) ;
304
316 virtual double rMax();
317 virtual double rMax() const;
318
325 virtual double rMax(std::string const &unit);
326 virtual double rMax(std::string const &unit) const;
327
329
333 virtual double deltaMax(double coord[8]);
334
335 const std::string kind() const;
336
343 virtual void rMax(double val);
344
352 virtual void rMax(double val, std::string const &unit);
353
354 GYOTO_OBJECT_ACCESSORS_UNIT(deltaMaxInsideRMax);
355
361 void opticallyThin(bool flag);
363
366 bool opticallyThin() const ;
368
369 void showshadow(bool flag);
370 bool showshadow() const ;
371
372 void redshift(bool flag);
373 bool redshift() const ;
374
383
384 //XML I/O
385 public:
386
387#ifdef GYOTO_USE_XERCES
409 virtual void setParameters(FactoryMessenger *fmp);
410
411
412#endif
413
414 // Outputs
415 // -------
416 public:
451 virtual int Impact(Gyoto::Photon* ph, size_t index,
452 Astrobj::Properties *data=NULL) = 0 ;
454
467 virtual void processHitQuantities(Photon * ph, state_t const &coord_ph_hit,
468 double const * coord_obj_hit, double dt,
469 Astrobj::Properties* data) const;
470 virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
471 double* coord_obj_hit, double dt,
472 Astrobj::Properties* data) const = delete ;
473
523 virtual double emission(double nu_em, double dsem, state_t const &coord_ph,
524 double const coord_obj[8]=NULL)
525 const ;
526 virtual double emission(double nu_em, double dsem, double coord_ph[8],
527 double coord_obj[8]=NULL)
528 const = delete;
529
552 virtual void emission(double Inu[], double const nu_em[], size_t nbnu,
553 double dsem, state_t const &coord_ph,
554 double const coord_obj[8]=NULL) const ;
555 virtual void emission(double Inu[], double nu_em[], size_t nbnu,
556 double dsem, double coord_ph[8],
557 double coord_obj[8]=NULL) const = delete ;
558
562 virtual void radiativeQ(double Inu[], double Taunu[],
563 double const nu_em[], size_t nbnu,
564 double dsem, state_t const &coord_ph,
565 double const coord_obj[8]=NULL) const ;
566 virtual void radiativeQ(double Inu[], double Taunu[],
567 double nu_em[], size_t nbnu,
568 double dsem, double coord_ph[8],
569 double coord_obj[8]=NULL) const = delete ;
570 virtual void radiativeQ(double *Inu, double *Qnu, double *Unu, double *Vnu,
571 double *alphaInu, double *alphaQnu,
572 double *alphaUnu, double *alphaVnu,
573 double *rQnu, double *rUnu, double *rVnu,
574 double const *nuem , size_t nbnu, double dsem,
575 state_t const &cph,
576 double const *co) const ;
577
589 virtual double integrateEmission(double nu1, double nu2, double dsem,
590 state_t const &c_ph, double const c_obj[8]=NULL) const;
592 virtual double integrateEmission(double nu1, double nu2, double dsem,
593 double c_ph[8], double c_obj[8]=NULL) const=delete;
594
600 virtual void integrateEmission(double * I, double const * boundaries,
601 size_t const * chaninds, size_t nbnu,
602 double dsem, state_t const &cph, double const *co) const;
604 virtual void integrateEmission(double * I, double const * boundaries,
605 size_t const * chaninds, size_t nbnu,
606 double dsem, double *cph, double *co) const = delete;
608
618 virtual double transmission(double nuem, double dsem, state_t const &coord_ph, double const coord_obj[8]) const ;
620 virtual double transmission(double nuem, double dsem, state_t const &coord) const = delete;
621 virtual double transmission(double nuem, double dsem, double coord[8]) const = delete;
623
624};
625
656 public:
657 double *intensity;
658 double *time;
659
665 double *distance;
666
670 double * first_dmin;
671
677 int first_dmin_found;
678
683 double *redshift;
684
688 double *spectrum;
689
690 double *stokesQ;
691 double *stokesU;
692 double *stokesV;
693
699 double *binspectrum;
700
705 ptrdiff_t offset;
706
710 double * impactcoords;
711
716 double *user1;
717
722 double *user2;
723
728 double *user3;
729
734 double *user4;
735
740 double *user5;
741# ifdef HAVE_UDUNITS
745 Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
749 Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
753 Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
754# endif
755
757 bool alloc;
758
759 public:
761 Properties (double*, double*);
762
774 void init(size_t nbnuobs=0);
775
782 Properties& operator++();
783
790 Properties& operator+=(ptrdiff_t offset);
791
792 operator Gyoto::Quantity_t () const;
793
794# ifdef HAVE_UDUNITS
795 void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
797 void intensityConverter(std::string);
799 void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
801 void spectrumConverter(std::string);
803 void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
805 void binSpectrumConverter(std::string);
807# endif
808};
809
810#endif
Compile-time configuration.
GYOTO converters.
Gyoto ubiquitous macros and typedefs.
Introspectable objects.
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
#define GYOTO_OBJECT_ACCESSORS_UNIT(method)
Declare a quadruplet of accessors to double member that supports unit.
Definition: GyotoObject.h:70
Reference-counting pointers.
Base class for astronomical object.
Definition: GyotoAstrobj.h:199
int __defaultfeatures
Whether some virtual methods are implemented.
Definition: GyotoAstrobj.h:214
virtual double transmission(double nuem, double dsem, state_t const &coord_ph, double const coord_obj[8]) const
Transmission: exp( αν * dsem )
virtual void setParameters(FactoryMessenger *fmp)
Main loop in Subcontractor_t function.
double deltamaxinsidermax_
Maximum Photon integration step inside rmax_ [geometrical units].
Definition: GyotoAstrobj.h:241
const std::string kind() const
Get the kind of the Astrobj (e.g. "Star")
virtual double integrateEmission(double nu1, double nu2, double dsem, state_t const &c_ph, double const c_obj[8]=NULL) const
∫ν1ν2 Iν dν (or jν)
virtual SmartPointer< Metric::Generic > metric() const
Get the Metric gg_.
bool flag_radtransf_
1 if radiative transfer inside Astrobj, else 0
Definition: GyotoAstrobj.h:243
int shadow_
1 to highlight the shadow region in the image
Definition: GyotoAstrobj.h:245
double rmax_
Maximum distance to the center of the coordinate system [geometrical units].
Definition: GyotoAstrobj.h:233
virtual int Impact(Gyoto::Photon *ph, size_t index, Astrobj::Properties *data=NULL)=0
Does a photon at these coordinates impact the object?
bool opticallyThin() const
Query whether object is optically thin.
virtual void radiativeQ(double Inu[], double Taunu[], double const nu_em[], size_t nbnu, double dsem, state_t const &coord_ph, double const coord_obj[8]=NULL) const
emission and transmission together
virtual Generic * clone() const =0
Cloner.
virtual double emission(double nu_em, double dsem, state_t const &coord_ph, double const coord_obj[8]=NULL) const
Specific intensity Iν
virtual void processHitQuantities(Photon *ph, state_t const &coord_ph_hit, double const *coord_obj_hit, double dt, Astrobj::Properties *data) const
Fills Astrobj::Properties.
virtual double deltaMax(double coord[8])
Get max step constraint for adaptive integration.
virtual double rMax()
Get maximal distance from center of coordinate system.
virtual Gyoto::Quantity_t getDefaultQuantities()
Which quantities to compute if know was requested.
int noredshift_
1 to impose redshift factor g = 1
Definition: GyotoAstrobj.h:246
SmartPointer< Gyoto::Metric::Generic > gg_
The Metric in this end of the Universe.
Definition: GyotoAstrobj.h:221
Observable properties of an Astronomical object.
Definition: GyotoAstrobj.h:654
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
Base class for metrics.
Definition: GyotoMetric.h:162
Object with properties.
Definition: GyotoObject.h:152
A null geodesic transporting light.
Definition: GyotoPhoton.h:56
Entry in a register (or a full register)
Definition: GyotoRegister.h:117
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:81
SmartPointer< Gyoto::Astrobj::Generic > Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)
A function to build instances of a specific Astrobj::Generic sub-class.
Definition: GyotoAstrobj.h:62
Gyoto::Astrobj::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugin, int errmode=0)
Query the Astrobj register.
void initRegister()
Empty the Astrobj register.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugin)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
void Register(std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
Make an Astrobj kind known to the Factory.
Gyoto::Register::Entry * Register_
The Astrobj register.
void init(char const *pluglist=NULL)
Initialise the various registers.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:76