EulerGeodesic.hpp

00001 
00002 //
00003 // $Id: EulerGeodesic.hpp,v 1.1 2004/08/12 16:21:33 werner Exp $
00004 //
00005 // $Log: EulerGeodesic.hpp,v $
00006 // Revision 1.1  2004/08/12 16:21:33  werner
00007 // Integration of numerical geodesics now compiles. Working is not yet satisfying.
00008 //
00009 // Revision 1.8  2004/05/12 14:36:22  werner
00010 // Separation of chart definitions on a manifold and the tangential space.
00011 // Introduced convenient coordinate transformations.
00012 //
00013 // Revision 1.7  2004/05/11 18:05:10  werner
00014 //
00015 // Revision 1.6  2004/05/11 16:53:47  werner
00016 // Introduction of coordinate systems for improved type-safety.
00017 // Will support easy coordinate transformations soon.
00018 //
00019 // Revision 1.5  2004/05/06 22:42:16  werner
00020 // Towards a specification of a spacetime via the Acceleration structure.
00021 //
00022 // Revision 1.4  2004/05/05 15:56:52  werner
00023 // Separation of DOP core routines with dynamic size into the ODE library.
00024 //
00025 // Revision 1.3  2004/05/03 13:33:33  werner
00026 // integration improved
00027 //
00028 // Revision 1.2  2004/03/29 11:51:02  werner
00029 // Common interface among simple integrators, DiffMe and Vecal, and preliminiary work on integrating dop853.
00030 //
00031 // Revision 1.1  2004/03/22 11:55:02  werner
00032 // Schwarzschild geodesic integration.
00033 //
00034 // Revision 1.1  2004/02/13 16:36:21  werner
00035 // Initial preliminiary version of the Vector Algebra Library.
00036 //
00038 #ifndef __EulerGeodesic_HPP
00039 #define __EulerGeodesic_HPP "Created 27.02.2001 21:42:27 by werner"
00040 
00041 #include <vecal/Matrix.hpp>
00042 #include <ode/Integrator.hpp>
00043 
00044 namespace Traum
00045 {
00046 
00051 template <class Acceleration>
00052 struct  EulerGeodesic : public IntegratorBase
00053 {
00054         typedef typename Acceleration::Scalar_t      Scalar_t;
00055         typedef typename Acceleration::Point_t       Point_t;
00056         typedef typename Acceleration::Vector_t      Vector_t;
00057         typedef typename Acceleration::Christoffel_t Christoffel_t;
00058 
00059         typedef typename Point_t::Vector_t PointComponents_t;
00060         enum { Dims = PointComponents_t::SIZE };
00061 
00062         Point_t  x;
00063         Vector_t v;
00064 
00065         const Acceleration&Accel;
00066         Scalar_t ds;
00067 
00068         EulerGeodesic(const Acceleration&A)
00069         : Accel(A), ds(1)
00070         {}
00071 
00072         success_code advance(bool backward=false)
00073         {
00074                 if (backward)
00075                 {
00076                         x -= v * ds;
00077                         v += Accel(x, v) * ds;
00078                 }
00079                 else
00080                 {
00081                         x += v * ds;
00082                         v -= Accel(x, v) * ds;
00083                 }
00084                 return StepOk;
00085         }
00086 };
00087 
00088 
00089 } /* namespace VecAl */ 
00090 
00091 #endif /* __EulerGeodesic_HPP */