Gyoto
GyotoKerrBL.h
Go to the documentation of this file.
1 
7 /*
8  Copyright 2011 Frederic Vincent, Thibaut Paumard
9 
10  This file is part of Gyoto.
11 
12  Gyoto is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  Gyoto is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef __GyotoKerrBL_H_
27 #define __GyotoKerrBL_H_
28 
29 namespace Gyoto {
30  namespace Metric { class KerrBL; }
31 }
32 
33 #include <GyotoMetric.h>
34 #include <GyotoWorldline.h>
35 
36 #ifdef GYOTO_USE_XERCES
37 #include <GyotoRegister.h>
38 #endif
39 
40 
46  friend class Gyoto::SmartPointer<Gyoto::Metric::KerrBL>;
47 
48  // Data :
49  // -----
50  protected:
51  double spin_ ;
53 
54  // Constructors - Destructor
55  // -------------------------
56  public:
57  KerrBL();
58  KerrBL(double spin, double mass) ;
59 
60  // Default is _not_ fine
61  KerrBL(const KerrBL& ) ;
62 
63 
64  virtual ~KerrBL() ;
65 
66 
67  // Mutators / assignment
68  // ---------------------
69  public:
70  // default operator= is fine
71  void setSpin(const double spin);
72  virtual KerrBL * clone () const ;
73 
74 
75  // Accessors
76  // ---------
77  public:
78  double getSpin() const ;
79 
80  double getRms() const;
81 
82  double getRmb() const;
83 
84  double gmunu(const double * const x, int mu, int nu) const ;
85 
89  double gmunu_up(const double * const x, int mu, int nu) const ;
90 
91  /*
92  it's necessary to define christoffel even if it's not used. KerrBL derives from Metric where christoffel is virtual pure. If the function is not defined in KerrBL, it's considered virtual pure here too. Then KerrBL is considered an abstract class, and it's forbidden to declare any object of type KerrBL....
93  See Delannoy C++ p.317-318
94  NB : and it's not necessary to declare "virtual" a function in a derived class if it has been declared "virtual" in the basis class.
95  */
96  double christoffel(const double[8],
97  const int, const int, const int) const;
98 
99  double ScalarProd(const double pos[4],
100  const double u1[4], const double u2[4]) const ;
101 
102  void nullifyCoord(double coord[8], double & tdot2) const;
103  void nullifyCoord(double coord[8]) const;
104 
105 
106  // friend std::ostream& operator<<(std::ostream& , const KerrBL& ) ;
107  // std::ostream& print(std::ostream&) const ;
108  virtual void circularVelocity(double const pos[4], double vel [4],
109  double dir=1.) const ;
110 
111  public:
112  virtual void MakeCoord(const double coordin[8], const double cst[5], double coordout[8]) const ;
114 
116  void MakeMomentum(const double coordin[8], const double cst[5], double coordout[8]) const;
118 
119 
120  virtual void setParameter(std::string, std::string, std::string);
121 #ifdef GYOTO_USE_XERCES
122  virtual void fillElement(FactoryMessenger *fmp);
123 #endif
124 
125  protected:
126 
127  // outside the API
128  /* RK4 : y=[r,theta,phi,t,pr,ptheta], cst=[a,E,L,Q,1/Q],dy/dtau=F(y,cst), h=proper time step. For KerrBL geodesic computation.
129  */
130  int myrk4(Worldline * line, const double coordin[8], double h, double res[8]) const; //external-use RK4
131  private:
132  int myrk4(const double coor[8], const double cst[5], double h, double res[8]) const;
133  int myrk4_adaptive(Gyoto::Worldline* line, const double coor[8], double lastnorm, double normref, double coor1[8], double h0, double& h1) const;
134 
139  int CheckCons(const double coor_init[8], const double cst[5], double coor_fin[8]) const;
140 
146  void Normalize4v(double coord[8], const double part_mass) const;
147 
150  using Metric::Generic::diff;
154  virtual int diff(const double y[8], const double cst[5],
155  double res[8]) const ;
158  virtual void computeCst(const double coord[8], double cst[5]) const;
159  public:
160  void setParticleProperties(Worldline* line, const double* coord) const;
161 
162 };
163 
164 #endif
165