GteOdeSolver.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <Mathematics/GteGVector.h>
11 #include <functional>
12 
13 // The differential equation is dx/dt = F(t,x). The TVector template
14 // parameter allows you to create solvers with Vector<N,Real> when the
15 // dimension N is known at compile time or GVector<Real> when the dimension
16 // N is known at run time. Both classes have 'int GetSize() const' that
17 // allow OdeSolver-derived classes to query for the dimension.
18 
19 namespace gte
20 {
21 
22 template <typename Real, typename TVector>
23 class OdeSolver
24 {
25 public:
26  // Abstract base class.
27 public:
28  virtual ~OdeSolver();
29 protected:
30  OdeSolver(Real tDelta,
31  std::function<TVector(Real, TVector const&)> const& F);
32 
33 public:
34  // Member access.
35  inline void SetTDelta(Real tDelta);
36  inline Real GetTDelta() const;
37 
38  // Estimate x(t + tDelta) from x(t) using dx/dt = F(t,x). The
39  // derived classes implement this so that it is possible for xIn and
40  // xOut to be the same object.
41  virtual void Update(Real tIn, TVector const& xIn, Real& tOut,
42  TVector& xOut) = 0;
43 
44 protected:
45  Real mTDelta;
46  std::function<TVector(Real, TVector const&)> mFunction;
47 };
48 
49 
50 template <typename Real, typename TVector>
52 {
53 }
54 
55 template <typename Real, typename TVector>
57  std::function<TVector(Real, TVector const&)> const& F)
58  :
59  mTDelta(tDelta),
60  mFunction(F)
61 {
62 }
63 
64 template <typename Real, typename TVector> inline
66 {
67  mTDelta = tDelta;
68 }
69 
70 template <typename Real, typename TVector> inline
72 {
73  return mTDelta;
74 }
75 
76 
77 }
virtual ~OdeSolver()
Definition: GteOdeSolver.h:51
std::function< TVector(Real, TVector const &)> mFunction
Definition: GteOdeSolver.h:46
void SetTDelta(Real tDelta)
Definition: GteOdeSolver.h:65
OdeSolver(Real tDelta, std::function< TVector(Real, TVector const &)> const &F)
Definition: GteOdeSolver.h:56
Real GetTDelta() const
Definition: GteOdeSolver.h:71
virtual void Update(Real tIn, TVector const &xIn, Real &tOut, TVector &xOut)=0


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01