OdeSolverEulerImplicit.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_ODESOLVEREULERIMPLICIT_H
17 #define SURGSIM_MATH_ODESOLVEREULERIMPLICIT_H
18 
19 #include "SurgSim/Math/OdeSolver.h"
20 
21 namespace SurgSim
22 {
23 
24 namespace Math
25 {
26 
29 {
30 public:
33  explicit OdeSolverEulerImplicit(OdeEquation* equation);
34 
36  virtual void setNewtonRaphsonMaximumIteration(size_t maximumIteration);
37 
39  size_t getNewtonRaphsonMaximumIteration() const;
40 
42  void setNewtonRaphsonEpsilonConvergence(double epsilonConvergence);
43 
46 
47  void solve(double dt, const OdeState& currentState, OdeState* newState, bool computeCompliance = true) override;
48 
49 protected:
50  void assembleLinearSystem(double dt, const OdeState& state, const OdeState& newState,
51  bool computeRHS = true) override;
52 
55 
58 
61 };
62 
63 }; // namespace Math
64 
65 }; // namespace SurgSim
66 
67 #endif // SURGSIM_MATH_ODESOLVEREULERIMPLICIT_H
SurgSim::Math::OdeSolverEulerImplicit::getNewtonRaphsonMaximumIteration
size_t getNewtonRaphsonMaximumIteration() const
Definition: OdeSolverEulerImplicit.cpp:38
SurgSim::Math::OdeState
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:39
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Math::OdeSolverEulerImplicit::m_previousSolution
Vector m_previousSolution
Newton-Raphson previous solution (we solve a problem to find deltaV, the variation in velocity)
Definition: OdeSolverEulerImplicit.h:60
SurgSim::Math::OdeSolverEulerImplicit::getNewtonRaphsonEpsilonConvergence
double getNewtonRaphsonEpsilonConvergence() const
Definition: OdeSolverEulerImplicit.cpp:50
SurgSim::Math::OdeSolverEulerImplicit::m_epsilonConvergence
double m_epsilonConvergence
Newton-Raphson convergence criteria (variation of the solution over time)
Definition: OdeSolverEulerImplicit.h:57
SurgSim::Math::OdeEquation
Ode equation of 2nd order of the form with for initial conditions and a set of boundary conditions.
Definition: OdeEquation.h:55
SurgSim::Math::OdeSolver
Base class for all solvers of ode equation of order 2 of the form .
Definition: OdeSolver.h:79
SurgSim::Math::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
SurgSim::Math::OdeSolverEulerImplicit::OdeSolverEulerImplicit
OdeSolverEulerImplicit(OdeEquation *equation)
Constructor.
Definition: OdeSolverEulerImplicit.cpp:25
SurgSim::Math::OdeSolverEulerImplicit::setNewtonRaphsonMaximumIteration
virtual void setNewtonRaphsonMaximumIteration(size_t maximumIteration)
Definition: OdeSolverEulerImplicit.cpp:31
SurgSim::Math::OdeSolverEulerImplicit::assembleLinearSystem
void assembleLinearSystem(double dt, const OdeState &state, const OdeState &newState, bool computeRHS=true) override
Assemble the linear system (A.x=b) to be solved for the state and new states (useful for certain ode ...
Definition: OdeSolverEulerImplicit.cpp:124
SurgSim::Math::OdeSolverEulerImplicit::solve
void solve(double dt, const OdeState &currentState, OdeState *newState, bool computeCompliance=true) override
Solves the equation.
Definition: OdeSolverEulerImplicit.cpp:55
SurgSim::Math::OdeSolverEulerImplicit
Euler implicit (a.k.a backward Euler) ode solver (see OdeSolverEulerImplicit.dox for more details).
Definition: OdeSolverEulerImplicit.h:29
SurgSim::Math::OdeSolverEulerImplicit::setNewtonRaphsonEpsilonConvergence
void setNewtonRaphsonEpsilonConvergence(double epsilonConvergence)
Definition: OdeSolverEulerImplicit.cpp:43
SurgSim::Math::OdeSolverEulerImplicit::m_maximumIteration
size_t m_maximumIteration
Newton-Raphson maximum number of iteration (1 => linearization)
Definition: OdeSolverEulerImplicit.h:54
OdeSolver.h