opensurgsim
OdeSolverEulerImplicit.h
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
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
size_t getNewtonRaphsonMaximumIteration() const
Definition: OdeSolverEulerImplicit.cpp:38
Ode equation of 2nd order of the form with for initial conditions and a set of boundary conditions...
Definition: OdeEquation.h:54
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:38
Vector m_previousSolution
Newton-Raphson previous solution (we solve a problem to find deltaV, the variation in velocity) ...
Definition: OdeSolverEulerImplicit.h:60
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
double getNewtonRaphsonEpsilonConvergence() const
Definition: OdeSolverEulerImplicit.cpp:50
double m_epsilonConvergence
Newton-Raphson convergence criteria (variation of the solution over time)
Definition: OdeSolverEulerImplicit.h:57
Base class for all solvers of ode equation of order 2 of the form .
Definition: OdeSolver.h:78
Euler implicit (a.k.a backward Euler) ode solver (see OdeSolverEulerImplicit.dox for more details)...
Definition: OdeSolverEulerImplicit.h:28
virtual void setNewtonRaphsonMaximumIteration(size_t maximumIteration)
Definition: OdeSolverEulerImplicit.cpp:31
OdeSolverEulerImplicit(OdeEquation *equation)
Constructor.
Definition: OdeSolverEulerImplicit.cpp:25
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
void solve(double dt, const OdeState &currentState, OdeState *newState, bool computeCompliance=true) override
Solves the equation.
Definition: OdeSolverEulerImplicit.cpp:55
size_t m_maximumIteration
Newton-Raphson maximum number of iteration (1 => linearization)
Definition: OdeSolverEulerImplicit.h:54
void setNewtonRaphsonEpsilonConvergence(double epsilonConvergence)
Definition: OdeSolverEulerImplicit.cpp:43