Metric
-
template<typename Type>
class Metric The base class of all kinds of metrics.
Subclassed by SBody::Hayward< Type >, SBody::Kerr< Type >, SBody::KerrNewman< Type >, SBody::KerrTaubNUT< Type >, SBody::Newton< Type >, SBody::ReissnerNordstrom< Type >, SBody::Schwarzschild< Type >
Public Functions
-
virtual std::string Name() const = 0
Return the name of the metric.
- Returns:
name of the metric.
-
virtual int MetricTensor(const Type position[], gsl_matrix *metric) = 0
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) = 0
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) = 0
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline int LocalInertialFrame(const Type position[], TimeSystem time, gsl_matrix *coordinate)
Calculate the local inertial frame coordinate of the object at
position
, stored incoordinate
.- Parameters:
position – 8 dimensional std::vector
time – time systme of the object
coordinate – matrix with size 4×4
- Returns:
status
-
virtual int LagrangianToHamiltonian(Type y[]) = 0
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int HamiltonianToLagrangian(Type y[]) = 0
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) = 0
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) = 0
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) = 0
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) = 0
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type Redshift(const Type y[], const Type photon[], TimeSystem object_time, TimeSystem photon_time)
Calculate the redshift of the object, \(1+z\).
- Parameters:
y – 8 dimensional std::vector of the object
photon – photon traced to the object
object_time – time system of the object
photon_time – time system of the photon
- Returns:
result
-
virtual int NormalizeTimelikeGeodesic(Type y[]) = 0
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) = 0
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC)
Get the integrator to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
pointer to the integrator
-
virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) = 0
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
virtual std::string Name() const = 0
Newton & Post-Newtonian
-
template<typename Type>
class Newton : public SBody::Metric<Type> Post-Newtonian.
Subclassed by SBody::PN1< Type >
Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
inline virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
inline virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
inline virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type Redshift(const Type y[], const Type photon[], TimeSystem object_time, TimeSystem photon_time) override
Calculate the redshift of the object, \(1+z\).
- Parameters:
y – 8 dimensional std::vector of the object
photon – photon traced to the object
object_time – time system of the object
photon_time – time system of the photon
- Returns:
result
-
inline virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
-
template<typename Type>
class PN1 : public SBody::Newton<Type> Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
Schwarzschild
Reissner-Nördstrom
-
template<typename Type>
class ReissnerNordstrom : public SBody::Metric<Type> Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
inline virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
inline virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
inline virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
Kerr
-
template<typename Type>
class Kerr : public SBody::Metric<Type> Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
inline virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
inline virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
inline virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
Kerr-Newman
-
template<typename Type>
class KerrNewman : public SBody::Metric<Type> Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
inline virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
inline virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
inline virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
Kerr-Taub-NUT
-
template<typename Type>
class KerrTaubNUT : public SBody::Metric<Type> Public Functions
-
inline virtual std::string Name() const override
Return the name of the metric.
- Returns:
name of the metric.
-
inline virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
inline virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
inline virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
inline virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
inline virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
inline virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
inline virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
inline virtual std::string Name() const override
Hayward
-
template<typename Type>
class Hayward : public SBody::Metric<Type> Public Functions
-
virtual int MetricTensor(const Type position[], gsl_matrix *metric) override
Calculate the metric tensor at
position
, stored inmetric
.- Parameters:
position – 4 dimensional std::vector
metric – matrix with size 4×4
- Returns:
status
-
virtual Type DotProduct(const Type position[], const Type x[], const Type y[], const size_t dimension) override
Dot product of std::vector
x
andy
atposition
. \(g_{\mu\nu}x^\mu y^\nu\).- Parameters:
position – 4 dimensional std::vector, position to calcuate the dot product of
x
andy
.x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector, should be 3 or 4.
- Returns:
result
-
virtual Type DistanceSquare(const Type x[], const Type y[], const size_t dimension) override
Calculate the square of the distance between
x
andy
atx
. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).- Parameters:
x – 4 dimensional std::vector
y – 4 dimensional std::vector
dimension – dimension of the std::vector
- Returns:
result
-
virtual int LagrangianToHamiltonian(Type y[]) override
Convert the coordinate system from Lagrangian to Hamiltonian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int HamiltonianToLagrangian(Type y[]) override
Convert the coordinate system from Hamiltonian to Lagrangian.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int FastTrace(const Type r_observer, const Type theta_observer, const Type sin_theta_observer, const Type cos_theta_observer, const Type r_object, const Type theta_object, const Type phi_object, Type &alpha, Type &beta, Type photon[]) override
Trace the photon from the observer to the target, using elliptic integrals.
- Parameters:
r_observer – radius of the observer, \(r_\text{obs}\).
theta_observer – theta of the observer, \(\theta_\text{obs}\).
sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).
cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).
r_object – radius of the target, \(r_\text{tar}\).
theta_object – theta of the target, \(\theta_\text{tar}\).
phi_object – phi of the target, \(\phi_\text{tar}\).
alpha – x position of the target in the observer’s view.
beta – y position of the target in the observer’s view.
photon – 9 dimensional std::vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.
- Returns:
status
-
virtual Type Energy(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the energy of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
virtual Type AngularMomentum(const Type y[], TimeSystem time, DynamicalSystem dynamics) override
Calculate the angular momentum of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
virtual Type CarterConstant(const Type y[], const Type mu2, TimeSystem time, DynamicalSystem dynamics) override
Calculate the Carter constant of the object.
- Parameters:
y – 8 dimensional std::vector
time – time system of the object
dynamics – dynamical system of the object
- Returns:
result
-
virtual int NormalizeTimelikeGeodesic(Type y[]) override
Normalize the timelike geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual int NormalizeNullGeodesic(Type y[], Type frequency = 1.) override
Normalize the null geodesic.
- Parameters:
y – 8 dimensional std::vector
- Returns:
status
-
virtual std::function<void(const std::array<Type, 8>&, std::array<Type, 8>&, const Type)> GetIntegrationSystem(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override
Get the integration system to calculate the motion of the object.
- Parameters:
time – time system of the object
dynamics – dynamical system of the object
motion – motion mode of the object
- Returns:
integrator system
-
virtual int MetricTensor(const Type position[], gsl_matrix *metric) override