Gyoto
GyotoWorldline.h
Go to the documentation of this file.
1 
6 /*
7  Copyright 2011-2025 Frederic Vincent, Thibaut Paumard
8 
9  This file is part of Gyoto.
10 
11  Gyoto is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  Gyoto is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef __GyotoWorldline_H_
26 #define __GyotoWorldline_H_
27 
28 #include <iostream>
29 #include <fstream>
30 #include <string>
31 #include <vector>
32 
33 #include <GyotoDefs.h>
34 
35 #ifdef GYOTO_HAVE_BOOST_INTEGRATORS
36 # include <functional>
37 # include <array>
38 # include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
39 # include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
40 # include <boost/numeric/odeint/stepper/controlled_runge_kutta.hpp>
41 
42 
43 #endif
44 
45 namespace Gyoto {
46  class Worldline;
47  class FactoryMessenger;
48 }
49 
50 #include <GyotoSmartPointer.h>
51 #include <GyotoMetric.h>
52 #include <GyotoScreen.h>
53 #include <GyotoHooks.h>
54 
56 
62 #define GYOTO_WORLDLINE_PROPERTIES(c) \
63  Gyoto::Property("Gyoto::Worldline", "Time-like or null geodesic."), \
64  GYOTO_PROPERTY_BOOL(c, Integ31, Integ4D, _integ31, \
65  "Whether to integrate the 3+1 or 4D equation of geodesics.") \
66  GYOTO_PROPERTY_BOOL(c, HighOrderImages, PrimaryOnly, _secondary, \
67  "Whether to stop Photon integration at 180° deflection.") \
68  GYOTO_PROPERTY_BOOL(c, ParallelTransport, NoParallelTransport, _parallelTransport, \
69  "Whether to perform parallel transport of a local triad (used for polarization).") \
70  GYOTO_PROPERTY_BOOL(c, CheckBasis, NoCheckBasis, _checkBasis, \
71  "Whether to check basis orthogonality during parallel transport.") \
72  GYOTO_PROPERTY_DOUBLE(c, MaxCrossEqplane, _maxCrossEqplane, \
73  "Maximum number of crossings of the equatorial plane allowed for this worldline") \
74  GYOTO_PROPERTY_DOUBLE(c, RelTol, _relTol, \
75  "Relative tolerance for the adaptive step integrators.") \
76  GYOTO_PROPERTY_DOUBLE(c, AbsTol, _absTol, \
77  "Absolute tolerance for the adaptive step integrators.") \
78  GYOTO_PROPERTY_DOUBLE(c, NormTol, _normTol, \
79  "Tolerance on 4-velocity norm variations.") \
80  GYOTO_PROPERTY_DOUBLE(c, DeltaMaxOverR, _deltaMaxOverR, \
81  "Maximum value of step/distance from center of mass.") \
82  GYOTO_PROPERTY_DOUBLE(c, DeltaMax, _deltaMax, "Maximum step (geometrical units).") \
83  GYOTO_PROPERTY_DOUBLE(c, DeltaMin, _deltaMin, "Minimum step (geometrical units).") \
84  GYOTO_PROPERTY_STRING(c, Integrator, _integrator, \
85  "Name of integrator (\"runge_kutta_fehlberg78\").") \
86  GYOTO_PROPERTY_SIZE_T(c, MaxIter, _maxiter, \
87  "Maximum number of integration steps.") \
88  GYOTO_PROPERTY_BOOL(c, Adaptive, NonAdaptive, _adaptive, \
89  "Whether to use an adaptive step.") \
90  GYOTO_PROPERTY_DOUBLE_UNIT(c, MinimumTime, _tMin, \
91  "Do not integrate earlier than this date (geometrical_time).") \
92  GYOTO_PROPERTY_DOUBLE_UNIT(c, Delta, _delta, \
93  "Initial integration step (geometrical units).") \
94  GYOTO_PROPERTY_VECTOR_DOUBLE(c, InitCoord, _initCoord, \
95  "Initial 8-coordinate.") \
96  GYOTO_PROPERTY_METRIC(c, Metric, _metric, \
97  "The geometry of space-time at this end of the Universe.")
98 
100 
114 #define GYOTO_WORLDLINE_ACCESSORS(c) \
115  void c::_integ31(bool s) {integ31(s);} \
116  bool c::_integ31() const {return integ31();} \
117  void c::_secondary(bool s) {secondary(s);} \
118  bool c::_secondary() const {return secondary();} \
119  void c::_parallelTransport(bool s) {parallelTransport(s);} \
120  bool c::_parallelTransport() const {return parallelTransport();} \
121  void c::_checkBasis(bool s) {checkBasis(s);} \
122  bool c::_checkBasis() const {return checkBasis();} \
123  void c::_adaptive(bool s) {adaptive(s);} \
124  bool c::_adaptive() const {return adaptive();} \
125  void c::_maxCrossEqplane(double max){maxCrossEqplane(max);} \
126  double c::_maxCrossEqplane()const{return maxCrossEqplane();} \
127  void c::_relTol(double f){relTol(f);} \
128  double c::_relTol()const{return relTol();} \
129  void c::_absTol(double f){absTol(f);} \
130  double c::_absTol()const{return absTol();} \
131  void c::_deltaMin(double f){deltaMin(f);} \
132  double c::_deltaMin()const{return deltaMin();} \
133  void c::_deltaMax(double f){deltaMax(f);} \
134  double c::_deltaMax()const{return deltaMax();} \
135  void c::_normTol(double f){normTol(f);} \
136  double c::_normTol()const{return normTol();} \
137  void c::_deltaMaxOverR(double f){deltaMaxOverR(f);} \
138  double c::_deltaMaxOverR()const{return deltaMaxOverR();} \
139  void c::_delta(double f){delta(f);} \
140  double c::_delta()const{return delta();} \
141  void c::_delta(double f, std::string const &u){delta(f, u);} \
142  double c::_delta(std::string const &u)const{return delta(u);} \
143  void c::_tMin(double f){tMin(f);} \
144  double c::_tMin()const{return tMin();} \
145  void c::_tMin(double f, std::string const &u){tMin(f, u);} \
146  double c::_tMin(std::string const &u)const{return tMin(u);} \
147  void c::_maxiter(size_t f){maxiter(f);} \
148  size_t c::_maxiter()const{return maxiter();} \
149  void c::_integrator(std::string const &f){integrator(f);} \
150  std::string c::_integrator() const {return integrator();} \
151  std::vector<double> c::_initCoord()const{return initCoord();} \
152  void c::_initCoord(std::vector<double> const &f){initCoord(f);} \
153  void c::_metric(SmartPointer<Metric::Generic>f){metric(f);} \
154  SmartPointer<Metric::Generic> c::_metric() const{return metric();}
155 
157 
163 #define GYOTO_WORLDLINE_PROPERTY_END(c, a) \
164  GYOTO_WORLDLINE_PROPERTIES(c) \
165  GYOTO_PROPERTY_END(c, a) \
166  GYOTO_WORLDLINE_ACCESSORS(c)
167 
169 
176 #define GYOTO_WORLDLINE \
177  void _delta(const double delta); \
178  void _delta(double, const std::string &unit); \
179  double _delta() const ; \
180  double _delta(const std::string &unit) const ; \
181  void _tMin(const double tmin); \
182  void _tMin(double, const std::string &unit); \
183  double _tMin() const ; \
184  double _tMin(const std::string &unit) const ; \
185  void _adaptive (bool mode) ; \
186  bool _adaptive () const ; \
187  void _secondary (bool sec) ; \
188  bool _secondary () const ; \
189  void _integ31 (bool sec) ; \
190  bool _integ31 () const ; \
191  void _parallelTransport (bool sec) ; \
192  bool _parallelTransport () const ; \
193  void _checkBasis (bool sec) ; \
194  bool _checkBasis () const ; \
195  void _maxiter (size_t miter) ; \
196  size_t _maxiter () const ; \
197  void _integrator(std::string const & type); \
198  std::string _integrator() const ; \
199  double _deltaMin() const; \
200  void _deltaMin(double h1); \
201  double _normTol() const; \
202  void _normTol(double normtol); \
203  void _absTol(double); \
204  double _absTol()const; \
205  void _maxCrossEqplane(double); \
206  double _maxCrossEqplane()const; \
207  void _relTol(double); \
208  double _relTol()const; \
209  void _deltaMax(double h1); \
210  double _deltaMax()const; \
211  double _deltaMaxOverR() const; \
212  void _deltaMaxOverR(double t); \
213  std::vector<double> _initCoord()const; \
214  void _initCoord(std::vector<double> const&f); \
215  void _metric(SmartPointer<Metric::Generic>); \
216  SmartPointer<Metric::Generic> _metric() const;
217 
255 : protected Gyoto::Hook::Listener
256 {
257 
258  // Data :
259  // -----
260  public:
261  int stopcond;
262 
263  protected:
265  double* tau_;
266  double* x0_;
267  double* x1_;
268  double* x2_;
269  double* x3_;
270  double* x0dot_;
271  double* x1dot_;
272  double* x2dot_;
273  double* x3dot_;
274  double* ep0_;
275  double* ep1_;
276  double* ep2_;
277  double* ep3_;
278  double* et0_;
279  double* et1_;
280  double* et2_;
281  double* et3_;
282  size_t x_size_;
283  size_t imin_;
284  size_t i0_;
285  size_t imax_;
286  bool adaptive_;
287 
294 
302 
308 
314  double delta_;
315 
316 
326  double tmin_;
327 
328  double * cst_;
329  size_t cst_n_;
330  int wait_pos_;
331  double * init_vel_;
332  size_t maxiter_ ;
333 
341  double delta_min_;
342 
350  double delta_max_;
351 
364 
372  double abstol_;
373 
381  double reltol_;
382 
392  double normtol_;
393 
401 
402  // Constructors - Destructor
403  // -------------------------
404  public:
405  Worldline() ;
406 
407  Worldline(const Worldline& ) ;
408 
410 
423  Worldline(Worldline* orig, size_t i0, int dir, double step_max) ;
424 
425  virtual ~Worldline() ;
426 
427  size_t getImin() const;
428  size_t getImax() const;
429  size_t getI0() const;
430 
431  virtual double getMass() const = 0;
434 
435  void initCoord(std::vector<double> const&);
436  std::vector<double> initCoord() const;
437 
460  virtual void setInitCoord(const double coord[8], int dir,
461  double const Ephi[4],
462  double const Etheta[4]);
463 
464 
483  virtual void setInitCoord(const double coord[8], int dir = 0);
484 
492  virtual void setInitCoord(double const pos[4], double const vel[3], int dir=0);
493 
494  virtual void setPosition(double const pos[4]);
495  virtual void setVelocity(double const vel[3]);
496 
497  void reset() ;
498  void reInit() ;
499 
500  virtual std::string className() const ;
501  virtual std::string className_l() const ;
502 
513  void integrator(std::string const & type);
514 
518  std::string integrator() const ;
519 
526  void integ31(bool integ);
527 
531  bool integ31() const ;
532 
536  double deltaMin() const;
537 
541  void deltaMin(double h1);
542 
546  double deltaMax() const;
547 
548  double normTol() const;
549  void normTol(double normtol);
550  void absTol(double);
551  double absTol()const;
552  void relTol(double);
553  double relTol()const;
554 
555  void maxCrossEqplane(double);
556  double maxCrossEqplane()const;
557 
568  virtual double deltaMax(double const pos[8], double delta_max_external) const;
569 
573  void deltaMax(double h1);
574 
575  double deltaMaxOverR() const;
576  void deltaMaxOverR(double t);
577 
578  // Memory management
579  // -----------------
580  protected:
584  virtual void xAllocate();
585 
589  virtual void xAllocate(size_t size);
590 
602  virtual size_t xExpand(int dir);
603 
611  virtual void xExpand(double * &x, int dir);
612 
616  virtual void eAllocate ();
617 
621  virtual void eDeallocate ();
622 
626  virtual void eExpand(int dir);
627 
628  // Mutators / assignment
629  // ---------------------
630  public:
632  void delta(const double delta);
633  void delta(double, const std::string &unit);
634  double delta() const ;
635  double delta(const std::string &unit) const ;
636  double tMin() const ;
637  double tMin(const std::string &unit) const ;
638  void tMin(double tlim);
639  void tMin(double, const std::string &unit);
640  void adaptive (bool mode) ;
641  bool adaptive () const ;
642  void secondary (bool sec) ;
643  bool secondary () const ;
644  void parallelTransport (bool pt) ;
645  bool parallelTransport () const ;
646  void checkBasis (bool cb) ;
647  bool checkBasis () const ;
648  void maxiter (size_t miter) ;
649  size_t maxiter () const ;
650 
660  double const * getCst() const ;
661 
663 
671  void setCst(double const * cst, size_t const ncsts) ;
672 
674 
680  void constantsOfMotion(std::vector<double> const cstv) ;
681 
683 
688  std::vector<double> constantsOfMotion() const ;
689 
691 
703  const double coord[8],
704  const int dir,
705  double const Ephi[4], double const Etheta[4]) ;
706 
708 
716  const double coord[8],
717  const int dir) ;
718 
724  void getInitialCoord(std::vector<double> &dest) const;
725 
731  void getCoord(size_t index, Gyoto::state_t &dest) const;
732 
737  void getCoord(size_t index, Gyoto::state_t &dest) ;
738 
744  void getCoord(double date, Gyoto::state_t &dest, bool proper=false);
745 
746  void getCartesianPos(size_t index, double dest[4]) const;
747 
748 
749  virtual void xStore(size_t ind, state_t const &coord, double tau) ;
750  virtual void xStore(size_t ind, state_t const &coord) =delete;
751  virtual void xStore(size_t ind, double const coord[8]) = delete;
752  virtual void xFill(double tlim, bool proper=false) ;
753 
754 
755 
756  // Accessors
757  // ---------
758  public:
762  size_t get_nelements() const;
763 
767  void get_t(double *dest) const;
768 
772  void get_tau(double *dest) const;
773 
775 
791  void getCartesian(double const * const dates, size_t const n_dates,
792  double * const x, double * const y,
793  double * const z, double * const xprime=NULL,
794  double * const yprime=NULL, double * const zprime=NULL) ;
795 
799  void get_xyz(double* x, double *y, double *z) const;
800 
832  void getCoord(double const * const dates, size_t const n_dates,
833  double * const x1dest,
834  double * const x2dest, double * const x3dest,
835  double * const x0dot=NULL, double * const x1dot=NULL,
836  double * const x2dot=NULL, double * const x3dot=NULL,
837  double * ep0=NULL, double * ep1=NULL, double * ep2=NULL, double * ep3=NULL,
838  double * et0=NULL, double * et1=NULL, double * et2=NULL, double * et3=NULL,
839  double * otime=NULL, bool proper=false) ;
840 
847  void getCoord(double *x0, double *x1, double *x2, double *x3) const ;
848 
857  void checkPhiTheta(double coord[8]) const;
858 
862  void getSkyPos(SmartPointer<Screen> screen, double *dalpha, double *ddellta, double *dD) const;
863 
867  void get_dot(double *x0dot, double *x1dot, double *x2dot, double *x3dot) const ;
868 
872  void get_prime(double *x1prime, double *x2prime, double *x3prime) const ;
873 
874  // Outputs
875  // -------
876  public:
877  //virtual void sauve(FILE *) const ; ///< Save in a file
878  void save_txyz(char * fichierxyz) const ;
879  void save_txyz(char* const filename, double const t1, double const mass_sun,
880  double const distance_kpc, std::string const unit, SmartPointer<Screen> sc = NULL);
881 
882  protected:
883  virtual void tell(Gyoto::Hook::Teller*);
884  void checkBasis(state_t &coord) const;
885 
886  class IntegState {
887  public:
888  class Generic;
889  class Legacy;
890 #ifdef GYOTO_HAVE_BOOST_INTEGRATORS
891  class Boost;
892 #endif
893  };
894 
895 
900 };
901 
902 #ifndef GYOTO_SWIGIMPORTED
903 
909 
910  protected:
912 
917  // add 31 flag
918  bool integ_31_;
919  double delta_;
920  bool adaptive_;
923  double norm_;
924  double normref_;
925 
929  Gyoto::SmartPointer<Gyoto::Metric::Generic> gg_;
930 
931  public:
937  Generic(Worldline *parent);
938 
942  virtual ~Generic();
943 
949  virtual Generic * clone(Worldline*newparent) const =0 ;
950 
957  virtual void init(Worldline * line, const state_t &coord, const double delta);
959  virtual void init(Worldline * line, const double *coord, const double delta) = delete;
960 
969  virtual void init();
970 
977  virtual void checkNorm(double coord[8]);
978 
982  virtual std::string kind()=0;
983 
987  void integ31(bool integ);
988  bool integ31() const ;
989 
991 
996  virtual int nextStep(state_t &coord, double &tau, double h1max=GYOTO_DEFAULT_DELTA_MAX)=0;
998  virtual int nextStep(double *coord, double h1max=GYOTO_DEFAULT_DELTA_MAX) = delete;
999 
1001 
1010  virtual void doStep(state_t const &coordin,
1011  double step,
1012  state_t &coordout)=0;
1014  virtual void doStep(double const coordin[8],
1015  double step,
1016  double coordout[8]) = delete;
1017 
1018 };
1019 
1035 
1036  private:
1037  state_t coord_;
1038 
1039  public:
1041 
1042  Legacy(Worldline *parent);
1043  Legacy * clone(Worldline*newparent) const ;
1044  using Generic::init;
1045  void init(Worldline * line, const state_t &coord, const double delta);
1046  virtual std::string kind();
1047 
1048  virtual int nextStep(state_t &coord, double &tau, double h1max=1e6);
1049 
1050  virtual void doStep(state_t const &coordin,
1051  double step,
1052  state_t &coordout);
1053 
1054  virtual ~Legacy();
1055 };
1056 
1057 #ifdef GYOTO_HAVE_BOOST_INTEGRATORS
1058 
1070  friend class Gyoto::SmartPointer<Gyoto::Worldline::IntegState>;
1071  public:
1075  enum Kind {runge_kutta_cash_karp54,
1076  runge_kutta_fehlberg78,
1077  runge_kutta_dopri5,
1078  runge_kutta_cash_karp54_classic };
1079  private:
1082 
1083  typedef std::function<boost::numeric::odeint::controlled_step_result
1084  (state_t&, double&, double&)> try_step_t;
1085  typedef std::function<void(state_t&, double)> do_step_t;
1086  typedef std::function<void(const state_t &/*x*/,
1087  state_t & /*dxdt*/,
1088  const double /* t*/ )> system_t;
1089 
1091  try_step_t try_step_;
1092 
1094  do_step_t do_step_;
1095 
1096  void setup_stepper();
1097  public:
1098  system_t system_;
1100  template<class Value, class Algebra = boost::numeric::odeint::range_algebra, class Operations = boost::numeric::odeint::default_operations>
1102  using value_type = Value;
1103  using default_checker = boost::numeric::odeint::default_error_checker<Value, Algebra, Operations>;
1104 
1105  default_checker checker;
1106  const Metric::Generic* met; // Metric gg_
1107  Value normTol; // tolerance on the norm
1108  const double& ref_norm; // pointer for getting normref_
1109 
1110  my_error_checker(Value abs_tol,
1111  Value rel_tol,
1112  const Metric::Generic* met,
1113  const double& ref_norm,
1114  Value normTol_,
1115  const do_step_t& do_step)
1116  : checker(abs_tol, rel_tol), met(met), normTol(normTol_), ref_norm(ref_norm), do_step_(do_step) {}
1117 
1118  const do_step_t& do_step_;
1119  // Signature for Boost.Odeint
1120  template<class State, class Deriv, class Err, class Time>
1121  Value error(Algebra &algebra,
1122  const State &x_old,
1123  const Deriv &dxdt_old,
1124  Err &x_err,
1125  const Time &dt) const
1126  {
1127  // Standard Boost numerical error
1128  Value err_default = checker.error(algebra, x_old, dxdt_old, x_err, dt);
1129 
1130  // Compute new vector (4-position, 4-velocity, polar basis if parallel_transport)
1131  state_t x_new=x_old;
1132  do_step_(x_new, dt);
1133 
1134  // Compute norm of 4-velocity
1135  GYOTO_DEBUG << "Computing norm" << std::endl;
1136  Value u_norm = met->ScalarProd(&x_new[0], &x_new[4], &x_new[4]);
1137  GYOTO_DEBUG_EXPR(u_norm);
1138 
1139  // Compute drifting of norm
1140  Value norm_drift = fabs(u_norm - ref_norm) / normTol;
1141  GYOTO_DEBUG_EXPR(ref_norm);
1142 
1143  GYOTO_DEBUG << "err_default = " << err_default
1144  << " norm_drift = " << norm_drift
1145  << " max = " << std::max(err_default, norm_drift)
1146  << std::endl;
1147 
1148  // Return max between numerical error and drift of the norm if drift > 1
1149  // This avoid to the norm_drift to affects too much the length's computation of the next step
1150  return std::max(err_default, (norm_drift > 1.0 ? norm_drift : 0.0));
1151 
1152 
1153  }
1154  };
1155 
1157 
1162  Boost(Worldline* parent, std::string type);
1163 
1165 
1170  Boost(Worldline* parent, Kind type);
1171  Boost * clone(Worldline* newparent) const ;
1172  virtual ~Boost();
1173  virtual void init();
1174  virtual void init(Worldline * line, const state_t &coord, const double delta);
1175  virtual int nextStep(state_t &coord, double &tau, double h1max=1e6);
1176  virtual void doStep(state_t const &coordin,
1177  double step,
1178  state_t &coordout);
1179  virtual std::string kind();
1180 
1181  private:
1182  double checkBasis(state_t const &coord) const;
1183  void reorthonormalizeBasis(state_t &coord) const;
1184 
1185 };
1186 #endif
1187 #endif
1188 #endif
double delta_max_over_r_
Numerical tuning parameter.
Definition: GyotoWorldline.h:363
double maxCrossEqplane() const
Get maxCrossEqplane_.
double * init_vel_
Hack in setParameters()
Definition: GyotoWorldline.h:331
void getSkyPos(SmartPointer< Screen > screen, double *dalpha, double *ddellta, double *dD) const
Get computed positions in sky coordinates.
size_t get_nelements() const
Get number of computed dates.
void reset()
Forget integration, keeping initial contition.
void integ31(bool integ)
Defines the kind of geodesic equation to integrate (3+1, 4D)
virtual void setPosition(double const pos[4])
Set initial 4-position.
double deltaMax() const
Get delta_max_.
double maxCrossEqplane_
Maximum number of crossings of equatorial plane.
Definition: GyotoWorldline.h:400
Timelike or null geodesics.
Definition: GyotoWorldline.h:254
SmartPointer< Gyoto::Metric::Generic > metric_
The Gyoto::Metric in this part of the universe.
Definition: GyotoWorldline.h:264
double delta_
Initial integrating step.
Definition: GyotoWorldline.h:314
void get_tau(double *dest) const
Get computed proper times or values of the affine parameter.
virtual void xFill(double tlim, bool proper=false)
Fill x0, x1... by integrating the Worldline from previously set inittial condition to time tlim...
void save_txyz(char *fichierxyz) const
Save in a file.
Tellers tell Listeners when they mutate.
virtual void xStore(size_t ind, state_t const &coord, double tau)
Store coord at index ind.
bool parallel_transport_
Whether to parallel-transport base vectors.
Definition: GyotoWorldline.h:921
Base class for metrics.
Definition: GyotoMetric.h:163
Reference-counting pointers.
virtual std::string className_l() const
"worldline"
Boost integrator.
Definition: GyotoWorldline.h:1068
do_step_t do_step_
Stepper used by the non-adaptive-step integrator.
Definition: GyotoWorldline.h:1094
void setInitialCondition(SmartPointer< Metric::Generic > gg, const double coord[8], const int dir, double const Ephi[4], double const Etheta[4])
Set or re-set the initial condition prior to integration.
#define GYOTO_DEBUG
Display debug message (in debug mode)
Definition: GyotoDefs.h:367
void reInit()
Reset and recompute particle properties.
double tmin_
Time limit for the integration (geometrical units)
Definition: GyotoWorldline.h:326
Kind
Enum to represent the integrator flavour.
Definition: GyotoWorldline.h:1075
double delta_min_
Minimum integration step for the adaptive integrator.
Definition: GyotoWorldline.h:341
double * tau_
proper time or affine parameter
Definition: GyotoWorldline.h:265
size_t getImax() const
Get imax_.
virtual void eExpand(int dir)
virtual void checkNorm(double coord[8])
Check norm.
bool check_basis_
Whether to check for orthogonality.
Definition: GyotoWorldline.h:922
double * cst_
Worldline&#39;s csts of motion (if any)
Definition: GyotoWorldline.h:328
double * et1_
Coordinate of Second base vector to parallel transport.
Definition: GyotoWorldline.h:279
double relTol() const
Get reltol_.
double delta() const
Get delta_.
void getInitialCoord(std::vector< double > &dest) const
Get initial coordinates + base vectors.
void getCartesian(double const *const dates, size_t const n_dates, double *const x, double *const y, double *const z, double *const xprime=NULL, double *const yprime=NULL, double *const zprime=NULL)
Get the 6 Cartesian coordinates for specific dates.
virtual int nextStep(state_t &coord, double &tau, double h1max=GYOTO_DEFAULT_DELTA_MAX)=0
Make one step.
bool adaptive_
Whether to use an adaptive step.
Definition: GyotoWorldline.h:920
virtual void tell(Gyoto::Hook::Teller *)
This is how a Teller tells.
bool secondary() const
Get secondary_.
Gyoto::SmartPointer< Gyoto::Metric::Generic > gg_
The Metric in this end of the Universe.
Definition: GyotoWorldline.h:929
double * et2_
Coordinate of Second base vector to parallel transport.
Definition: GyotoWorldline.h:280
#define GYOTO_DEBUG_EXPR(a)
Output expression value in debug mode.
Definition: GyotoDefs.h:280
void get_xyz(double *x, double *y, double *z) const
Get 3-position in cartesian coordinates for computed dates.
size_t i0_
Index of initial condition in array.
Definition: GyotoWorldline.h:284
void getCartesianPos(size_t index, double dest[4]) const
Get Cartesian expression of 4-position at index.
Obsolete: Home-brewed integrator.
Definition: GyotoWorldline.h:1033
double tMin() const
Get tmin_.
double const * getCst() const
Returns the worldline&#39;s cst of motion (if any)
Gyoto ubiquitous macros and typedefs.
Base class for metric description.
SmartPointer< Worldline::IntegState::Generic > state_
An object to hold the integration state.
Definition: GyotoWorldline.h:899
size_t x_size_
Coordinate of Second base vector to parallel transport.
Definition: GyotoWorldline.h:282
double * x0_
t or T
Definition: GyotoWorldline.h:266
bool adaptive_
Whether integration should use adaptive delta.
Definition: GyotoWorldline.h:286
bool integ31() const
Get the kind of geodesic equation integrated by state_.
double * ep3_
Coordinate of first base vector to parallel transport.
Definition: GyotoWorldline.h:277
size_t getImin() const
Get imin_.
size_t maxiter() const
Get maxiter_.
double * x2_
θ or y
Definition: GyotoWorldline.h:268
double * x3dot_
φdot or zdot
Definition: GyotoWorldline.h:273
bool check_basis_
Whether to check for orthogonaliry during parallel transport.
Definition: GyotoWorldline.h:307
double * x0dot_
tdot or Tdot
Definition: GyotoWorldline.h:270
bool parallel_transport_
Whether to parallel transport a local triad.
Definition: GyotoWorldline.h:301
Definition: GyotoWorldline.h:886
double norm_
Current norm of the 4-velocity.
Definition: GyotoWorldline.h:923
double reltol_
Absolute tolerance of the integrator.
Definition: GyotoWorldline.h:381
double normref_
Definition: GyotoWorldline.h:924
double deltaMaxOverR() const
Get delta_max_over_r_.
double * et3_
Coordinate of Second base vector to parallel transport.
Definition: GyotoWorldline.h:281
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:46
virtual double getMass() const =0
Get mass of particule.
virtual Generic * clone(Worldline *newparent) const =0
Deep copy.
virtual void init()
Cache whatever needs to be cached.
virtual void doStep(state_t const &coordin, double step, state_t &coordout)=0
Make one step of exactly this size.
virtual double ScalarProd(const double pos[4], const double u1[4], const double u2[4]) const
Scalar product.
virtual void eAllocate()
Allocate ep0_ ... et3_.
void get_t(double *dest) const
Get computed dates.
double * ep1_
Coordinate of first base vector to parallel transport.
Definition: GyotoWorldline.h:275
bool adaptive() const
Get adaptive_.
void checkPhiTheta(double coord[8]) const
Bring θ in [0,Π] and φ in [0,2Π].
double deltaMin() const
Get delta_min_.
double normTol() const
Get normtol_.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:80
bool secondary_
Experimental: choose 0 to compute only primary image.
Definition: GyotoWorldline.h:293
try_step_t try_step_
Stepper used by the adaptive-step integrator.
Definition: GyotoWorldline.h:1091
I might listen to a Teller.
Definition: GyotoHooks.h:64
void get_prime(double *x1prime, double *x2prime, double *x3prime) const
Get computed 3-velocities.
bool parallelTransport() const
Get parallel_transport_.
double normtol_
Tolerance on 4-velocity norm variations.
Definition: GyotoWorldline.h:392
std::vector< double > constantsOfMotion() const
Return a copy of the Metric-specific constants of motion.
virtual std::string kind()=0
Return the integrator kind.
bool integ_31_
Whether to integrate the 3+1 equation of geodesics instead of the 4D one.
Definition: GyotoWorldline.h:918
virtual ~Worldline()
Destructor.
double delta_
Integration step (current in case of adaptive_).
Definition: GyotoWorldline.h:919
double * x3_
φ or z
Definition: GyotoWorldline.h:269
Container for the value of a Property.
Definition: GyotoValue.h:60
void getCoord(size_t index, Gyoto::state_t &dest) const
Get coordinates+base vectors corresponding to index.
double * ep2_
Coordinate of first base vector to parallel transport.
Definition: GyotoWorldline.h:276
Custom error checker that takes into account the norm of the impulsion.
Definition: GyotoWorldline.h:1101
virtual std::string className() const
"Worldline"
size_t cst_n_
Number of constants of motion.
Definition: GyotoWorldline.h:329
size_t imin_
Minimum index for which x0_, x1_... have been computed.
Definition: GyotoWorldline.h:283
double * x1dot_
rdot or xdot
Definition: GyotoWorldline.h:271
double abstol_
Absolute tolerance of the integrator.
Definition: GyotoWorldline.h:372
size_t getI0() const
Get i0_.
virtual size_t xExpand(int dir)
Expand x0, x1 etc... to hold more elements.
Current state of a geodesic integration.
Definition: GyotoWorldline.h:907
virtual void setVelocity(double const vel[3])
Set initial 3-velocity.
Kind kind_
Integrator flavour.
Definition: GyotoWorldline.h:1081
Description of the observer screen.
virtual void setInitCoord(const double coord[8], int dir, double const Ephi[4], double const Etheta[4])
Set Initial coordinate.
SmartPointer< Metric::Generic > metric() const
Get metric.
virtual void eDeallocate()
Deallocate ep0_ ... et3_.
Worldline * line_
Worldline that we are integrating.
Definition: GyotoWorldline.h:916
double delta_max_
Maximum integration step for the adaptive integrator.
Definition: GyotoWorldline.h:350
double * et0_
Coordinate of first base vector to parallel transport.
Definition: GyotoWorldline.h:278
int wait_pos_
Hack in setParameters()
Definition: GyotoWorldline.h:330
std::string integrator() const
Describe the integrator used by state_.
virtual void xAllocate()
Allocate x0, x1 etc. with default size.
double * x2dot_
θdot or ydot
Definition: GyotoWorldline.h:272
Listen to me and I&#39;ll warn you when I change.
Definition: GyotoHooks.h:82
void get_dot(double *x0dot, double *x1dot, double *x2dot, double *x3dot) const
Get computed 4-velocities.
double * x1_
r or x
Definition: GyotoWorldline.h:267
int stopcond
Whether and why integration is finished.
Definition: GyotoWorldline.h:261
void setCst(double const *cst, size_t const ncsts)
Set Metric-specific constants of motion.
size_t maxiter_
Maximum number of iterations when integrating.
Definition: GyotoWorldline.h:332
Worldline()
Default constructor.
bool checkBasis() const
Get check_basis_.
double absTol() const
Get abstol_.
size_t imax_
Maximum index for which x0_, x1_... have been computed.
Definition: GyotoWorldline.h:285