GyotoPhoton.h
Go to the documentation of this file.
/*
Copyright 2011-2016 Frederic Vincent, Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoPhoton_H_
#define __GyotoPhoton_H_
#include "GyotoFunctors.h"
namespace Gyoto{
class Photon;
namespace Astrobj { class Generic; }
}
#include <GyotoDefs.h>
#include <GyotoMetric.h>
#include <GyotoScreen.h>
#include <GyotoWorldline.h>
#include <GyotoObject.h>
#include <float.h>
#include <eigen3/Eigen/Dense>
class Gyoto::Photon
: public Gyoto::Worldline,
public Gyoto::SmartPointee,
public Gyoto::Object
{
friend class Gyoto::SmartPointer<Gyoto::Photon>;
// Data :
// -----
protected:
SmartPointer<Gyoto::Astrobj::Generic> object_;
double freq_obs_;
double transmission_freqobs_;
Eigen::Matrix4d transmissionMatrix_freqobs_;
SmartPointer<Spectrometer::Generic> spectro_;
double * transmission_;
int nb_cross_eqplane_;
Eigen::Matrix4d * transmissionMatrix_;
// Constructors - Destructor
// -------------------------
public:
GYOTO_OBJECT;
GYOTO_OBJECT_THREAD_SAFETY;
GYOTO_WORLDLINE;
virtual std::string className() const ;
virtual std::string className_l() const ;
Photon() ;
Photon(const Photon& ) ;
Photon* clone() const ;
protected:
Photon(Photon* orig, size_t i0, int dir, double step_max);
public:
Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
double* coord) ;
Photon(SmartPointer<Metric::Generic> gg, SmartPointer<Astrobj::Generic> obj,
SmartPointer<Screen> screen, double d_alpha, double d_delta);
virtual ~Photon() ;
virtual double getMass() const ;
void astrobj(SmartPointer<Astrobj::Generic>);
SmartPointer<Astrobj::Generic> astrobj() const ;
using Worldline::metric;
// Set Worldline::metric_ as well as the Astrobj metric
void metric(SmartPointer<Metric::Generic>);
void spectrometer(SmartPointer<Spectrometer::Generic> spr);
SmartPointer<Spectrometer::Generic> spectrometer() const ;
void freqObs(double);
double freqObs() const;
void nb_cross_eqplane(int);
int nb_cross_eqplane() const;
// Mutators / assignment
// ---------------------
public:
using Worldline::setInitialCondition;
void setInitialCondition(SmartPointer<Metric::Generic> gg,
SmartPointer<Astrobj::Generic> obj,
const double coord[8]) ;
void setInitialCondition(SmartPointer<Metric::Generic> gg,
SmartPointer<Astrobj::Generic> obj,
const double coord[8],
const double Ephi[4],
const double Etheta[4]) ;
void setInitialCondition(SmartPointer<Metric::Generic> gg,
SmartPointer<Astrobj::Generic> obj,
SmartPointer<Screen> screen,
double d_alpha,
double d_delta);
int hit(Astrobj::Properties *data=NULL);
double findMin(Functor::Double_constDoubleArray* object,
double t1, double t2, double &tmin,
double threshold = DBL_MIN) ;
void findValue(Functor::Double_constDoubleArray* object,
double value,
double tinside, double &toutside) ;
#ifdef GYOTO_USE_XERCES
virtual void setParameters(FactoryMessenger *fmp) ;
static SmartPointer<Photon> Subcontractor(Gyoto::FactoryMessenger*);
#endif
/* transmission stuff */
public:
void resetTransmission() ;
void resetTransmissionMatrix();
double getTransmission(size_t i) const ;
Eigen::Matrix4d getTransmissionMatrix(size_t i) const ;
double getTransmissionMax() const ;
double const * getTransmission() const ;
Eigen::Matrix4d const * getTransmissionMatrix() const ;
virtual void transmit(size_t i, double t);
virtual void transmit(size_t i, Eigen::Matrix4d mat);
virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu, Eigen::Matrix4d * Onu);
private:
void _allocateTransmission();
void _allocateTransmissionMatrix();
public:
class Refined;
};
class Gyoto::Photon::Refined : public Gyoto::Photon {
protected:
Photon * parent_;
public:
Refined(Photon *parent, size_t i, int dir, double step_max);
virtual void transmit(size_t i, double t);
virtual void transmit(size_t i, Eigen::Matrix4d mat);
virtual void transfer(double * Inu, double * Qnu, double * Unu, double * Vnu, Eigen::Matrix4d * Onu);
};
#endif
GyotoDefs.h
Gyoto ubiquitous macros and typedefs.
GyotoFunctors.h
Classes with an operator() method.
GyotoMetric.h
Base class for metric description.
GyotoObject.h
Introspectable objects.
GYOTO_OBJECT
#define GYOTO_OBJECT
Declare class::properties and class::getProperties().
Definition GyotoObject.h:84
GyotoScreen.h
Description of the observer screen.
GyotoWorldline.h
Timelike or null geodesics.
Gyoto::Astrobj::Generic
Base class for astronomical object.
Definition GyotoAstrobj.h:200
Gyoto::Object
Object with properties.
Definition GyotoObject.h:152
Gyoto::Photon::Refined
Refine last step of integration in a Photon.
Definition GyotoPhoton.h:385
Gyoto::Photon::Refined::transmit
virtual void transmit(size_t i, Eigen::Matrix4d mat)
Update transmission Matrix both in *this and in *parent_.
Gyoto::Photon::Refined::transfer
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, Eigen::Matrix4d *Onu)
Perform one step of polarized radiative transfert and update transmission matrix.
Gyoto::Photon::Refined::Refined
Refined(Photon *parent, size_t i, int dir, double step_max)
Constructor.
Gyoto::Photon::Refined::transmit
virtual void transmit(size_t i, double t)
Update transmission both in *this and in *parent_.
Gyoto::Photon::Refined::parent_
Photon * parent_
Parent Photon.
Definition GyotoPhoton.h:387
Gyoto::Photon
A null geodesic transporting light.
Definition GyotoPhoton.h:57
Gyoto::Photon::transfer
virtual void transfer(double *Inu, double *Qnu, double *Unu, double *Vnu, Eigen::Matrix4d *Onu)
Perform one step of polarized radiative transfert and update transmission matrix.
Gyoto::Photon::getTransmissionMatrix
Eigen::Matrix4d getTransmissionMatrix(size_t i) const
Get transmission matrix.
Gyoto::Photon::freq_obs_
double freq_obs_
Photon's frequency in observer's frame.
Definition GyotoPhoton.h:73
Gyoto::Photon::nb_cross_eqplane
void nb_cross_eqplane(int)
Set Photon::nb_cross_eqplane_.
Gyoto::Photon::astrobj
void astrobj(SmartPointer< Astrobj::Generic >)
Set Photon::object_.
Gyoto::Photon::className_l
virtual std::string className_l() const
"photon"
Gyoto::Photon::_allocateTransmission
void _allocateTransmission()
Allocate Photon::transmission_.
Gyoto::Photon::resetTransmissionMatrix
void resetTransmissionMatrix()
Set transmission matrix to identity matrix for each frequency.
Gyoto::Photon::Photon
Photon()
Default constructor.
Gyoto::Photon::resetTransmission
void resetTransmission()
Set transmission to 1 for each channel as well as scalar transmission.
Gyoto::Photon::transmissionMatrix_
Eigen::Matrix4d * transmissionMatrix_
Integrated optical transmission matrix (polarization).
Definition GyotoPhoton.h:109
Gyoto::Photon::hit
int hit(Astrobj::Properties *data=NULL)
Integrate the geodesic.
Gyoto::Photon::getMass
virtual double getMass() const
Return 0.
Gyoto::Photon::nb_cross_eqplane_
int nb_cross_eqplane_
Nb of crossings of equatorial plane z=0, theta=pi/2.
Definition GyotoPhoton.h:102
Gyoto::Photon::clone
Photon * clone() const
Cloner.
Gyoto::Photon::getTransmissionMax
double getTransmissionMax() const
Get maximum transmission;.
Gyoto::Photon::transmissionMatrix_freqobs_
Eigen::Matrix4d transmissionMatrix_freqobs_
Integrated optical transmission matrix (polarization).
Definition GyotoPhoton.h:85
Gyoto::Photon::setInitialCondition
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::Photon::transmission_freqobs_
double transmission_freqobs_
Integrated optical transmission.
Definition GyotoPhoton.h:79
Gyoto::Photon::setParameters
virtual void setParameters(FactoryMessenger *fmp)
Main loop for parsing Properties from XML description.
Gyoto::Photon::transmission_
double * transmission_
Integrated optical transmissions.
Definition GyotoPhoton.h:99
Gyoto::Photon::transmit
virtual void transmit(size_t i, double t)
Update transmission in a given channel.
Gyoto::Photon::freqObs
void freqObs(double)
Set Photon::freq_obs__.
Gyoto::Photon::spectro_
SmartPointer< Spectrometer::Generic > spectro_
Observer's spectrometer.
Definition GyotoPhoton.h:92
Gyoto::Photon::className
virtual std::string className() const
"Photon"
Gyoto::Photon::findValue
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.
Gyoto::Photon::getTransmission
double getTransmission(size_t i) const
Get transmission.
Gyoto::Photon::findMin
double findMin(Functor::Double_constDoubleArray *object, double t1, double t2, double &tmin, double threshold=DBL_MIN)
Find minimum of photon–object distance.
Gyoto::Photon::object_
SmartPointer< Gyoto::Astrobj::Generic > object_
The astronomical target.
Definition GyotoPhoton.h:67
Gyoto::Photon::spectrometer
void spectrometer(SmartPointer< Spectrometer::Generic > spr)
Set Photon::spectro_.
Gyoto::SmartPointee
Can be pointed to by a SmartPointer.
Definition GyotoSmartPointer.h:81
Gyoto::SmartPointer
Pointers performing reference counting.
Definition GyotoSmartPointer.h:135
Gyoto::Worldline
Timelike or null geodesics.
Definition GyotoWorldline.h:240
Gyoto::Worldline::metric
void metric(SmartPointer< Metric::Generic >)
Set metric Smartpointer.
Gyoto::Worldline::setInitialCondition
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.
Gyoto::Astrobj
Access to astronomical objects.
Definition GyotoAstrobj.h:49
Gyoto
Namespace for the Gyoto library.
Definition GyotoAstrobj.h:44