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:
57  SmartPointer<Gyoto::Astrobj::Generic> object_;
58  double freq_obs_;
60 
61  SmartPointer<Spectrometer> spectro_;
62  double * transmission_;
63 
64  // Constructors - Destructor
65  // -------------------------
66 
67  public:
68  virtual std::string className() const ;
69  virtual std::string className_l() const ;
70 
74  Photon() ;
75  Photon(const Photon& ) ;
76  Photon* clone() const ;
77  protected:
78  Photon(Photon* orig, size_t i0, int dir, double step_max);
80  public:
81  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
82  double* coord) ;
84  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
85  SmartPointer<Screen> screen, double d_alpha, double d_delta);
87 
88  // Constructor from a file (see \c sauve(FILE*) )
89  //Photon(FILE* ) ;
90 
91  virtual ~Photon() ;
92 
93  virtual double getMass() const ;
94 
95  void setAstrobj(SmartPointer<Astrobj::Generic>);
96  SmartPointer<Astrobj::Generic> getAstrobj() const ;
97  void setSpectrometer(SmartPointer<Spectrometer> spr);
98  SmartPointer<Spectrometer> getSpectrometer() const ;
99  double getFreqObs() const;
100 
101 
102  // Mutators / assignment
103  // ---------------------
104  public:
106  void operator=(const Photon&) ;
107 
120  void setInitialCondition(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj, const double coord[8]) ;
122 
136  void setInitialCondition(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj, SmartPointer<Screen> screen, double d_alpha, double d_delta);
138 
139  // int hit(double tlim, Astrobj::Properties *data=NULL); ///< Integrate the geodesic and tell whether this photon hits the object
140  int hit(Astrobj::Properties *data=NULL);
141 
158  double findMin(Functor::Double_constDoubleArray* object,
159  double t1, double t2, double &tmin,
160  double threshold = DBL_MIN) ;
161 
176  void findValue(Functor::Double_constDoubleArray* object,
177  double value,
178  double tinside, double &toutside) ;
179 
180 #ifdef GYOTO_USE_XERCES
181  public:
182  void fillElement(FactoryMessenger *fmp);
183 #endif
184 
185  /* transmission stuff */
186  public:
190  void resetTransmission() ;
197  double getTransmission(size_t i) const ;
199 
203  double const * getTransmission() const ;
205 
214  virtual void transmit(size_t i, double t);
215 
216  private:
217  void _allocateTransmission();
218 
219  public:
220  class Refined;
222 
223 };
224 
242  protected:
244  public:
245  Refined(Photon *parent, size_t i, int dir, double step_max);
247  virtual void transmit(size_t i, double t);
249 };
250 
251 
252 #ifdef GYOTO_USE_XERCES
253 namespace Gyoto {
254  SmartPointer<Photon> PhotonSubcontractor(Gyoto::FactoryMessenger*);
255 }
256 #endif
257 
258 #endif