Gyoto
GyotoPhoton.h
Go to the documentation of this file.
1
9/*
10 Copyright 2011-2016 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
33namespace 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,
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:
101 virtual std::string className() const ;
102 virtual std::string className_l() const ;
103
108 Photon(const Photon& ) ;
109 Photon* clone() const ;
110 protected:
111 Photon(Photon* orig, size_t i0, int dir, double step_max);
113 public:
115 Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
116 double* coord) ;
117
119 Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
120 SmartPointer<Screen> screen, double d_alpha, double d_delta);
121
122 virtual ~Photon() ;
123
124 virtual double getMass() const ;
125
127 void astrobj(SmartPointer<Astrobj::Generic>);
129 SmartPointer<Astrobj::Generic> astrobj() const ;
130
131 using Worldline::metric;
132 // Set Worldline::metric_ as well as the Astrobj metric
133 void metric(SmartPointer<Metric::Generic>);
134
135
137 void spectrometer(SmartPointer<Spectrometer::Generic> spr);
139 SmartPointer<Spectrometer::Generic> spectrometer() const ;
140
142 void freqObs(double);
144 double freqObs() const;
145
146
147 // Mutators / assignment
148 // ---------------------
149 public:
151
153
166 void setInitialCondition(SmartPointer<Metric::Generic> gg,
167 SmartPointer<Astrobj::Generic> obj,
168 const double coord[8]) ;
169
171
189 void setInitialCondition(SmartPointer<Metric::Generic> gg,
190 SmartPointer<Astrobj::Generic> obj,
191 const double coord[8],
192 const double Ephi[4],
193 const double Etheta[4]) ;
194
196
207 void setInitialCondition(SmartPointer<Metric::Generic> gg,
208 SmartPointer<Astrobj::Generic> obj,
209 SmartPointer<Screen> screen,
210 double d_alpha,
211 double d_delta);
212
214
219 int hit(Astrobj::Properties *data=NULL);
220
239 double findMin(Functor::Double_constDoubleArray* object,
240 double t1, double t2, double &tmin,
241 double threshold = DBL_MIN) ;
242
244
256 void findValue(Functor::Double_constDoubleArray* object,
257 double value,
258 double tinside, double &toutside) ;
259
260#ifdef GYOTO_USE_XERCES
261 virtual void setParameters(FactoryMessenger *fmp) ;
262 static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
263#endif
264
265 /* transmission stuff */
266 public:
269
271
278 double getTransmission(size_t i) const ;
279
281
287 double getTransmissionMax() const ;
288
290
293 double const * getTransmission() const ;
294
296
302 virtual void transmit(size_t i, double t);
303
305 virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu,
306 double const * aInu, double const * aQnu,
307 double const * aUnu, double const * aVnu,
308 double const * rQnu, double const * rUnu, double const * rVnu) ;
309
310 private:
313
314 public:
315 class Refined;
316
317};
318
341 protected:
343 public:
344 Refined(Photon *parent, size_t i, int dir, double step_max);
346 virtual void transmit(size_t i, double t);
348 virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu,
349 double const * aInu, double const * aQnu,
350 double const * aUnu, double const * aVnu,
351 double const * rQnu, double const * rUnu, double const * rVnu) ;
353};
354
355
356#endif
Gyoto ubiquitous macros and typedefs.
Classes with an operator() method.
Base class for metric description.
Introspectable objects.
#define GYOTO_OBJECT_THREAD_SAFETY
Declare virtual bool isThreadSafe() const.
Definition: GyotoObject.h:99
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
Description of the observer screen.
Timelike or null geodesics.
#define GYOTO_WORLDLINE
Declare the Worldline interface wrappers.
Definition: GyotoWorldline.h:156
Object with properties.
Definition: GyotoObject.h:152
Refine last step of integration in a Photon.
Definition: GyotoPhoton.h:340
Refined(Photon *parent, size_t i, int dir, double step_max)
Constructor.
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, double const *aInu, double const *aQnu, double const *aUnu, double const *aVnu, double const *rQnu, double const *rUnu, double const *rVnu)
Perform one step of radiative transfer.
virtual void transmit(size_t i, double t)
Update transmission both in *this and in *parent_.
Photon * parent_
Parent Photon.
Definition: GyotoPhoton.h:342
A null geodesic transporting light.
Definition: GyotoPhoton.h:56
double freq_obs_
Photon's frequency in observer's frame.
Definition: GyotoPhoton.h:72
virtual std::string className_l() const
"photon"
void _allocateTransmission()
Allocate Photon::transmission_.
SmartPointer< Metric::Generic > metric() const
Get metric.
void resetTransmission()
Set transmission to 1 for each channel as well as scalar transmission.
SmartPointer< Spectrometer::Generic > spectrometer() const
Get Photon::spectro_.
int hit(Astrobj::Properties *data=NULL)
Integrate the geodesic.
virtual double getMass() const
Return 0.
Photon * clone() const
Cloner.
double getTransmissionMax() const
Get maximum transmission;.
void setInitialCondition(SmartPointer< Metric::Generic > gg, SmartPointer< Astrobj::Generic > obj, const double coord[8])
Set or re-set the initial condition prior to integration.
double transmission_freqobs_
Integrated optical transmission.
Definition: GyotoPhoton.h:78
virtual void setParameters(FactoryMessenger *fmp)
Main loop for parsing Properties from XML description.
double * transmission_
Integrated optical transmissions.
Definition: GyotoPhoton.h:92
virtual void transmit(size_t i, double t)
Update transmission in a given channel.
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, double const *aInu, double const *aQnu, double const *aUnu, double const *aVnu, double const *rQnu, double const *rUnu, double const *rVnu)
Perform one step of radiative transfer.
double freqObs() const
Get Photon::freq_obs__.
SmartPointer< Spectrometer::Generic > spectro_
Observer's spectrometer.
Definition: GyotoPhoton.h:85
virtual std::string className() const
"Photon"
SmartPointer< Astrobj::Generic > astrobj() const
Get Photon::object_.
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.
double findMin(Functor::Double_constDoubleArray *object, double t1, double t2, double &tmin, double threshold=DBL_MIN)
Find minimum of photon–object distance.
SmartPointer< Gyoto::Astrobj::Generic > object_
The astronomical target.
Definition: GyotoPhoton.h:66
double const * getTransmission() const
Get Photon::transmission_.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:81
Pointers performing reference counting.
Definition: GyotoSmartPointer.h:135
Timelike or null geodesics.
Definition: GyotoWorldline.h:228
SmartPointer< Metric::Generic > metric() const
Get metric.
void setInitialCondition(SmartPointer< Metric::Generic > gg, const double coord[8], const int dir, double const Ephi[4], double const Etheta[4])
Set or re-set the initial condition prior to integration.
SmartPointer< Astrobj::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugin)
A template for Subcontractor_t functions.
Definition: GyotoAstrobj.h:76
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43