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_ ;
52 
53  // Constructors - Destructor
54  // -------------------------
55  public:
56  KerrBL();
57  KerrBL(double spin, double mass) ;
58 
59  // Default is _not_ fine
60  //KerrBL(const KerrBL& ) ; ///< Copy constructor
61 
62 
63  virtual ~KerrBL() ;
64 
65 
66  // Mutators / assignment
67  // ---------------------
68  public:
69  // default operator= is fine
70  void setSpin(const double spin);
71  virtual KerrBL * clone () const ;
72 
73 
74  // Accessors
75  // ---------
76  public:
77  double getSpin() const ;
78 
79  double getRms() const;
80 
81  double getRmb() const;
82 
86  double gmunu(const double * const x,
87  int alpha, int beta) const ;
88 
89 
90  /*
91  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....
92  See Delannoy C++ p.317-318
93  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.
94  */
95  double christoffel(const double[8],
96  const int, const int, const int) const;
97 
98  double ScalarProd(const double* pos,
99  const double* u1, const double* u2) const ;
100 
101  void nullifyCoord(double coord[8], double & tdot2) const;
102  void nullifyCoord(double coord[8]) const;
103 
104 
105  // friend std::ostream& operator<<(std::ostream& , const KerrBL& ) ;
106  // std::ostream& print(std::ostream&) const ;
107  virtual void circularVelocity(double const pos[4], double vel [4],
108  double dir=1.) const ;
109 
110  public:
111  void MakeCoord(const double coordin[8], const double cst[5], double coordout[8]) const ;
113 
115  void MakeMomentum(const double coordin[8], const double cst[5], double coordout[8]) const;
117 
118 
119 #ifdef GYOTO_USE_XERCES
120  virtual void fillElement(FactoryMessenger *fmp);
122  static void Init();
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  int myrk4(const double coor[8], const double cst[5], double h, double res[8]) const;//internal-use RK4
132  int myrk4_adaptive(Gyoto::Worldline* line, const double coor[8], double lastnorm, double normref, double coor1[8], double h0, double& h1) const;
133  int CheckCons(const double coor_init[8], const double cst[5], double coor_fin[8]) const;
134  void Normalize4v(double coord[8], const double part_mass) const;
135 
138  using Metric::Generic::diff;
139  int diff(const double y[8], const double cst[5], double res[8]) const ;
142  void computeCst(const double coord[8], double cst[5]) const;
143  void setParticleProperties(Worldline* line, const double* coord) const;
144 
145 };
146 
147 #endif
148