Gyoto
GyotoPhoton.h
Go to the documentation of this file.
1 
9 /*
10  Copyright 2011, 2015 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 
78  double transmission_freqobs_;
79 
81 
85  SmartPointer<Spectrometer::Generic> spectro_;
86 
88 
92  double * transmission_;
93 
94  // Constructors - Destructor
95  // -------------------------
96 
97  public:
100  virtual std::string className() const ;
101  virtual std::string className_l() const ;
102 
106  Photon() ;
107  Photon(const Photon& ) ;
108  Photon* clone() const ;
109  protected:
110  Photon(Photon* orig, size_t i0, int dir, double step_max);
112  public:
114  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
115  double* coord) ;
116 
118  Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
119  SmartPointer<Screen> screen, double d_alpha, double d_delta);
120 
121  virtual ~Photon() ;
122 
123  virtual double getMass() const ;
124 
126  void astrobj(SmartPointer<Astrobj::Generic>);
128  SmartPointer<Astrobj::Generic> astrobj() const ;
129 
130  using Worldline::metric;
131  // Set Worldline::metric_ as well as the Astrobj metric
132  void metric(SmartPointer<Metric::Generic>);
133 
134 
136  void spectrometer(SmartPointer<Spectrometer::Generic> spr);
138  SmartPointer<Spectrometer::Generic> spectrometer() const ;
139 
141  void freqObs(double);
143  double freqObs() const;
144 
145 
146  // Mutators / assignment
147  // ---------------------
148  public:
149 
151 
161  void setInitialCondition(SmartPointer<Metric::Generic> gg,
162  SmartPointer<Astrobj::Generic> obj,
163  const double coord[8]) ;
164 
166 
175  void setInitialCondition(SmartPointer<Metric::Generic> gg,
176  SmartPointer<Astrobj::Generic> obj,
177  SmartPointer<Screen> screen,
178  double d_alpha,
179  double d_delta);
180 
182 
187  int hit(Astrobj::Properties *data=NULL);
188 
207  double findMin(Functor::Double_constDoubleArray* object,
208  double t1, double t2, double &tmin,
209  double threshold = DBL_MIN) ;
210 
212 
224  void findValue(Functor::Double_constDoubleArray* object,
225  double value,
226  double tinside, double &toutside) ;
227 
228 #ifdef GYOTO_USE_XERCES
229  virtual void setParameters(FactoryMessenger *fmp) ;
230  static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
231 #endif
232 
233  /* transmission stuff */
234  public:
236  void resetTransmission() ;
237 
239 
246  double getTransmission(size_t i) const ;
247 
249 
255  double getTransmissionMax() const ;
256 
258 
261  double const * getTransmission() const ;
262 
264 
270  virtual void transmit(size_t i, double t);
271 
272  private:
274  void _allocateTransmission();
275 
276  public:
277  class Refined;
278 
279 };
280 
303  protected:
305  public:
306  Refined(Photon *parent, size_t i, int dir, double step_max);
308  virtual void transmit(size_t i, double t);
310 };
311 
312 
313 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
Timelike or null geodesics.
Definition: GyotoWorldline.h:219
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Classes with an operator() method.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
Photon * parent_
Parent Photon.
Definition: GyotoPhoton.h:304
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:302
Gyoto ubiquitous macros and typedefs.
Timelike or null geodesics.
Base class for metric description.
Introspectable objects.
#define GYOTO_WORLDLINE
Declare the Worldline interface wrappers.
Definition: GyotoWorldline.h:151
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
Pointers performing reference counting.
Definition: GyotoProperty.h:41
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:78
Object with properties.
Definition: GyotoObject.h:136
Description of the observer screen.
SmartPointer< Metric::Generic > metric() const
Get metric.