Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2017 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 {
200  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Generic>;
201 
202 
203  // Data :
204  // -----
205  protected:
206 
210  SmartPointer<Gyoto::Metric::Generic> gg_;
211 
212 
222  double rmax_;
223 
224  bool flag_radtransf_;
225 
226  int shadow_;
227  int noredshift_;
228  // Constructors - Destructor
229  // -------------------------
230  public:
231  GYOTO_OBJECT;
232 
236  Generic();
237 
241  Generic(double radmax);
242 
246  Generic(std::string kind);
247 
251  Generic(const Generic& ) ;
252 
269  virtual Generic* clone() const = 0 ;
270 
271  virtual ~Generic() ;
272 
273  // Accessors
274  // ---------
275  public:
279  virtual SmartPointer<Metric::Generic> metric() const;
280 
284  virtual void metric(SmartPointer<Metric::Generic>) ;
285 
297  virtual double rMax();
298  virtual double rMax() const;
299 
306  virtual double rMax(std::string const &unit);
307  virtual double rMax(std::string const &unit) const;
308 
310 
314  virtual double deltaMax(double coord[8]);
315 
316  const std::string kind() const;
317 
324  virtual void rMax(double val);
325 
333  virtual void rMax(double val, std::string const &unit);
334 
340  void opticallyThin(bool flag);
342 
345  bool opticallyThin() const ;
347 
348  void showshadow(bool flag);
349  bool showshadow() const ;
350 
351  void redshift(bool flag);
352  bool redshift() const ;
353 
360  virtual Gyoto::Quantity_t getDefaultQuantities();
362 
363  //XML I/O
364  public:
365 
366 #ifdef GYOTO_USE_XERCES
367 
388  virtual void setParameters(FactoryMessenger *fmp);
389 
390 
391 #endif
392 
393  // Outputs
394  // -------
395  public:
430  virtual int Impact(Gyoto::Photon* ph, size_t index,
431  Astrobj::Properties *data=NULL) = 0 ;
433 
446  virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
447  double* coord_obj_hit, double dt,
448  Astrobj::Properties* data) const;
449 
499  virtual double emission(double nu_em, double dsem, double coord_ph[8],
500  double coord_obj[8]=NULL)
501  const ;
502 
525  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
526  double dsem, double coord_ph[8],
527  double coord_obj[8]=NULL) const ;
528 
532  virtual void radiativeQ(double Inu[], double Taunu[],
533  double nu_em[], size_t nbnu,
534  double dsem, double coord_ph[8],
535  double coord_obj[8]=NULL) const ;
536 
548  virtual double integrateEmission(double nu1, double nu2, double dsem,
549  double c_ph[8], double c_obj[8]=NULL) const;
551 
557  virtual void integrateEmission(double * I, double const * boundaries,
558  size_t const * chaninds, size_t nbnu,
559  double dsem, double *cph, double *co) const;
561 
571  virtual double transmission(double nuem, double dsem, double coord[8]) const ;
573 
574 };
575 
605  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Properties>;
606  public:
607  double *intensity;
608  double *time;
609 
615  double *distance;
616 
620  double * first_dmin;
621 
627  int first_dmin_found;
628 
633  double *redshift;
634 
638  double *spectrum;
639 
645  double *binspectrum;
646 
651  ptrdiff_t offset;
652 
656  double * impactcoords;
657 
662  double *user1;
663 
668  double *user2;
669 
674  double *user3;
675 
680  double *user4;
681 
686  double *user5;
687 # ifdef HAVE_UDUNITS
688 
691  Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
695  Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
699  Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
700 # endif
701 
703  bool alloc;
704 
705  public:
706  Properties();
707  Properties (double*, double*);
708 
720  void init(size_t nbnuobs=0);
721 
728  Properties& operator++();
729 
736  Properties& operator+=(ptrdiff_t offset);
737 
738  operator Gyoto::Quantity_t () const;
739 
740 # ifdef HAVE_UDUNITS
741  void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
743  void intensityConverter(std::string);
745  void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
747  void spectrumConverter(std::string);
749  void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
751  void binSpectrumConverter(std::string);
753 # endif
754 };
755 
756 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Base class for metrics.
Definition: GyotoMetric.h:156
Reference-counting pointers.
void Register(std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
Make an Astrobj kind known to the Factory.
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
void init(char const *pluglist=NULL)
Initialise the various registers.
Gyoto ubiquitous macros and typedefs.
Compile-time configuration.
Gyoto::Register::Entry * Register_
The Astrobj register.
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
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:73
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
GYOTO converters.
Base class for astronomical object.
Definition: GyotoAstrobj.h:196
Object with properties.
Definition: GyotoObject.h:151
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugin)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
Observable properties of an Astronomical object.
Definition: GyotoAstrobj.h:604
Entry in a register (or a full register)
Definition: GyotoRegister.h:94