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 
64 
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 shadow_;
220  int noredshift_;
221  // Constructors - Destructor
222  // -------------------------
223  public:
224  GYOTO_OBJECT;
225 
229  Generic();
230 
234  Generic(double radmax);
235 
239  Generic(std::string kind);
240 
244  Generic(const Generic& ) ;
245 
262  virtual Generic* clone() const = 0 ;
263 
264  virtual ~Generic() ;
265 
266  // Accessors
267  // ---------
268  public:
272  virtual SmartPointer<Metric::Generic> metric() const;
273 
277  virtual void metric(SmartPointer<Metric::Generic>) ;
278 
290  virtual double rMax();
291  virtual double rMax() const;
292 
299  virtual double rMax(std::string const &unit);
300  virtual double rMax(std::string const &unit) const;
301 
303 
307  virtual double deltaMax(double coord[8]);
308 
309  const std::string kind() const;
310 
317  virtual void rMax(double val);
318 
326  virtual void rMax(double val, std::string const &unit);
327 
333  void opticallyThin(bool flag);
335 
338  bool opticallyThin() const ;
340 
341  void radiativeQ(bool flag);
342  bool radiativeQ() const ;
343 
344  void showshadow(bool flag);
345  bool showshadow() const ;
346 
347  void redshift(bool flag);
348  bool redshift() const ;
349 
356  virtual Gyoto::Quantity_t getDefaultQuantities();
358 
359  //XML I/O
360  public:
361 
362 #ifdef GYOTO_USE_XERCES
363 
384  virtual void setParameters(FactoryMessenger *fmp);
385 
386 
387 #endif
388 
389  // Outputs
390  // -------
391  public:
423  virtual int Impact(Gyoto::Photon* ph, size_t index,
424  Astrobj::Properties *data=NULL) = 0 ;
426 
439  virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
440  double* coord_obj_hit, double dt,
441  Astrobj::Properties* data) const;
442 
492  virtual double emission(double nu_em, double dsem, double coord_ph[8],
493  double coord_obj[8]=NULL)
494  const ;
495 
518  virtual void emission(double Inu[], double nu_em[], size_t nbnu,
519  double dsem, double coord_ph[8],
520  double coord_obj[8]=NULL) const ;
521 
522  // Under development
523  virtual void radiativeQ(double Inu[], double Taunu[],
524  double nu_em[], size_t nbnu,
525  double dsem, double coord_ph[8],
526  double coord_obj[8]=NULL) const ;
527 
539  virtual double integrateEmission(double nu1, double nu2, double dsem,
540  double c_ph[8], double c_obj[8]=NULL) const;
542 
548  virtual void integrateEmission(double * I, double const * boundaries,
549  size_t const * chaninds, size_t nbnu,
550  double dsem, double *cph, double *co) const;
552 
562  virtual double transmission(double nuem, double dsem, double coord[8]) const ;
564 
565 };
566 
596  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Properties>;
597  public:
598  double *intensity;
599  double *time;
600 
606  double *distance;
607 
611  double * first_dmin;
612 
618  int first_dmin_found;
619 
624  double *redshift;
625 
629  double *spectrum;
630 
636  double *binspectrum;
637 
642  ptrdiff_t offset;
643 
647  double * impactcoords;
648 
653  double *user1;
654 
659  double *user2;
660 
665  double *user3;
666 
671  double *user4;
672 
677  double *user5;
678 # ifdef HAVE_UDUNITS
679 
682  Gyoto::SmartPointer<Gyoto::Units::Converter> intensity_converter_ ;
686  Gyoto::SmartPointer<Gyoto::Units::Converter> spectrum_converter_ ;
690  Gyoto::SmartPointer<Gyoto::Units::Converter> binspectrum_converter_ ;
691 # endif
692 
694  bool alloc;
695 
696  public:
697  Properties();
698  Properties (double*, double*);
699 
711  void init(size_t nbnuobs=0);
712 
719  Properties& operator++();
720 
727  Properties& operator+=(ptrdiff_t offset);
728 
729  operator Gyoto::Quantity_t () const;
730 
731 # ifdef HAVE_UDUNITS
732  void intensityConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
734  void intensityConverter(std::string);
736  void spectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
738  void spectrumConverter(std::string);
740  void binSpectrumConverter(Gyoto::SmartPointer<Gyoto::Units::Converter>);
742  void binSpectrumConverter(std::string);
744 # endif
745 };
746 
747 #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
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.
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:595
Entry in a register (or a full register)
Definition: GyotoRegister.h:92