Gyoto
GyotoPhoton.h
Go to the documentation of this file.
1 
9 /*
10  Copyright 2011-2016 Frederic Vincent, Thibaut Paumard
11 
12  This file is part of Gyoto.
13 
14  Gyoto is free software: you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  Gyoto is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef __GyotoPhoton_H_
29 #define __GyotoPhoton_H_
30 
31 #include "GyotoFunctors.h"
32 
33 namespace Gyoto{
34  class Photon;
35  namespace Astrobj { class Generic; }
36 }
37 
38 #include <GyotoDefs.h>
39 #include <GyotoMetric.h>
40 #include <GyotoScreen.h>
41 #include <GyotoWorldline.h>
42 #include <GyotoObject.h>
43 
44 #include <float.h>
45 
53 : public Gyoto::Worldline,
54  public Gyoto::SmartPointee,
55  public Gyoto::Object
56 {
57  friend class Gyoto::SmartPointer<Gyoto::Photon>;
58  // Data :
59  // -----
60 
61  protected:
63 
66  SmartPointer<Gyoto::Astrobj::Generic> object_;
67 
69 
72  double freq_obs_;
73 
75 
79 
81 
85  SmartPointer<Spectrometer::Generic> spectro_;
86 
88 
92  double * transmission_;
93 
96 
97  // Constructors - Destructor
98  // -------------------------
99 
100  public:
101  GYOTO_OBJECT;
104  virtual std::string className() const ;
105  virtual std::string className_l() const ;
106 
110  Photon() ;
111  Photon(const Photon& ) ;
112  Photon* clone() const ;
113  protected:
114  Photon(Photon* orig, size_t i0, int dir, double step_max);
116  public:
118  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
119  double* coord) ;
120 
122  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
123  SmartPointer<Screen> screen, double d_alpha, double d_delta);
124 
125  virtual ~Photon() ;
126 
127  virtual double getMass() const ;
128 
130  void astrobj(SmartPointer<Astrobj::Generic>);
132  SmartPointer<Astrobj::Generic> astrobj() const ;
133 
134  using Worldline::metric;
135  // Set Worldline::metric_ as well as the Astrobj metric
136  void metric(SmartPointer<Metric::Generic>);
137 
138 
140  void spectrometer(SmartPointer<Spectrometer::Generic> spr);
142  SmartPointer<Spectrometer::Generic> spectrometer() const ;
143 
145  void freqObs(double);
147  double freqObs() const;
148 
150  void nb_cross_eqplane(int);
152  int nb_cross_eqplane() const;
153 
154 
155  // Mutators / assignment
156  // ---------------------
157  public:
159 
161 
174  void setInitialCondition(SmartPointer<Metric::Generic> gg,
175  SmartPointer<Astrobj::Generic> obj,
176  const double coord[8]) ;
177 
179 
197  void setInitialCondition(SmartPointer<Metric::Generic> gg,
198  SmartPointer<Astrobj::Generic> obj,
199  const double coord[8],
200  const double Ephi[4],
201  const double Etheta[4]) ;
202 
204 
215  void setInitialCondition(SmartPointer<Metric::Generic> gg,
216  SmartPointer<Astrobj::Generic> obj,
217  SmartPointer<Screen> screen,
218  double d_alpha,
219  double d_delta);
220 
222 
227  int hit(Astrobj::Properties *data=NULL);
228 
247  double findMin(Functor::Double_constDoubleArray* object,
248  double t1, double t2, double &tmin,
249  double threshold = DBL_MIN) ;
250 
252 
264  void findValue(Functor::Double_constDoubleArray* object,
265  double value,
266  double tinside, double &toutside) ;
267 
268 #ifdef GYOTO_USE_XERCES
269  virtual void setParameters(FactoryMessenger *fmp) ;
270  static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
271 #endif
272 
273  /* transmission stuff */
274  public:
276  void resetTransmission() ;
277 
279 
286  double getTransmission(size_t i) const ;
287 
289 
295  double getTransmissionMax() const ;
296 
298 
301  double const * getTransmission() const ;
302 
304 
310  virtual void transmit(size_t i, double t);
311 
313  virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu,
314  double const * aInu, double const * aQnu,
315  double const * aUnu, double const * aVnu,
316  double const * rQnu, double const * rUnu, double const * rVnu) ;
317 
318  private:
320  void _allocateTransmission();
321 
322  public:
323  class Refined;
324 
325 };
326 
349  protected:
351  public:
352  Refined(Photon *parent, size_t i, int dir, double step_max);
354  virtual void transmit(size_t i, double t);
356  virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu,
357  double const * aInu, double const * aQnu,
358  double const * aUnu, double const * aVnu,
359  double const * rQnu, double const * rUnu, double const * rVnu) ;
361 };
362 
363 
364 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
int nb_cross_eqplane_
Nb of crossings of equatorial plane z=0, theta=pi/2.
Definition: GyotoPhoton.h:95
double freq_obs_
Photon&#39;s frequency in observer&#39;s frame.
Definition: GyotoPhoton.h:72
Timelike or null geodesics.
Definition: GyotoWorldline.h:238
virtual std::string className_l() const
"photon"
double * transmission_
Integrated optical transmissions.
Definition: GyotoPhoton.h:92
double getTransmissionMax() const
Get maximum transmission;.
SmartPointer< Spectrometer::Generic > spectro_
Observer&#39;s spectrometer.
Definition: GyotoPhoton.h:85
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Classes with an operator() method.
SmartPointer< Astrobj::Generic > astrobj() const
Get Photon::object_.
#define GYOTO_OBJECT_THREAD_SAFETY
Declare virtual bool isThreadSafe() const.
Definition: GyotoObject.h:99
void setInitialCondition(SmartPointer< Metric::Generic > gg, const double coord[8], const int dir, double const Ephi[4], double const Etheta[4])
Set or re-set the initial condition prior to integration.
double const * getTransmission() const
Get Photon::transmission_.
virtual void setParameters(FactoryMessenger *fmp)
Main loop for parsing Properties from XML description.
Photon * parent_
Parent Photon.
Definition: GyotoPhoton.h:350
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:348
virtual std::string className() const
"Photon"
void setInitialCondition(SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, const double coord[8])
Set or re-set the initial condition prior to integration.
Gyoto ubiquitous macros and typedefs.
Timelike or null geodesics.
Base class for metric description.
virtual double getMass() const
Return 0.
int hit(Astrobj::Properties *data=NULL)
Integrate the geodesic.
double findMin(Functor::Double_constDoubleArray *object, double t1, double t2, double &tmin, double threshold=DBL_MIN)
Find minimum of photon–object distance.
void _allocateTransmission()
Allocate Photon::transmission_.
Introspectable objects.
SmartPointer< Gyoto::Astrobj::Generic > object_
The astronomical target.
Definition: GyotoPhoton.h:66
#define GYOTO_WORLDLINE
Declare the Worldline interface wrappers.
Definition: GyotoWorldline.h:164
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, double const *aInu, double const *aQnu, double const *aUnu, double const *aVnu, double const *rQnu, double const *rUnu, double const *rVnu)
Perform one step of radiative transfer.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
double transmission_freqobs_
Integrated optical transmission.
Definition: GyotoPhoton.h:78
void resetTransmission()
Set transmission to 1 for each channel as well as scalar transmission.
Photon * clone() const
Cloner.
Pointers performing reference counting.
Definition: GyotoProperty.h:45
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:80
double freqObs() const
Get Photon::freq_obs__.
void findValue(Functor::Double_constDoubleArray *object, double value, double tinside, double &toutside)
Find date for which the photon is at a given distance from the object.
Object with properties.
Definition: GyotoObject.h:151
Description of the observer screen.
SmartPointer< Metric::Generic > metric() const
Get metric.
int nb_cross_eqplane() const
Get Photon::nb_cross_eqplane_.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugin)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
virtual void transmit(size_t i, double t)
Update transmission in a given channel.
SmartPointer< Spectrometer::Generic > spectrometer() const
Get Photon::spectro_.