All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OdeEquation.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_MATH_ODEEQUATION_H
17 #define SURGSIM_MATH_ODEEQUATION_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Math/Matrix.h"
22 #include "SurgSim/Math/Vector.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Math
28 {
29 
30 class OdeState;
31 
41 {
42 public:
44  virtual ~OdeEquation(){}
45 
48  const std::shared_ptr<OdeState> getInitialState() const;
49 
54  virtual Vector& computeF(const OdeState& state) = 0;
55 
60  virtual const Matrix& computeM(const OdeState& state) = 0;
61 
66  virtual const Matrix& computeD(const OdeState& state) = 0;
67 
72  virtual const Matrix& computeK(const OdeState& state) = 0;
73 
83  virtual void computeFMDK(const OdeState& state, Vector** f, Matrix** M, Matrix** D, Matrix** K) = 0;
84 
85 protected:
88  std::shared_ptr<OdeState> m_initialState;
89 };
90 
91 }; // namespace Math
92 
93 }; // namespace SurgSim
94 
95 #endif // SURGSIM_MATH_ODEEQUATION_H
virtual ~OdeEquation()
Virtual destructor.
Definition: OdeEquation.h:44
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
virtual const Matrix & computeD(const OdeState &state)=0
Evaluation of D = -df/dv (x,v) for a given state.
Ode equation of 2nd order of the form M(x,v).a = F(x, v) with (x0, v0) for initial conditions and a s...
Definition: OdeEquation.h:40
OdeState defines the state y of an ode of 2nd order of the form M(x,v).a = F(x, v) with boundary cond...
Definition: OdeState.h:34
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:67
virtual void computeFMDK(const OdeState &state, Vector **f, Matrix **M, Matrix **D, Matrix **K)=0
Evaluation of f(x,v), M(x,v), D = -df/dv(x,v), K = -df/dx(x,v) When all the terms are needed...
virtual const Matrix & computeK(const OdeState &state)=0
Evaluation of K = -df/dx (x,v) for a given state.
virtual const Matrix & computeM(const OdeState &state)=0
Evaluation of the LHS matrix M(x,v) for a given state.
virtual Vector & computeF(const OdeState &state)=0
Evaluation of the RHS function f(x,v) for a given state.
Definitions of small fixed-size square matrix types.
Definitions of small fixed-size vector types.
const std::shared_ptr< OdeState > getInitialState() const
Retrieves the ode initial conditions (x0, v0) (i.e.
Definition: OdeEquation.cpp:25
std::shared_ptr< OdeState > m_initialState
The initial state (which defines the ODE initial conditions (x0, v0))
Definition: OdeEquation.h:88