Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2020 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 
43 namespace 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 
118  void initRegister();
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  // -----
205 private:
206 
215 
216  protected:
217 
221  SmartPointer<Gyoto::Metric::Generic> gg_;
222 
223 
233  double rmax_;
234 
242 
244 
245  int shadow_;
247  // Constructors - Destructor
248  // -------------------------
249  public:
250  GYOTO_OBJECT;
251 
255  Generic();
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
388 
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 *nbcrosseqplane;
689 
693  double *spectrum;
694 
695  double *stokesQ;
696  double *stokesU;
697  double *stokesV;
698 
704  double *binspectrum;
705 
710  ptrdiff_t offset;
711 
715  double * impactcoords;
716 
721  double *user1;
722 
727  double *user2;
728 
733  double *user3;
734 
739  double *user4;
740 
745  double *user5;
746 # ifdef HAVE_UDUNITS
747 
750  Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
754  Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
758  Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
759 # endif
760 
762  bool alloc;
763 
764  public:
765  Properties();
766  Properties (double*, double*);
767 
779  void init(size_t nbnuobs=0);
780 
787  Properties& operator++();
788 
795  Properties& operator+=(ptrdiff_t offset);
796 
797  operator Gyoto::Quantity_t () const;
798 
799 # ifdef HAVE_UDUNITS
800  void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
802  void intensityConverter(std::string);
804  void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
806  void spectrumConverter(std::string);
808  void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
810  void binSpectrumConverter(std::string);
812 # endif
813 };
814 
815 #endif
int noredshift_
1 to impose redshift factor g = 1
Definition: GyotoAstrobj.h:246
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
virtual Gyoto::Quantity_t getDefaultQuantities()
Which quantities to compute if know was requested.
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 double deltaMax(double coord[8])
Get max step constraint for adaptive integration.
virtual double transmission(double nuem, double dsem, state_t const &coord_ph, double const coord_obj[8]) const
Transmission: exp( αν * dsem )
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Base class for metrics.
Definition: GyotoMetric.h:158
Reference-counting pointers.
void Register(std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
Make an Astrobj kind known to the Factory.
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ν)
SmartPointer< Gyoto::Metric::Generic > gg_
The Metric in this end of the Universe.
Definition: GyotoAstrobj.h:221
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
void init(char const *pluglist=NULL)
Initialise the various registers.
virtual double rMax()
Get maximal distance from center of coordinate system.
double rmax_
Maximum distance to the center of the coordinate system [geometrical units].
Definition: GyotoAstrobj.h:233
Gyoto ubiquitous macros and typedefs.
Compile-time configuration.
Gyoto::Register::Entry * Register_
The Astrobj register.
const std::string kind() const
Get the kind of the Astrobj (e.g. "Star")
int shadow_
1 to highlight the shadow region in the image
Definition: GyotoAstrobj.h:245
void initRegister()
Empty the Astrobj register.
Introspectable objects.
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
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
virtual void setParameters(FactoryMessenger *fmp)
Main loop in Subcontractor_t function.
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:76
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.
double deltamaxinsidermax_
Maximum Photon integration step inside rmax_ [geometrical units].
Definition: GyotoAstrobj.h:241
Gyoto::Astrobj::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugin, int errmode=0)
Query the Astrobj register.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:80
virtual int Impact(Gyoto::Photon *ph, size_t index, Astrobj::Properties *data=NULL)=0
Does a photon at these coordinates impact the object?
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
GYOTO converters.
virtual Generic * clone() const =0
Cloner.
Base class for astronomical object.
Definition: GyotoAstrobj.h:196
Object with properties.
Definition: GyotoObject.h:151
bool opticallyThin() const
Query whether object is optically thin.
int __defaultfeatures
Whether some virtual methods are implemented.
Definition: GyotoAstrobj.h:214
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugin)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
#define GYOTO_OBJECT_ACCESSORS_UNIT(method)
Declare a quadruplet of accessors to double member that supports unit.
Definition: GyotoObject.h:70
virtual double emission(double nu_em, double dsem, state_t const &coord_ph, double const coord_obj[8]=NULL) const
Specific intensity Iν
Observable properties of an Astronomical object.
Definition: GyotoAstrobj.h:654
Entry in a register (or a full register)
Definition: GyotoRegister.h:117