Gyoto
GyotoMetric.h
Go to the documentation of this file.
1 
10 /*
11  Copyright 2011 Frederic Vincent, Thibaut Paumard
12 
13  This file is part of Gyoto.
14 
15  Gyoto is free software: you can redistribute it and/or modify
16  it under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  Gyoto is distributed in the hope that it will be useful,
21  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  GNU General Public License for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #ifndef __GyotoMetric_H_
30 #define __GyotoMetric_H_
31 
32 #include <iostream>
33 #include <fstream>
34 #include <string>
35 
36 #include <GyotoWorldline.h>
37 #include <GyotoSmartPointer.h>
38 #include <GyotoAstrobj.h>
39 #include <GyotoRegister.h>
40 
41 namespace Gyoto {
42  namespace Metric {
43  class Generic;
44 
55 
66 
72  extern Register::Entry * Register_;
74 
86  void Register(std::string kind, Gyoto::Metric::Subcontractor_t*);
88 
92  void initRegister();
93  }
94 }
95 
117  friend class Gyoto::SmartPointer<Gyoto::Metric::Generic>;
118 
119  private:
120  std::string kind_;
121  double mass_;
123 
124  public:
125  const std::string getKind() const;
126  void setKind(const std::string);
127  int getRefCount();
128 
129  // Constructors - Destructor
130  // -------------------------
131  //Metric(const Metric& ) ; ///< Copy constructor
132  Generic();
133  Generic(const int coordkind);
134  Generic(const double mass, const int coordkind);
135 
136  virtual ~Generic() ;
137 
138  // Mutators / assignment
139  // ---------------------
140  virtual Generic * clone() const ;
141 
142  void setMass(const double);
143  void setMass(const double, std::string unit);
144 
145  // Accessors
146 
147  int getCoordKind() const;
148  void setCoordKind(int coordkind);
149 
150  double getMass() const;
151 
157  double unitLength() const ;
158 
159 
160  virtual void cartesianVelocity(double const coord[8], double vel[3]);
162 
168  virtual double SysPrimeToTdot(const double coord[4], const double v[3]) const;
170 
179  virtual void circularVelocity(double const pos[4], double vel[4],
180  double dir=1.) const ;
181 
190  virtual void nullifyCoord(double coord[8]) const;
192 
202  virtual void nullifyCoord(double coord[8], double& tdot2) const;
204 
205 
214  virtual double ScalarProd(const double pos[4],
215  const double u1[4], const double u2[4]) const;
216 
217  virtual double Norm3D(double* pos) const;
218 
219 
220  // Outputs
221 #ifdef GYOTO_USE_XERCES
222 
228  virtual void fillElement(FactoryMessenger *fmp) ;
229  void processGenericParameters(Gyoto::FactoryMessenger *fmp) ;
230 #endif
231 
233  // friend std::ostream& operator<<(std::ostream& , const Metric& ) ;
234  // std::ostream& print(std::ostream&) const ;
235 
245  virtual double gmunu(const double * x,
246  int mu, int nu) const
247  = 0 ;
248 
253  virtual double christoffel(const double coord[8],
254  const int alpha, const int mu, const int nu) const = 0;
255 
256  virtual int myrk4(Worldline * line, const double coord[8], double h, double res[8]) const;
257 
258  virtual int myrk4_adaptive(Gyoto::Worldline* line, const double coord[8],
259  double lastnorm, double normref,
260  double coordnew[8], double h0, double& h1) const;
261 
270  virtual int isStopCondition(double const * const coord) const;
271 
275  virtual int diff(const double y[8], double res[8]) const ;
276 
280  virtual void setParticleProperties(Gyoto::Worldline* line,
281  const double * coord) const;
282 
283 
284 };
285 
286 #endif