OdeState defines the state y of an ode of 2nd order of the form M(x,v).a = F(x, v) with boundary conditions.
More...
#include <SurgSim/Math/OdeState.h>
OdeState defines the state y of an ode of 2nd order of the form M(x,v).a = F(x, v) with boundary conditions.
- Note
- This ode equation is solved as an ode of order 1 by defining the state vector y = (x v)^t:
-
y' = ( x' ) = ( dx/dt ) = ( v )
-
( v' ) = ( dv/dt ) = ( M(x, v)^{-1}.F(x, v) )
SurgSim::Math::OdeState::OdeState |
( |
| ) |
|
SurgSim::Math::OdeState::~OdeState |
( |
| ) |
|
void SurgSim::Math::OdeState::addBoundaryCondition |
( |
size_t |
nodeId | ) |
|
Adds boundary conditions for a given node (fixes all the dof for this node)
- Parameters
-
nodeId | The node to set the boundary conditions on |
void SurgSim::Math::OdeState::addBoundaryCondition |
( |
size_t |
nodeId, |
|
|
size_t |
nodeDofId |
|
) |
| |
Adds a boundary condition on a given dof of a given node (only 1 dof is fixed)
- Parameters
-
nodeId | The node on which the boundary condition needs to be set |
nodeDofId | The dof of the node to set as boundary condition |
void SurgSim::Math::OdeState::applyBoundaryConditionsToMatrix |
( |
Matrix * |
matrix, |
|
|
bool |
hasCompliance = true |
|
) |
| const |
Apply boundary conditions to a given matrix.
- Parameters
-
matrix | The matrix to apply the boundary conditions on |
hasCompliance | True if the fixed dofs should have a compliance of 1 with themselves in the matrix or not. |
- Note
- hasCompliance is practical to remove all compliance, which is helpful when the compliance matrix is used
-
in an architecture of type LCP. It ensures that a separate constraint resolution will never violates the
-
boundary conditions.
Vector * SurgSim::Math::OdeState::applyBoundaryConditionsToVector |
( |
Vector * |
vector | ) |
const |
Apply boundary conditions to a given vector.
- Parameters
-
vector | The vector to apply the boundary conditions on |
- Returns
- vector. This enables chained use like the pseudo-code U = K^1 * applyBoundaryConditionsToVector(x)
const std::vector< size_t > & SurgSim::Math::OdeState::getBoundaryConditions |
( |
| ) |
const |
Retrieves all boundary conditions.
- Returns
- All boundary conditions as a vector of dof ids
size_t SurgSim::Math::OdeState::getNumBoundaryConditions |
( |
| ) |
const |
Retrieves the number of boundary conditions.
- Returns
- The number of boundary conditions
size_t SurgSim::Math::OdeState::getNumDof |
( |
| ) |
const |
Retrieves the number of degrees of freedom.
- Returns
- The number of DOF for this representation
size_t SurgSim::Math::OdeState::getNumNodes |
( |
| ) |
const |
Retrieves the number of nodes.
- Returns
- The number of nodes for this representation
Retrieves the position of a given node (const version)
- Parameters
-
nodeId | The desired node id for which the position is requested (must be a valid id) |
- Returns
- The position of the node nodeId
- Note
- Behavior undefined if the nodeId is not in the correct range [0 getNumNodes()-1]
Retrieves all degrees of freedom's position (non-const version)
- Returns
- Vector of collected DOF's position
Retrieves all degrees of freedom's position (const version)
- Returns
- Vector of collected DOF's position
Retrieves all degrees of freedom's velocity (non-const version)
- Returns
- Vector of collected DOF's velocity
Retrieves all degrees of freedom's velocity (const version)
- Returns
- Vector of collected DOF's velocity
Retrieves the velocity of a given node (const version)
- Parameters
-
nodeId | The desired node id for which the velocity is requested (must be a valid id) |
- Returns
- The velocity of the node nodeId
- Note
- Behavior undefined if the nodeId is not in the correct range [0 getNumNodes()-1]
bool SurgSim::Math::OdeState::isBoundaryCondition |
( |
size_t |
dof | ) |
const |
Queries if a specific dof is a boundary condition or not.
- Parameters
-
- Returns
- True if dof is a boundary condition, False otherwise
- Note
- The behavior is undefined when dof is out of range [0 getNumBoundaryConditions()-1]
bool SurgSim::Math::OdeState::isValid |
( |
| ) |
const |
Check if this state is numerically valid.
- Returns
- True if all positions and velocities are valid numerical values, False otherwise
bool SurgSim::Math::OdeState::operator!= |
( |
const OdeState & |
state | ) |
const |
Comparison operator (difference test)
- Parameters
-
state | The state to compare it to |
- Returns
- False if the 2 states are equal, True otherwise
bool SurgSim::Math::OdeState::operator== |
( |
const OdeState & |
state | ) |
const |
Comparison operator (equality test)
- Parameters
-
state | The state to compare it to |
- Returns
- True if the 2 states are equal, False otherwise
void SurgSim::Math::OdeState::reset |
( |
| ) |
|
Resets the state.
- Note
- Simply set all positions/velocities to 0 and remove all boundary conditions
void SurgSim::Math::OdeState::setNumDof |
( |
size_t |
numDofPerNode, |
|
|
size_t |
numNodes |
|
) |
| |
Allocates the state for a given number of degrees of freedom.
- Parameters
-
numDofPerNode | The number of degrees of freedom per node to account for |
numNodes | The number of nodes to account for |
- Note
- This method clears all the data structures and remove all existing boundary conditions
std::vector<size_t> SurgSim::Math::OdeState::m_boundaryConditionsAsDofIds |
|
private |
Boundary conditions stored as a list of dof ids.
Eigen::Matrix<bool, Eigen::Dynamic, 1> SurgSim::Math::OdeState::m_boundaryConditionsPerDof |
|
private |
Boundary conditions stored per dof (True indicates a boundary condition, False does not)
size_t SurgSim::Math::OdeState::m_numDofPerNode |
|
private |
Default public copy constructor and assignment operator are being used on purpose.
Keep track of the number of degrees of freedom per node and the number of nodes
size_t SurgSim::Math::OdeState::m_numNodes |
|
private |
Degrees of freedom velocity (m_x 1st derivative w.r.t. time)
Degrees of freedom position.
The documentation for this class was generated from the following files: