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