GyotoMetric.h
Go to the documentation of this file.
/*
Copyright 2011-2016, 2018-2020 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 __GyotoMetric_H_
#define __GyotoMetric_H_
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <GyotoSmartPointer.h>
#include <GyotoObject.h>
#include <GyotoAstrobj.h>
#include <GyotoRegister.h>
#include <GyotoHooks.h>
#include <GyotoDefs.h>
namespace Gyoto {
namespace Metric {
class Generic;
typedef SmartPointer<Metric::Generic> Subcontractor_t(FactoryMessenger*, std::vector<std::string> const &);
template<typename T> SmartPointer<Metric::Generic> Subcontractor
(FactoryMessenger* fmp, std::vector<std::string> const &plugins) {
SmartPointer<T> gg = new T();
gg -> plugins(plugins);
#ifdef GYOTO_USE_XERCES
if (fmp) gg -> setParameters(fmp);
#endif
return gg;
}
Gyoto::Metric::Subcontractor_t* getSubcontractor(std::string name,
std::vector<std::string> &plugin,
int errmode=0);
extern Register::Entry * Register_;
void Register(std::string kind, Gyoto::Metric::Subcontractor_t* scp);
void initRegister();
}
/* Documented elswhere */
class Worldline;
}
class Gyoto::Metric::Generic
: public Gyoto::SmartPointee,
public Gyoto::Object,
public Gyoto::Hook::Teller
{
friend class Gyoto::SmartPointer<Gyoto::Metric::Generic>;
private:
double mass_;
int coordkind_;
int __defaultfeatures;
protected:
double delta_min_;
double delta_max_;
double delta_max_over_r_;
bool keplerian_;
protected:
void coordKind(int coordkind);
public:
GYOTO_OBJECT;
int getRefCount();
// Constructors - Destructor
// -------------------------
Generic();
Generic(const int coordkind, const std::string &name);
Generic(Generic const &o);
virtual ~Generic() ;
// Mutators / assignment
// ---------------------
virtual Generic * clone() const ;
virtual void mass(const double);
virtual void mass(const double, const std::string &unit);
// Accessors
int coordKind() const;
double mass() const;
double mass(const std::string &unit) const;
double unitLength() const ;
double unitLength(const std::string &unit) const ;
virtual double getRmb() const;
virtual double getRms() const;
virtual double getSpecificAngularMomentum(double rr) const;
virtual double getPotential(double const pos[4], double l_cst) const;
double deltaMin() const;
void deltaMin(double h1);
double deltaMax() const;
virtual double deltaMax(double const pos[8], double delta_max_external) const;
void deltaMax(double h1);
double deltaMaxOverR() const;
void deltaMaxOverR(double t);
bool keplerian() const;
void keplerian(bool);
virtual void cartesianVelocity(double const coord[8], double vel[3]);
virtual double SysPrimeToTdot(const double coord[4], const double v[3]) const;
virtual void circularVelocity(double const pos[4], double vel[4],
double dir=1.) const ;
virtual void zamoVelocity(double const pos[4], double vel[4]) const ;
virtual void nullifyCoord(double coord[8]) const;
virtual void nullifyCoord(double coord[8], double& tdot2) const;
virtual void normalizeFourVel(double coord[8]) const;
virtual void normalizeFourVel(double const pos[4], double fourvel[4]) const;
virtual double ScalarProd(const double pos[4],
const double u1[4], const double u2[4]) const;
double norm(const double pos[4],
const double u1[4]) const;
void multiplyFourVect(double vect[4], double a) const;
void addFourVect(double u1[4], double const u2[4]) const;
void projectFourVect(double const pos[4], double u1[4], double const u2[4]) const;
void dualOneForm(double const IN_ARRAY1_1[4], double const IN_ARRAY1_2[4], double ARGOUT_ARRAY1[4]) const ;
virtual void observerTetrad(obskind_t obskind,
double const pos[4], double fourvel[4],
double screen1[4], double screen2[4],
double screen3[4]) const ;
virtual void observerTetrad(double const pos[4], double fourvel[4],
double screen1[4], double screen2[4],
double screen3[4]) const ;
void GramSchmidt(double const pos[4], double u0[4],
double u1[4], double u2[4], double u3[4]) const;
// Outputs
virtual double gmunu(double const x[4], int mu, int nu) const;
// Keep argument names for swig!
virtual void gmunu(double ARGOUT_ARRAY2[4][4], double const IN_ARRAY1[4]) const;
virtual double gmunu_up(double const x[4], int mu, int nu) const;
// Keep argument names for swig!
virtual void gmunu_up(double ARGOUT_ARRAY2[4][4], const double IN_ARRAY1[4]) const;
// Keep argument names for swig!
virtual void jacobian(double ARGOUT_ARRAY3[4][4][4], const double IN_ARRAY1[4]) const;
// Keep argument names for swig!
virtual void gmunu_up_and_jacobian(double ARGOUT_ARRAY2[4][4], double ARGOUT_ARRAY3[4][4][4], const double IN_ARRAY1[4]) const;
virtual void computeNBeta(const double coord[4],double &NN,double beta[3]) const;
virtual double christoffel(const double coord[4],
const int alpha, const int mu, const int nu) const;
virtual int christoffel(double dst[4][4][4], const double coord[4]) const ;
virtual int myrk4(Worldline * line, state_t const &coord, double h, state_t &res) const;
virtual int myrk4(Worldline * line, const double coord[8], double h, double res[8]) const = delete;
virtual int myrk4_adaptive(Gyoto::Worldline* line, state_t const &coord,
double lastnorm, double normref,
state_t &coordnew, double h0, double& h1,
double deltamax=GYOTO_DEFAULT_DELTA_MAX) const;
virtual int myrk4_adaptive(Gyoto::Worldline* line, const double coord[8],
double lastnorm, double normref,
double coordnew[8], double h0, double& h1,
double deltamax=GYOTO_DEFAULT_DELTA_MAX) const = delete;
virtual int isStopCondition(double const coord[8]) const;
virtual int diff(state_t const &x, state_t &dxdt, double mass) const ;
virtual int diff(state_t const &x, state_t &dxdt) const = delete;
virtual int diff(const double y[8], double res[8]) const = delete ;
virtual int diff31(state_t const &x, state_t &dxdt, double mass) const ;
virtual void setParticleProperties(Gyoto::Worldline* line,
double const coord[8]) const;
};
#endif
GyotoAstrobj.h
Astronomical objects (light emitters).
GyotoDefs.h
Gyoto ubiquitous macros and typedefs.
GyotoHooks.h
Tellers tell Listeners when they mutate.
GyotoObject.h
Introspectable objects.
GYOTO_OBJECT
#define GYOTO_OBJECT
Declare class::properties and class::getProperties().
Definition GyotoObject.h:84
GyotoRegister.h
Gyoto registers.
GyotoSmartPointer.h
Reference-counting pointers.
Gyoto::FactoryMessenger
Factory / SmartPointee::Subcontractor_t interface.
Definition GyotoFactoryMessenger.h:92
Gyoto::Hook::Teller
Listen to me and I'll warn you when I change.
Definition GyotoHooks.h:82
Gyoto::Metric::Generic
Base class for metrics.
Definition GyotoMetric.h:162
Gyoto::Metric::Generic::SysPrimeToTdot
virtual double SysPrimeToTdot(const double coord[4], const double v[3]) const
Compute tdot as a function of dr/dt, dtheta/dt and dphi/dt. Everything is in geometrical units.
Gyoto::Metric::Generic::deltaMax
double deltaMax() const
Gyoto::Metric::Generic::coordKind
void coordKind(int coordkind)
Set coordkind_.
Gyoto::Metric::Generic::observerTetrad
virtual void observerTetrad(obskind_t obskind, double const pos[4], double fourvel[4], double screen1[4], double screen2[4], double screen3[4]) const
Computes the orthonormal local tetrad of the observer.
Gyoto::Metric::Generic::zamoVelocity
virtual void zamoVelocity(double const pos[4], double vel[4]) const
Yield ZAMO velocity at a given position.
Gyoto::Metric::Generic::dualOneForm
void dualOneForm(double const IN_ARRAY1_1[4], double const IN_ARRAY1_2[4], double ARGOUT_ARRAY1[4]) const
Computes dual 1-form Compute the dual 1-form of 4-vector.
Gyoto::Metric::Generic::keplerian_
bool keplerian_
1 if circularVelocity should return the Newtonian Keplerian velocity, in r^-3/2
Definition GyotoMetric.h:196
Gyoto::Metric::Generic::keplerian
bool keplerian() const
Get keplerian_.
Gyoto::Metric::Generic::norm
double norm(const double pos[4], const double u1[4]) const
Scalar product.
Gyoto::Metric::Generic::getRms
virtual double getRms() const
Gyoto::Metric::Generic::delta_max_
double delta_max_
Maximum integration step for the adaptive integrator.
Definition GyotoMetric.h:180
Gyoto::Metric::Generic::delta_min_
double delta_min_
Minimum integration step for the adaptive integrator.
Definition GyotoMetric.h:179
Gyoto::Metric::Generic::christoffel
virtual double christoffel(const double coord[4], const int alpha, const int mu, const int nu) const
Chistoffel symbol.
Gyoto::Metric::Generic::addFourVect
void addFourVect(double u1[4], double const u2[4]) const
add second vector to first one
Gyoto::Metric::Generic::computeNBeta
virtual void computeNBeta(const double coord[4], double &NN, double beta[3]) const
Computes lapse scalar and shift vector at coord.
Gyoto::Metric::Generic::isStopCondition
virtual int isStopCondition(double const coord[8]) const
Check whether integration should stop.
Gyoto::Metric::Generic::coordkind_
int coordkind_
Kind of coordinates (cartesian-like, spherical-like, unspecified).
Definition GyotoMetric.h:167
Gyoto::Metric::Generic::setParticleProperties
virtual void setParticleProperties(Gyoto::Worldline *line, double const coord[8]) const
Set Metric-specific constants of motion. Used e.g. in KerrBL.
Gyoto::Metric::Generic::multiplyFourVect
void multiplyFourVect(double vect[4], double a) const
multiply vector by scalar
Gyoto::Metric::Generic::getSpecificAngularMomentum
virtual double getSpecificAngularMomentum(double rr) const
Gyoto::Metric::Generic::gmunu
virtual double gmunu(double const x[4], int mu, int nu) const
Metric coefficients.
Gyoto::Metric::Generic::projectFourVect
void projectFourVect(double const pos[4], double u1[4], double const u2[4]) const
project u1 orthogonally to u2 at pos
Gyoto::Metric::Generic::deltaMin
double deltaMin() const
Gyoto::Metric::Generic::delta_max_over_r_
double delta_max_over_r_
Numerical tuning parameter.
Definition GyotoMetric.h:194
Gyoto::Metric::Generic::diff31
virtual int diff31(state_t const &x, state_t &dxdt, double mass) const
F function such as dx/dt=F(x,cst) for 3+1 case.
Gyoto::Metric::Generic::diff
virtual int diff(state_t const &x, state_t &dxdt, double mass) const
F function such as dx/dt=F(x,cst).
Gyoto::Metric::Generic::getRmb
virtual double getRmb() const
Gyoto::Metric::Generic::__defaultfeatures
int __defaultfeatures
Whether some virtual methods are implemented.
Definition GyotoMetric.h:176
Gyoto::Metric::Generic::mass
virtual void mass(const double)
Set mass used in unitLength().
Gyoto::Metric::Generic::clone
virtual Generic * clone() const
Virtual copy constructor.
Gyoto::Metric::Generic::normalizeFourVel
virtual void normalizeFourVel(double coord[8]) const
Normalize fourvelvel to -1.
Gyoto::Metric::Generic::myrk4
virtual int myrk4(Worldline *line, state_t const &coord, double h, state_t &res) const
RK4 integrator.
Gyoto::Metric::Generic::getPotential
virtual double getPotential(double const pos[4], double l_cst) const
Gyoto::Metric::Generic::cartesianVelocity
virtual void cartesianVelocity(double const coord[8], double vel[3])
Compute xprime, yprime and zprime from 8-coordinates.
Gyoto::Metric::Generic::unitLength
double unitLength() const
M * G / c^2, M is in kg, unitLength in meters.
Gyoto::Metric::Generic::deltaMaxOverR
double deltaMaxOverR() const
Get delta_max_over_r_.
Gyoto::Metric::Generic::myrk4_adaptive
virtual int myrk4_adaptive(Gyoto::Worldline *line, state_t const &coord, double lastnorm, double normref, state_t &coordnew, double h0, double &h1, double deltamax=GYOTO_DEFAULT_DELTA_MAX) const
RK4 integrator with adaptive step.
Gyoto::Metric::Generic::gmunu_up_and_jacobian
virtual void gmunu_up_and_jacobian(double ARGOUT_ARRAY2[4][4], double ARGOUT_ARRAY3[4][4][4], const double IN_ARRAY1[4]) const
gmunu_up() and jacobian() in one go
Gyoto::Metric::Generic::ScalarProd
virtual double ScalarProd(const double pos[4], const double u1[4], const double u2[4]) const
Scalar product.
Gyoto::Metric::Generic::gmunu_up
virtual double gmunu_up(double const x[4], int mu, int nu) const
Metric contravariant coefficients.
Gyoto::Metric::Generic::GramSchmidt
void GramSchmidt(double const pos[4], double u0[4], double u1[4], double u2[4], double u3[4]) const
Apply Gram-Schmidt orthonormalization to a basis.
Gyoto::Metric::Generic::nullifyCoord
virtual void nullifyCoord(double coord[8]) const
Set tdot (coord[4]) such that coord is light-like. Everything is in geometrical units.
Gyoto::Metric::Generic::mass_
double mass_
Mass yielding geometrical unit (in kg).
Definition GyotoMetric.h:166
Gyoto::Metric::Generic::jacobian
virtual void jacobian(double ARGOUT_ARRAY3[4][4][4], const double IN_ARRAY1[4]) const
Derivatives of the metric covariant coefficients.
Gyoto::Metric::Generic::circularVelocity
virtual void circularVelocity(double const pos[4], double vel[4], double dir=1.) const
Yield circular velocity at a given position.
Gyoto::Metric::KerrBL::diff
virtual int diff(const double y[8], const double cst[5], double res[8]) const
Used in RK4 proxies.
Gyoto::Object
Object with properties.
Definition GyotoObject.h:152
Gyoto::Register::Entry
Entry in a register (or a full register).
Definition GyotoRegister.h:117
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::Metric
Access to metrics.
Definition GyotoAstrobj.h:47
Gyoto::Metric::getSubcontractor
Gyoto::Metric::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugin, int errmode=0)
Query the Metric register.
Gyoto::Metric::Register
void Register(std::string kind, Gyoto::Metric::Subcontractor_t *scp)
Make a Metric kind known to the Factory.
Gyoto::Metric::Register_
Register::Entry * Register_
The Metric register.
Gyoto::Metric::Subcontractor_t
SmartPointer< Metric::Generic > Subcontractor_t(FactoryMessenger *, std::vector< std::string > const &)
A function to build instances of a specific Metric::Generic sub-class.
Definition GyotoMetric.h:60
Gyoto::Metric::initRegister
void initRegister()
Empty the Metric register.
Gyoto::Metric::Subcontractor
SmartPointer< Metric::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugins)
Subcontractor template.
Definition GyotoMetric.h:72
Gyoto
Namespace for the Gyoto library.
Definition GyotoAstrobj.h:44