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 
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:
150  void operator=(const Photon&) ;
151 
153 
163  void setInitialCondition(SmartPointer<Metric::Generic> gg,
164  SmartPointer<Astrobj::Generic> obj,
165  const double coord[8]) ;
166 
168 
177  void setInitialCondition(SmartPointer<Metric::Generic> gg,
178  SmartPointer<Astrobj::Generic> obj,
179  SmartPointer<Screen> screen,
180  double d_alpha,
181  double d_delta);
182 
184 
189  int hit(Astrobj::Properties *data=NULL);
190 
209  double findMin(Functor::Double_constDoubleArray* object,
210  double t1, double t2, double &tmin,
211  double threshold = DBL_MIN) ;
212 
214 
226  void findValue(Functor::Double_constDoubleArray* object,
227  double value,
228  double tinside, double &toutside) ;
229 
230 #ifdef GYOTO_USE_XERCES
231  virtual void setParameters(FactoryMessenger *fmp) ;
232  static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
233 #endif
234 
235  /* transmission stuff */
236  public:
238  void resetTransmission() ;
239 
241 
248  double getTransmission(size_t i) const ;
249 
251 
257  double getTransmissionMax() const ;
258 
260 
263  double const * getTransmission() const ;
264 
266 
272  virtual void transmit(size_t i, double t);
273 
274  private:
276  void _allocateTransmission();
277 
278  public:
279  class Refined;
280 
281 };
282 
305  protected:
307  public:
308  Refined(Photon *parent, size_t i, int dir, double step_max);
310  virtual void transmit(size_t i, double t);
312 };
313 
314 
315 #endif
virtual std::string className_l() const
"photon"
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
double freq_obs_
Photon's frequency in observer's frame.
Definition: GyotoPhoton.h:72
double getTransmissionMax() const
Get maximum transmission;.
Timelike or null geodesics.
Definition: GyotoWorldline.h:207
double * transmission_
Integrated optical transmissions.
Definition: GyotoPhoton.h:92
SmartPointer< Spectrometer::Generic > spectro_
Observer's spectrometer.
Definition: GyotoPhoton.h:85
A null geodesic transporting light.
Definition: GyotoPhoton.h:52
Classes with an operator() method.
Photon * clone() const
Cloner.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
SmartPointer< Spectrometer::Generic > spectrometer() const
Get Photon::spectro_.
virtual std::string className() const
"Photon"
Photon * parent_
Parent Photon.
Definition: GyotoPhoton.h:306
SmartPointer< Metric::Generic > metric() const
Get metric.
double const * getTransmission() const
Get Photon::transmission_.
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:304
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.
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:66
#define GYOTO_WORLDLINE
Declare the Worldline interface wrappers.
Definition: GyotoWorldline.h:139
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
double transmission_freqobs_
Integrated optical transmission.
Definition: GyotoPhoton.h:78
void resetTransmission()
Set transmission to 1 for each channel as well as scalar transmission.
Pointers performing reference counting.
Definition: GyotoProperty.h:41
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:78
virtual double getMass() const
Return 0.
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:136
Description of the observer screen.
virtual void transmit(size_t i, double t)
Update transmission in a given channel.
double freqObs() const
Get Photon::freq_obs__.
SmartPointer< Astrobj::Generic > astrobj() const
Get Photon::object_.