Gyoto
GyotoPhoton.h
Go to the documentation of this file.
1 
9 /*
10  Copyright 2011 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 
43 #include <float.h>
44 
52  friend class Gyoto::SmartPointer<Gyoto::Photon>;
53  // Data :
54  // -----
55 
56  protected:
58 
61  SmartPointer<Gyoto::Astrobj::Generic> object_;
62 
64 
67  double freq_obs_;
68 
70 
74 
76 
80  SmartPointer<Spectrometer::Generic> spectro_;
81 
83 
87  double * transmission_;
88 
89  // Constructors - Destructor
90  // -------------------------
91 
92  public:
93  virtual std::string className() const ;
94  virtual std::string className_l() const ;
95 
99  Photon() ;
100  Photon(const Photon& ) ;
101  Photon* clone() const ;
102  protected:
103  Photon(Photon* orig, size_t i0, int dir, double step_max);
105  public:
107  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
108  double* coord) ;
109 
111  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
112  SmartPointer<Screen> screen, double d_alpha, double d_delta);
113 
114  virtual ~Photon() ;
115 
116  virtual double getMass() const ;
117 
119  void setAstrobj(SmartPointer<Astrobj::Generic>);
121  SmartPointer<Astrobj::Generic> getAstrobj() const ;
122 
124  void setSpectrometer(SmartPointer<Spectrometer::Generic> spr);
126  SmartPointer<Spectrometer::Generic> getSpectrometer() const ;
127 
129  void setFreqObs(double);
131  double getFreqObs() const;
132 
133 
134  // Mutators / assignment
135  // ---------------------
136  public:
138  void operator=(const Photon&) ;
139 
141 
151  void setInitialCondition(SmartPointer<Metric::Generic> gg,
152  SmartPointer<Astrobj::Generic> obj,
153  const double coord[8]) ;
154 
156 
165  void setInitialCondition(SmartPointer<Metric::Generic> gg,
166  SmartPointer<Astrobj::Generic> obj,
167  SmartPointer<Screen> screen,
168  double d_alpha,
169  double d_delta);
170 
172 
177  int hit(Astrobj::Properties *data=NULL);
178 
197  double findMin(Functor::Double_constDoubleArray* object,
198  double t1, double t2, double &tmin,
199  double threshold = DBL_MIN) ;
200 
202 
214  void findValue(Functor::Double_constDoubleArray* object,
215  double value,
216  double tinside, double &toutside) ;
217 
218 #ifdef GYOTO_USE_XERCES
219  public:
221  void fillElement(FactoryMessenger *fmp);
223  static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
224 #endif
225 
226  /* transmission stuff */
227  public:
229  void resetTransmission() ;
230 
232 
239  double getTransmission(size_t i) const ;
240 
242 
248  double getTransmissionMax() const ;
249 
251 
254  double const * getTransmission() const ;
255 
257 
263  virtual void transmit(size_t i, double t);
264 
265  private:
267  void _allocateTransmission();
268 
269  public:
270  class Refined;
271 
272 };
273 
296  protected:
298  public:
299  Refined(Photon *parent, size_t i, int dir, double step_max);
301  virtual void transmit(size_t i, double t);
303 };
304 
305 
306 #endif
virtual std::string className_l() const
&quot;photon&quot;
double freq_obs_
Photon&#39;s frequency in observer&#39;s frame.
Definition: GyotoPhoton.h:67
double getTransmissionMax() const
Get maximum transmission;.
Timelike or null geodesics.
Definition: GyotoWorldline.h:60
SmartPointer< Astrobj::Generic > getAstrobj() const
Get Photon::object_.
double * transmission_
Integrated optical transmissions.
Definition: GyotoPhoton.h:87
void setFreqObs(double)
Set Photon::freq_obs__.
SmartPointer< Spectrometer::Generic > spectro_
Observer&#39;s spectrometer.
Definition: GyotoPhoton.h:80
A null geodesic transporting light.
Definition: GyotoPhoton.h:51
Classes with an operator() method.
void fillElement(FactoryMessenger *fmp)
Write XML description.
Photon * clone() const
Cloner.
void setSpectrometer(SmartPointer< Spectrometer::Generic > spr)
Set Photon::spectro_.
virtual std::string className() const
&quot;Photon&quot;
Photon * parent_
Parent Photon.
Definition: GyotoPhoton.h:297
double const * getTransmission() const
Get Photon::transmission_.
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:295
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.
void setAstrobj(SmartPointer< Astrobj::Generic >)
Set Photon::object_.
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_.
SmartPointer< Gyoto::Astrobj::Generic > object_
The astronomical target.
Definition: GyotoPhoton.h:61
double transmission_freqobs_
Integrated optical transmission.
Definition: GyotoPhoton.h:73
void resetTransmission()
Set transmission to 1 for each channel as well as scalar transmission.
Pointers performing reference counting.
Definition: GyotoSmartPointer.h:51
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:79
virtual double getMass() const
Return 0.
double getFreqObs() 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.
Description of the observer screen.
static SmartPointer< Photon > Subcontractor(Gyoto::FactoryMessenger *)
Instanciate Photon from XML description.
SmartPointer< Spectrometer::Generic > getSpectrometer() const
Get Photon::spectro_.
virtual void transmit(size_t i, double t)
Update transmission in a given channel.