FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Geodesic853.hpp
1
2//
3// $Id: Geodesic853.hpp,v 1.7 2004/08/12 16:21:33 werner Exp $
4//
5// $Log: Geodesic853.hpp,v $
6// Revision 1.7 2004/08/12 16:21:33 werner
7// Integration of numerical geodesics now compiles. Working is not yet satisfying.
8//
9// Revision 1.6 2004/05/13 12:06:37 werner
10// Removed no-op code.
11//
12// Revision 1.5 2004/05/11 18:05:10 werner
13// *** empty log message ***
14//
15// Revision 1.4 2004/05/06 22:42:16 werner
16// Towards a specification of a spacetime via the Acceleration structure.
17//
18// Revision 1.3 2004/05/05 15:56:52 werner
19// Separation of DOP core routines with dynamic size into the ODE library.
20//
21// Revision 1.2 2004/05/03 13:33:33 werner
22// integration improved
23//
24// Revision 1.1 2004/04/28 14:06:37 werner
25// Integrators may be safely derived from the dop853 template now.
26// The template definition does not include the member functions, these
27// need to be included explicitely when instantiating the dop853 integrator.
28//
30#ifndef __GEODESIC853_HPP
31#define __GEODESIC853_HPP "Created 27.03.2004 13:48:45 by werner benger"
32
33#include "Geodesic.hpp"
34#include <ode/Integrate853.hpp>
35
36namespace Traum
37{
38using namespace VecAl;
39
40template <class Acceleration>
41//class Geodesic853 : public IntegratePath853<long double>
42class Geodesic853 : public IntegratePath853<float>
43{
44 int components;
45public:
46 const Acceleration&myAcceleration;
47
48 typedef typename Acceleration::Point_t Point_t;
49 typedef typename Acceleration::Vector_t Vector_t;
50
51 enum { Dims = Acceleration::Dims };
52
53 Geodesic853(const Acceleration&A)
54 : myAcceleration(A)
55 , components(0)
56 {}
57
58 void restart(int N, long double s, const Point_t*x0, const Vector_t*v0)
59 {
60 components = N*Dims;
61 init(components, s, x0->const_ptr(), v0->const_ptr() );
62 }
63
64 void restart1(long double s, const Point_t&x0, const Vector_t&v0)
65 {
66 components = Dims;
67 init(components, s, x0.const_ptr(), v0.const_ptr() );
68 }
69
70 void Accel(real, const real *x, const real *v, real *d2x_ds2)
71 {
72 for(int c=0; c<components/Dims; c++)
73 {
74 Point_t P;
75 Vector_t V;
76
77 for(int i=0; i<Dims; i++)
78 {
79 P[i] = x[c*Dims + i];
80 V[i] = v[c*Dims + i];
81 }
82
83 const Vector_t&a = myAcceleration(P, V);
84
85 for(int j=0; j<Dims; j++)
86 d2x_ds2[j+c*Dims] = -a[j];
87 }
88 }
89
90 Point_t position(int c=0) const
91 {
92 Point_t retval;
93 for(int i=0; i<Dims; i++)
94 retval[i] = q(i+c*Dims);
95 return retval;
96 }
97
98 Vector_t velocity(int c=0) const
99 {
100 Vector_t retval;
101 for(int i=0; i<Dims; i++)
102 retval[i] = dq(i+c*Dims);
103 return retval;
104 }
105
106 Point_t position(real s, int c=0) const
107 {
108 Point_t retval;
109 for(int i=0; i<Dims; i++)
110 retval[i] = q(i+c*Dims, s);
111 return retval;
112 }
113
114 Vector_t velocity(real s, int c=0) const
115 {
116 Vector_t retval;
117 for(int i=0; i<Dims; i++)
118 retval[i] = dq(i+c*Dims, s);
119 return retval;
120 }
121};
122
123} // namespace Vecal
124
125#endif // __GEODESIC853_HPP
Definition Geodesic853.hpp:43