Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2015 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*);
64 
76  (FactoryMessenger* fmp) {
77  SmartPointer<T> ao = new T();
78 #ifdef GYOTO_USE_XERCES
79  if (fmp) ao -> setParameters(fmp);
80 #endif
81  return ao;
82  }
84 
96  int errmode = 0);
98 
106 
110  void initRegister();
112 
124  void Register(std::string name, Gyoto::Astrobj::Subcontractor_t* scp);
126  }
127 }
128 
189 : public Gyoto::SmartPointee,
190  public Gyoto::Object
191 {
192  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Generic>;
193 
194 
195  // Data :
196  // -----
197  protected:
198 
202  SmartPointer<Gyoto::Metric::Generic> gg_;
203 
204 
214  double rmax_;
215 
216  bool flag_radtransf_;
217 
218  int radiativeq_;
219  int noredshift_;
220  // Constructors - Destructor
221  // -------------------------
222  public:
223  GYOTO_OBJECT;
224 
228  Generic();
229 
233  Generic(double radmax);
234 
238  Generic(std::string kind);
239 
243  Generic(const Generic& ) ;
244 
261  virtual Generic* clone() const = 0 ;
262 
263  virtual ~Generic() ;
264 
265  // Accessors
266  // ---------
267  public:
271  virtual SmartPointer<Metric::Generic> metric() const;
272 
276  virtual void metric(SmartPointer<Metric::Generic>) ;
277 
289  virtual double rMax();
290  virtual double rMax() const;
291 
298  virtual double rMax(std::string const &unit);
299  virtual double rMax(std::string const &unit) const;
300 
302 
306  virtual double deltaMax(double coord[8]);
307 
308  const std::string kind() const;
309 
316  virtual void rMax(double val);
317 
325  virtual void rMax(double val, std::string const &unit);
326 
332  void opticallyThin(bool flag);
334 
337  bool opticallyThin() const ;
339 
340  void radiativeQ(bool flag);
341  bool radiativeQ() const ;
342 
343  void redshift(bool flag);
344  bool redshift() const ;
345 
352  virtual Gyoto::Quantity_t getDefaultQuantities();
354 
355  //XML I/O
356  public:
357 
358 #ifdef GYOTO_USE_XERCES
359 
380  virtual void setParameters(FactoryMessenger *fmp);
381 
382 
383 #endif
384 
385  // Outputs
386  // -------
387  public:
419  virtual int Impact(Gyoto::Photon* ph, size_t index,
420  Astrobj::Properties *data=NULL) = 0 ;
422 
435  virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
436  double* coord_obj_hit, double dt,
437  Astrobj::Properties* data) const;
438 
488  virtual double emission(double nu_em, double dsem, double coord_ph[8],
489  double coord_obj[8]=NULL)
490  const ;
491 
514  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
515  double dsem, double coord_ph[8],
516  double coord_obj[8]=NULL) const ;
517 
518  // Under development
519  virtual void radiativeQ(double Inu[], double Taunu[],
520  double nu_em[], size_t nbnu,
521  double dsem, double coord_ph[8],
522  double coord_obj[8]=NULL) const ;
523 
535  virtual double integrateEmission(double nu1, double nu2, double dsem,
536  double c_ph[8], double c_obj[8]=NULL) const;
538 
544  virtual void integrateEmission(double * I, double const * boundaries,
545  size_t const * chaninds, size_t nbnu,
546  double dsem, double *cph, double *co) const;
548 
558  virtual double transmission(double nuem, double dsem, double coord[8]) const ;
560 
561 };
562 
592  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Properties>;
593  public:
594  double *intensity;
595  double *time;
596 
602  double *distance;
603 
607  double * first_dmin;
608 
614  int first_dmin_found;
615 
620  double *redshift;
621 
625  double *spectrum;
626 
632  double *binspectrum;
633 
638  ptrdiff_t offset;
639 
643  double * impactcoords;
644 
649  double *user1;
650 
655  double *user2;
656 
661  double *user3;
662 
667  double *user4;
668 
673  double *user5;
674 # ifdef HAVE_UDUNITS
675 
678  Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
682  Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
686  Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
687 # endif
688 
690  bool alloc;
691 
692  public:
693  Properties();
694  Properties (double*, double*);
695 
707  void init(size_t nbnuobs=0);
708 
715  Properties& operator++();
716 
723  Properties& operator+=(ptrdiff_t offset);
724 
725  operator Gyoto::Quantity_t () const;
726 
727 # ifdef HAVE_UDUNITS
728  void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
730  void intensityConverter(std::string);
732  void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
734  void spectrumConverter(std::string);
736  void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
738  void binSpectrumConverter(std::string);
740 # endif
741 };
742 
743 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Base class for metrics.
Definition: GyotoMetric.h:148
Reference-counting pointers.
void Register(std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
Make an Astrobj kind known to the Factory.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
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.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
unsigned int Quantity_t
Type for observabke quantities.
Definition: GyotoDefs.h:73
SmartPointer< Gyoto::Astrobj::Generic > Subcontractor_t(Gyoto::FactoryMessenger *)
A function to build instances of a specific Astrobj::Generic sub-class.
Definition: GyotoAstrobj.h:62
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:78
GYOTO converters.
Base class for astronomical object.
Definition: GyotoAstrobj.h:188
Object with properties.
Definition: GyotoObject.h:136
Gyoto::Astrobj::Subcontractor_t * getSubcontractor(std::string name, int errmode=0)
Query the Astrobj register.
Observable properties of an Astronomical object.
Definition: GyotoAstrobj.h:591
Entry in a register (or a full register)
Definition: GyotoRegister.h:92