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 <float.h>
32 
33 #include <Eigen/Dense>
34 
35 #include "GyotoFunctors.h"
36 
37 namespace Gyoto{
38  class Photon;
39  namespace Astrobj { class Generic; }
40 }
41 
42 #include <GyotoDefs.h>
43 #include <GyotoMetric.h>
44 #include <GyotoScreen.h>
45 #include <GyotoWorldline.h>
46 #include <GyotoObject.h>
47 
55 : public Gyoto::Worldline,
56  public Gyoto::SmartPointee,
57  public Gyoto::Object
58 {
59  friend class Gyoto::SmartPointer<Gyoto::Photon>;
60  // Data :
61  // -----
62 
63  protected:
65 
68  SmartPointer<Gyoto::Astrobj::Generic> object_;
69 
71 
74  double freq_obs_;
75 
77 
81 
83 
86  Eigen::Matrix4d transmissionMatrix_freqobs_;
87 
89 
93  SmartPointer<Spectrometer::Generic> spectro_;
94 
96 
100  double * transmission_;
101 
104 
106 
110  Eigen::Matrix4d * transmissionMatrix_;
111 
112  // Constructors - Destructor
113  // -------------------------
114 
115  public:
116  GYOTO_OBJECT;
119  virtual std::string className() const ;
120  virtual std::string className_l() const ;
121 
125  Photon() ;
126  Photon(const Photon& ) ;
127  Photon* clone() const ;
128  protected:
129  Photon(Photon* orig, size_t i0, int dir, double step_max);
131  public:
133  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
134  double* coord) ;
135 
137  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
138  SmartPointer<Screen> screen, double d_alpha, double d_delta);
139 
140  virtual ~Photon() ;
141 
142  virtual double getMass() const ;
143 
145  void astrobj(SmartPointer<Astrobj::Generic>);
147  SmartPointer<Astrobj::Generic> astrobj() const ;
148 
149  using Worldline::metric;
150  // Set Worldline::metric_ as well as the Astrobj metric
151  void metric(SmartPointer<Metric::Generic>);
152 
153 
155  void spectrometer(SmartPointer<Spectrometer::Generic> spr);
157  SmartPointer<Spectrometer::Generic> spectrometer() const ;
158 
160  void freqObs(double);
162  double freqObs() const;
163 
165  void nb_cross_eqplane(int);
167  int nb_cross_eqplane() const;
168 
169 
170  // Mutators / assignment
171  // ---------------------
172  public:
174 
176 
189  void setInitialCondition(SmartPointer<Metric::Generic> gg,
190  SmartPointer<Astrobj::Generic> obj,
191  const double coord[8]) ;
192 
194 
212  void setInitialCondition(SmartPointer<Metric::Generic> gg,
213  SmartPointer<Astrobj::Generic> obj,
214  const double coord[8],
215  const double Ephi[4],
216  const double Etheta[4]) ;
217 
219 
230  void setInitialCondition(SmartPointer<Metric::Generic> gg,
231  SmartPointer<Astrobj::Generic> obj,
232  SmartPointer<Screen> screen,
233  double d_alpha,
234  double d_delta);
235 
237 
242  int hit(Astrobj::Properties *data=NULL);
243 
262  double findMin(Functor::Double_constDoubleArray* object,
263  double t1, double t2, double &tmin,
264  double threshold = DBL_MIN) ;
265 
267 
279  void findValue(Functor::Double_constDoubleArray* object,
280  double value,
281  double tinside, double &toutside) ;
282 
283 #ifdef GYOTO_USE_XERCES
284  virtual void setParameters(FactoryMessenger *fmp) ;
285  static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
286 #endif
287 
288  /* transmission stuff */
289  public:
291  void resetTransmission() ;
294 
296 
303  double getTransmission(size_t i) const ;
304 
306 
313  Eigen::Matrix4d getTransmissionMatrix(size_t i) const ;
314 
316 
322  double getTransmissionMax() const ;
323 
325 
328  double const * getTransmission() const ;
330 
333  Eigen::Matrix4d const * getTransmissionMatrix() const ;
334 
336 
342  virtual void transmit(size_t i, double t);
343 
345 
351  virtual void transmit(size_t i, Eigen::Matrix4d mat);
352  virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu, Eigen::Matrix4d * Onu);
354 
355  private:
357  void _allocateTransmission();
358  void _allocateTransmissionMatrix();
359 
360  public:
361  class Refined;
362 
363 };
364 
387  protected:
389  public:
390  Refined(Photon *parent, size_t i, int dir, double step_max);
392  virtual void transmit(size_t i, double t);
394  virtual void transmit(size_t i, Eigen::Matrix4d mat);
396  virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu, Eigen::Matrix4d * Onu);
398 };
399 
400 
401 #endif
Eigen::Matrix4d * transmissionMatrix_
Integrated optical transmission matrix (polarization)
Definition: GyotoPhoton.h:110
#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:103
double freq_obs_
Photon&#39;s frequency in observer&#39;s frame.
Definition: GyotoPhoton.h:74
Timelike or null geodesics.
Definition: GyotoWorldline.h:254
virtual std::string className_l() const
"photon"
double * transmission_
Integrated optical transmissions.
Definition: GyotoPhoton.h:100
double getTransmissionMax() const
Get maximum transmission;.
SmartPointer< Spectrometer::Generic > spectro_
Observer&#39;s spectrometer.
Definition: GyotoPhoton.h:93
A null geodesic transporting light.
Definition: GyotoPhoton.h:54
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:388
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:386
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:68
#define GYOTO_WORLDLINE
Declare the Worldline interface wrappers.
Definition: GyotoWorldline.h:176
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:46
Eigen::Matrix4d const * getTransmissionMatrix() const
Get Photon::transmissionMatrix_.
double transmission_freqobs_
Integrated optical transmission.
Definition: GyotoPhoton.h:80
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
void resetTransmissionMatrix()
Set transmission matrix to identity matrix for each frequency.
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:79
virtual void transmit(size_t i, double t)
Update transmission in a given channel.
Eigen::Matrix4d transmissionMatrix_freqobs_
Integrated optical transmission matrix (polarization)
Definition: GyotoPhoton.h:86
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, Eigen::Matrix4d *Onu)
Perform one step of polarized radiative transfert and update transmission matrix. ...
SmartPointer< Spectrometer::Generic > spectrometer() const
Get Photon::spectro_.