opensurgsim
Public Member Functions | Protected Member Functions | List of all members
SurgSim::Math::OdeSolverStatic Class Reference

Static ode solver solves the following \(2^{nd}\) order ode \(M(x(t), v(t)).a(t) = f(t, x(t), v(t))\). More...

#include <OdeSolverStatic.h>

Inheritance diagram for SurgSim::Math::OdeSolverStatic:
SurgSim::Math::OdeSolver SurgSim::Math::OdeSolverLinearStatic

Public Member Functions

 OdeSolverStatic (OdeEquation *equation)
 Constructor. More...
 
void solve (double dt, const OdeState &currentState, OdeState *newState, bool computeCompliance=true) override
 Solves the equation. More...
 
- Public Member Functions inherited from SurgSim::Math::OdeSolver
 OdeSolver (OdeEquation *equation)
 Constructor. More...
 
virtual ~OdeSolver ()
 Virtual destructor.
 
const std::string getName () const
 Gets the solver's name. More...
 
void setLinearSolver (std::shared_ptr< LinearSparseSolveAndInverse > linearSolver)
 Sets the specialized linear solver to use with this Ode solver. More...
 
std::shared_ptr< LinearSparseSolveAndInversegetLinearSolver () const
 Gets the specialized linear solver used with this Ode solver. More...
 
void computeMatrices (double dt, const OdeState &state, bool computeCompliance=true)
 Computes the system and compliance matrices for a given state. More...
 
const SparseMatrixgetSystemMatrix () const
 Queries the current system matrix. More...
 
const MatrixgetComplianceMatrix () const
 

Protected Member Functions

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 solver). More...
 
- Protected Member Functions inherited from SurgSim::Math::OdeSolver
void computeComplianceMatrixFromSystemMatrix (const OdeState &state)
 Helper method computing the compliance matrix from the system matrix and setting the boundary conditions. More...
 

Additional Inherited Members

- Protected Attributes inherited from SurgSim::Math::OdeSolver
std::string m_name
 Name for this solver. More...
 
OdeEquationm_equation
 The ode equation (API providing the necessary evaluation methods and the initial state)
 
std::shared_ptr< LinearSparseSolveAndInversem_linearSolver
 The specialized linear solver to use when solving the ode equation.
 
SparseMatrix m_systemMatrix
 Linear system matrix (can be M, K, combination of MDK depending on the solver), including boundary conditions. More...
 
Vector m_solution
 Linear system solution and rhs vectors (including boundary conditions)
 
Vector m_rhs
 
Matrix m_complianceMatrix
 Compliance matrix which is the inverse of the system matrix, including boundary conditions.
 

Detailed Description

Static ode solver solves the following \(2^{nd}\) order ode \(M(x(t), v(t)).a(t) = f(t, x(t), v(t))\).


This ode equation is solved w.r.t. \(x\), by discarding all time derived variables (i.e. \(v\), \(a\)) reducing the equation to solve to:

\[ 0 = f(t, x(t)) = f_{ext} + f_{int}(t, x(t)) = f_{ext} - K(x).(x - x0) \]

Note
This solver does not solve the resulting non-linear equations, but their linearization: \(f_{ext} - K.(x - x0)=0\)

Constructor & Destructor Documentation

§ OdeSolverStatic()

SurgSim::Math::OdeSolverStatic::OdeSolverStatic ( OdeEquation equation)
explicit

Constructor.

Parameters
equationThe ode equation to be solved

Member Function Documentation

§ assembleLinearSystem()

void SurgSim::Math::OdeSolverStatic::assembleLinearSystem ( double  dt,
const OdeState state,
const OdeState newState,
bool  computeRHS = true 
)
overrideprotectedvirtual

Assemble the linear system (A.x=b) to be solved for the state and new states (useful for certain ode solver).

Parameters
dtThe time step used in the system
state,newStateThe state and newState to be used to evaluate the system
computeRHSTrue to compute the RHS vector, False otherwise
Note
The method should fill up the LHS matrix in m_systemMatrix and the RHS vector in m_b (if requested)
The method should take care of the boundary conditions properly on both the matrix and the vector.
The method should prepare the linear solver m_linearSolver to be used with the m_systemMatrix

Implements SurgSim::Math::OdeSolver.

§ solve()

void SurgSim::Math::OdeSolverStatic::solve ( double  dt,
const OdeState currentState,
OdeState newState,
bool  computeCompliance = true 
)
overridevirtual

Solves the equation.

Parameters
dtThe time step
currentStateState at time t
[out]newStateState at time t+dt
computeComplianceTrue to explicitly compute the compliance matrix, False otherwise

Implements SurgSim::Math::OdeSolver.


The documentation for this class was generated from the following files: