FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Geodesic4D.hpp
1
2//
3// $Id: Geodesic4D.hpp,v 1.2 2004/05/06 22:42:16 werner Exp $
4//
5// $Log: Geodesic4D.hpp,v $
6// Revision 1.2 2004/05/06 22:42:16 werner
7// Towards a specification of a spacetime via the Acceleration structure.
8//
9// Revision 1.1 2004/05/05 15:56:52 werner
10// Separation of DOP core routines with dynamic size into the ODE library.
11//
12// Revision 1.2 2004/05/03 13:33:33 werner
13// integration improved
14//
15// Revision 1.1 2004/04/28 14:06:37 werner
16// Integrators may be safely derived from the dop853 template now.
17// The template definition does not include the member functions, these
18// need to be included explicitely when instantiating the dop853 integrator.
19//
20//
22#ifndef __GEODESIC4D_HPP
23#define __GEODESIC4D_HPP "Created 27.03.2004 13:48:45 by werner benger"
24
25#include "Geodesic.hpp"
26#include "Integrate4D.hpp"
27
28namespace Traum
29{
30using namespace VecAl;
31
32template <class Acceleration>
34{
35public: typedef IntegratePath4D::real real;
36
37 typedef typename Acceleration::Scalar_t Scalar_t;
38 typedef typename Acceleration::Point_t Point_t;
39 typedef typename Acceleration::Vector_t Vector_t;
40 enum { dim = Acceleration::Dims };
41
42 const Acceleration&myAcceleration;
43
44 Geodesic4D(const Acceleration&A)
45 : myAcceleration(A)
46 {}
47
48 void restart(const real&s, const Point_t&x0, const Vector_t&v0)
49 {
50 init(s, x0.const_ptr(), v0.const_ptr() );
51 }
52
53 void Accel(real, const real *x, const real *v, real *d2x_ds2)
54 {
55 Point_t P;
56 Vector_t V;
57 for(int k=0; k<dim; k++)
58 {
59 P[k] = x[k];
60 V[k] = v[k];
61 }
62 const Vector_t&a = myAcceleration(P, V);
63 for(int i=0; i<nPaths(); i++)
64 d2x_ds2[i] = -a[i];
65 }
66
67 Point_t position() const
68 {
69 Point_t retval;
70 for(int i=0; i<dim; i++)
71 retval[i] = q(i);
72 return retval;
73 }
74
75 Vector_t velocity() const
76 {
77 Vector_t retval;
78 for(int i=0; i<dim; i++)
79 retval[i] = dq(i);
80 return retval;
81 }
82
83 Point_t position(real s) const
84 {
85 Point_t retval;
86 for(int i=0; i<dim; i++)
87 retval[i] = q(i, s);
88 return retval;
89 }
90
91 Vector_t velocity(real s) const
92 {
93 Vector_t retval;
94 for(int i=0; i<dim; i++)
95 retval[i] = dq(i, s);
96 return retval;
97 }
98};
99
100
101} // namespace
102
103#endif // __GEODESIC4D_HPP
Definition Geodesic4D.hpp:34
Definition Integrate4D.hpp:115