FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
RungeKutta.hpp
1
2//
3// $Id: RungeKutta.hpp,v 1.1 2004/08/12 16:21:33 werner Exp $
4//
5// $Log: RungeKutta.hpp,v $
6// Revision 1.1 2004/08/12 16:21:33 werner
7// Integration of numerical geodesics now compiles. Working is not yet satisfying.
8//
9// Revision 1.8 2004/05/12 14:36:22 werner
10// Separation of chart definitions on a manifold and the tangential space.
11// Introduced convenient coordinate transformations.
12//
13// Revision 1.7 2004/05/11 18:05:10 werner
14//
15// Revision 1.6 2004/05/11 16:53:47 werner
16// Introduction of coordinate systems for improved type-safety.
17// Will support easy coordinate transformations soon.
18//
19// Revision 1.5 2004/05/06 22:42:16 werner
20// Towards a specification of a spacetime via the Acceleration structure.
21//
22// Revision 1.4 2004/05/05 15:56:52 werner
23// Separation of DOP core routines with dynamic size into the ODE library.
24//
25// Revision 1.3 2004/05/03 13:33:33 werner
26// integration improved
27//
28// Revision 1.2 2004/03/29 11:51:02 werner
29// Common interface among simple integrators, DiffMe and Vecal, and preliminiary work on integrating dop853.
30//
31// Revision 1.1 2004/03/22 11:55:02 werner
32// Schwarzschild geodesic integration.
33//
34// Revision 1.1 2004/02/13 16:36:21 werner
35// Initial preliminiary version of the Vector Algebra Library.
36//
38#ifndef __RUNGE_KUTTA_Geodesic_HPP
39#define __RUNGE_KUTTA_Geodesic_HPP "Created 20.07.2004 00:11:27 by werner"
40
41#include <vecal/VVector.hpp>
42#include <vecal/Matrix.hpp>
43
44#include <ode/Integrator.hpp>
45#include <spacetime/Geodesic.hpp>
46
47namespace Traum
48{
49
50template <class Acceleration>
52{
53 typedef typename Acceleration::Scalar_t Scalar_t;
54 typedef typename Acceleration::Point_t Point_t;
55 typedef typename Acceleration::Vector_t Vector_t;
56 typedef typename Acceleration::Christoffel_t Christoffel_t;
57
58 typedef typename Point_t::Vector_t PointComponents_t;
59 enum { Dims = PointComponents_t::SIZE };
60
61 Point_t x;
62 Vector_t v;
63
64 const Acceleration&Accel;
65 Scalar_t ds;
66
67 RungeKuttaGeodesic(const Acceleration&A)
68 : Accel(A), ds(1)
69 {}
70
71 success_code advance(bool bk=false)
72 {
73 Scalar_t ds = bk?-this->ds:this->ds;
74
75 Point_t P = x + v*(ds/2.L);
76 Vector_t V = v + v/2.L;
77
78 Vector_t
79 b1 = ds * Accel(x, v),
80 b2 = ds * Accel(x + v*(ds/2.L) + b1*(ds/8.L), v + b1/2.L),
81 b3 = ds * Accel(x + v*(ds/2.L) + b1*(ds/8.L), v + b2/2.L),
82 b4 = ds * Accel(x + v*ds + b3*(ds/2.L), v + b3);
83
84 x += v*ds + (b1 + b2 + b3) * ds/6;
85 v += (b1 +2.L*b2 +2.L*b3 + b4)/6;
86
87 return StepOk;
88 }
89};
90
91
92} /* namespace VecAl */
93
94#endif /* __RUNGE_KUTTA_Geodesic_HPP */
Definition RungeKutta.hpp:52