Gyoto
GyotoMetric.h
Go to the documentation of this file.
1 
10 /*
11  Copyright 2011, 2013 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 <GyotoSmartPointer.h>
37 #include <GyotoAstrobj.h>
38 #include <GyotoRegister.h>
39 #include <GyotoHooks.h>
40 
41 namespace Gyoto {
42  namespace Metric {
43  class Generic;
44 
46 
55 
56 
65  template<typename T> SmartPointer<Metric::Generic> Subcontractor
67  SmartPointer<T> gg = new T();
68  gg -> setParameters(fmp);
69  return gg;
70  }
71 
73 
85  int errmode=0);
86 
88 
93  extern Register::Entry * Register_;
94 
96 
107  void Register(std::string kind, Gyoto::Metric::Subcontractor_t* scp);
108 
110 
114  void initRegister();
115 
116  }
117 
118  /* Documented elswhere */
119  class Worldline;
120 }
121 
143 : protected Gyoto::SmartPointee,
144  public Gyoto::Hook::Teller
145 {
146  friend class Gyoto::SmartPointer<Gyoto::Metric::Generic>;
147 
148  private:
149  std::string kind_;
150  double mass_;
152 
153  public:
154  const std::string getKind() const;
155  void setKind(const std::string);
156  int getRefCount();
157 
158  // Constructors - Destructor
159  // -------------------------
160  //Metric(const Metric& ) ; ///< Copy constructor
161  Generic();
162  Generic(const int coordkind);
163  Generic(const double mass, const int coordkind);
165 
166  virtual ~Generic() ;
167 
168  // Mutators / assignment
169  // ---------------------
170  virtual Generic * clone() const ;
171 
172  void setMass(const double);
173  void setMass(const double, const std::string &unit);
174 
175  // Accessors
176 
177  int getCoordKind() const;
178  void setCoordKind(int coordkind);
179 
180  double getMass() const;
181  double getMass(const std::string &unit) const;
182 
188  double unitLength() const ;
189  double unitLength(const std::string &unit) const ;
190 
191 
192  virtual void cartesianVelocity(double const coord[8], double vel[3]);
194 
200  virtual double SysPrimeToTdot(const double coord[4], const double v[3]) const;
202 
211  virtual void circularVelocity(double const pos[4], double vel[4],
212  double dir=1.) const ;
213 
224  virtual void nullifyCoord(double coord[8]) const;
226 
237  virtual void nullifyCoord(double coord[8], double& tdot2) const;
239 
240 
249  virtual double ScalarProd(const double pos[4],
250  const double u1[4], const double u2[4]) const;
251 
252  virtual double Norm3D(double* pos) const;
253 
254 
277  virtual void setParameter(std::string name,
278  std::string content,
279  std::string unit);
280 
281  // Outputs
282 #ifdef GYOTO_USE_XERCES
283 
305  virtual void setParameters(Gyoto::FactoryMessenger *fmp) ;
306 
313  virtual void fillElement(FactoryMessenger *fmp) ;
314 
318  void processGenericParameters(Gyoto::FactoryMessenger *fmp) ;
319 #endif
320 
329  virtual double gmunu(const double * x,
330  int mu, int nu) const
331  = 0 ;
332 
340  virtual double christoffel(const double coord[8],
341  const int alpha, const int mu, const int nu) const = 0;
342 
346  virtual int myrk4(Worldline * line, const double coord[8], double h, double res[8]) const;
347 
351  virtual int myrk4_adaptive(Gyoto::Worldline* line, const double coord[8],
352  double lastnorm, double normref,
353  double coordnew[8], double h0, double& h1) const;
354 
365  virtual int isStopCondition(double const * const coord) const;
366 
370  virtual int diff(const double y[8], double res[8]) const ;
371 
375  virtual void setParticleProperties(Gyoto::Worldline* line,
376  const double * coord) const;
377 
378 
379 };
380 
381 #endif