Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2016 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 radiativeq_;
227  int shadow_;
228  int noredshift_;
229  // Constructors - Destructor
230  // -------------------------
231  public:
232  GYOTO_OBJECT;
233 
237  Generic();
238 
242  Generic(double radmax);
243 
247  Generic(std::string kind);
248 
252  Generic(const Generic& ) ;
253 
270  virtual Generic* clone() const = 0 ;
271 
272  virtual ~Generic() ;
273 
274  // Accessors
275  // ---------
276  public:
280  virtual SmartPointer<Metric::Generic> metric() const;
281 
285  virtual void metric(SmartPointer<Metric::Generic>) ;
286 
298  virtual double rMax();
299  virtual double rMax() const;
300 
307  virtual double rMax(std::string const &unit);
308  virtual double rMax(std::string const &unit) const;
309 
311 
315  virtual double deltaMax(double coord[8]);
316 
317  const std::string kind() const;
318 
325  virtual void rMax(double val);
326 
334  virtual void rMax(double val, std::string const &unit);
335 
341  void opticallyThin(bool flag);
343 
346  bool opticallyThin() const ;
348 
349  void radiativeQ(bool flag);
350  bool radiativeQ() const ;
351 
352  void showshadow(bool flag);
353  bool showshadow() const ;
354 
355  void redshift(bool flag);
356  bool redshift() const ;
357 
364  virtual Gyoto::Quantity_t getDefaultQuantities();
366 
367  //XML I/O
368  public:
369 
370 #ifdef GYOTO_USE_XERCES
371 
392  virtual void setParameters(FactoryMessenger *fmp);
393 
394 
395 #endif
396 
397  // Outputs
398  // -------
399  public:
431  virtual int Impact(Gyoto::Photon* ph, size_t index,
432  Astrobj::Properties *data=NULL) = 0 ;
434 
447  virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
448  double* coord_obj_hit, double dt,
449  Astrobj::Properties* data) const;
450 
500  virtual double emission(double nu_em, double dsem, double coord_ph[8],
501  double coord_obj[8]=NULL)
502  const ;
503 
526  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
527  double dsem, double coord_ph[8],
528  double coord_obj[8]=NULL) const ;
529 
530  // Under development
531  virtual void radiativeQ(double Inu[], double Taunu[],
532  double nu_em[], size_t nbnu,
533  double dsem, double coord_ph[8],
534  double coord_obj[8]=NULL) const ;
535 
547  virtual double integrateEmission(double nu1, double nu2, double dsem,
548  double c_ph[8], double c_obj[8]=NULL) const;
550 
556  virtual void integrateEmission(double * I, double const * boundaries,
557  size_t const * chaninds, size_t nbnu,
558  double dsem, double *cph, double *co) const;
560 
570  virtual double transmission(double nuem, double dsem, double coord[8]) const ;
572 
573 };
574 
604  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Properties>;
605  public:
606  double *intensity;
607  double *time;
608 
614  double *distance;
615 
619  double * first_dmin;
620 
626  int first_dmin_found;
627 
632  double *redshift;
633 
637  double *spectrum;
638 
644  double *binspectrum;
645 
650  ptrdiff_t offset;
651 
655  double * impactcoords;
656 
661  double *user1;
662 
667  double *user2;
668 
673  double *user3;
674 
679  double *user4;
680 
685  double *user5;
686 # ifdef HAVE_UDUNITS
687 
690  Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
694  Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
698  Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
699 # endif
700 
702  bool alloc;
703 
704  public:
705  Properties();
706  Properties (double*, double*);
707 
719  void init(size_t nbnuobs=0);
720 
727  Properties& operator++();
728 
735  Properties& operator+=(ptrdiff_t offset);
736 
737  operator Gyoto::Quantity_t () const;
738 
739 # ifdef HAVE_UDUNITS
740  void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
742  void intensityConverter(std::string);
744  void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
746  void spectrumConverter(std::string);
748  void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
750  void binSpectrumConverter(std::string);
752 # endif
753 };
754 
755 #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:603
Entry in a register (or a full register)
Definition: GyotoRegister.h:94