![]() |
Base class for all Fem Element (1D, 2D, 3D) It handles the node ids to which it is connected and requires all derived classes to compute the element mass matrix and the force vector along with the derivatives (the stiffness and damping matrices). More...
#include <SurgSim/Physics/FemElement.h>
Public Member Functions | |
FemElement () | |
Constructor. More... | |
virtual | ~FemElement () |
Virtual destructor. More... | |
virtual void | initialize (const SurgSim::Math::OdeState &state) |
Initialize the FemElement once everything has been set. More... | |
size_t | getNumDofPerNode () const |
Gets the number of degree of freedom per node. More... | |
size_t | getNumNodes () const |
Gets the number of nodes connected by this element. More... | |
size_t | getNodeId (size_t elementNodeId) const |
Gets the elementNodeId-th node id. More... | |
const std::vector< size_t > & | getNodeIds () const |
Gets the node ids for this element. More... | |
void | setYoungModulus (double E) |
Sets the Young modulus (in N.m-2) More... | |
double | getYoungModulus () const |
Gets the Young modulus (in N.m-2) More... | |
void | setPoissonRatio (double nu) |
Sets the Poisson ratio (unitless) More... | |
double | getPoissonRatio () const |
Gets the Poisson ratio (unitless) More... | |
void | setMassDensity (double rho) |
Sets the mass density (in Kg.m-3) More... | |
double | getMassDensity () const |
Gets the mass density (in Kg.m-3) More... | |
double | getMass (const SurgSim::Math::OdeState &state) const |
Gets the element mass based on the input state (in Kg) More... | |
virtual double | getVolume (const SurgSim::Math::OdeState &state) const =0 |
Gets the element volume based on the input state (in m-3) More... | |
virtual void | addForce (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, double scale=1.0)=0 |
Adds the element force (computed for a given state) to a complete system force vector F (assembly) More... | |
virtual void | addMass (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *M, double scale=1.0)=0 |
Adds the element mass matrix M (computed for a given state) to a complete system mass matrix M (assembly) More... | |
virtual void | addDamping (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *D, double scale=1.0)=0 |
Adds the element damping matrix D (= -df/dv) (comuted for a given state) to a complete system damping matrix D (assembly) More... | |
virtual void | addStiffness (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *K, double scale=1.0)=0 |
Adds the element stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly) More... | |
virtual void | addFMDK (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, SurgSim::Math::Matrix *M, SurgSim::Math::Matrix *D, SurgSim::Math::Matrix *K)=0 |
Adds the element force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, M, D, K (assembly) More... | |
virtual void | addMatVec (const SurgSim::Math::OdeState &state, double alphaM, double alphaD, double alphaK, const SurgSim::Math::Vector &x, SurgSim::Math::Vector *F)=0 |
Adds the element matrix-vector contribution F += (alphaM.M + alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly) More... | |
virtual bool | update (const SurgSim::Math::OdeState &state) |
Update the element based on a given state. More... | |
bool | isValidCoordinate (const SurgSim::Math::Vector &naturalCoordinate) const |
Determines whether a given natural coordinate is valid. More... | |
virtual SurgSim::Math::Vector | computeCartesianCoordinate (const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &naturalCoordinate) const =0 |
Computes a given natural coordinate in cartesian coordinates. More... | |
virtual SurgSim::Math::Vector | computeNaturalCoordinate (const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &cartesianCoordinate) const =0 |
Computes a natural coordinate given a global coordinate. More... | |
Protected Member Functions | |
void | setNumDofPerNode (size_t numDofPerNode) |
Sets the number of degrees of freedom per node. More... | |
Protected Attributes | |
size_t | m_numDofPerNode |
Number of degree of freedom per node for this element. More... | |
std::vector< size_t > | m_nodeIds |
Node ids connected by this element. More... | |
double | m_rho |
Mass density (in Kg.m-3) More... | |
double | m_E |
Young modulus (in N.m-2) More... | |
double | m_nu |
Poisson ratio (unitless) More... | |
Base class for all Fem Element (1D, 2D, 3D) It handles the node ids to which it is connected and requires all derived classes to compute the element mass matrix and the force vector along with the derivatives (the stiffness and damping matrices).
A extra method also exist to compute all of them at once for performance purposes. It holds on to the actual computed values (m_f, m_M, m_D, m_K) as its size is not predefined from outside and would requires intensive (de)allocation or a temporary variable anyway. It contains the linear elasticity parameter (Young modulus and Poisson ratio) as well as mass density
SurgSim::Physics::FemElement::FemElement | ( | ) |
Constructor.
|
virtual |
Virtual destructor.
|
pure virtual |
Adds the element damping matrix D (= -df/dv) (comuted for a given state) to a complete system damping matrix D (assembly)
state | The state to compute the damping matrix with | |
[in,out] | D | The complete system damping matrix to add the element damping matrix into |
scale | A factor to scale the added damping matrix with |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementCube, and SurgSim::Physics::Fem3DElementTetrahedron.
|
pure virtual |
Adds the element force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, M, D, K (assembly)
state | The state to compute everything with | |
[in,out] | F | The complete system force vector to add the element force into |
[in,out] | M | The complete system mass matrix to add the element mass matrix into |
[in,out] | D | The complete system damping matrix to add the element damping matrix into |
[in,out] | K | The complete system stiffness matrix to add the element stiffness matrix into |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementCube, and SurgSim::Physics::Fem3DElementTetrahedron.
|
pure virtual |
Adds the element force (computed for a given state) to a complete system force vector F (assembly)
state | The state to compute the force with | |
[in,out] | F | The complete system force vector to add the element force into |
scale | A factor to scale the added force with |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem3DElementTetrahedron, and SurgSim::Physics::Fem3DElementCorotationalTetrahedron.
|
pure virtual |
Adds the element mass matrix M (computed for a given state) to a complete system mass matrix M (assembly)
state | The state to compute the mass matrix with | |
[in,out] | M | The complete system mass matrix to add the element mass-matrix into |
scale | A factor to scale the added mass matrix with |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementCube, and SurgSim::Physics::Fem3DElementTetrahedron.
|
pure virtual |
Adds the element matrix-vector contribution F += (alphaM.M + alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly)
state | The state to compute everything with | |
alphaM | The scaling factor for the mass contribution | |
alphaD | The scaling factor for the damping contribution | |
alphaK | The scaling factor for the stiffness contribution | |
x | A complete system vector to be used as the vector in the matrix-vector multiplication | |
[in,out] | F | The complete system force vector to add the element matrix-vector contribution into |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementTetrahedron, and SurgSim::Physics::Fem3DElementCorotationalTetrahedron.
|
pure virtual |
Adds the element stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly)
state | The state to compute the stiffness matrix with | |
[in,out] | K | The complete system stiffness matrix to add the element stiffness matrix into |
scale | A factor to scale the added stiffness matrix with |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem1DElementBeam, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem3DElementTetrahedron, and SurgSim::Physics::Fem3DElementCorotationalTetrahedron.
|
pure virtual |
Computes a given natural coordinate in cartesian coordinates.
state | The state at which to transform coordinates |
naturalCoordinate | The coordinates to transform |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem1DElementBeam, and SurgSim::Physics::Fem3DElementTetrahedron.
|
pure virtual |
Computes a natural coordinate given a global coordinate.
state | The state at which to transform coordinates |
cartesianCoordinate | The coordinates to transform |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem1DElementBeam, and SurgSim::Physics::Fem3DElementTetrahedron.
double SurgSim::Physics::FemElement::getMass | ( | const SurgSim::Math::OdeState & | state | ) | const |
Gets the element mass based on the input state (in Kg)
state | The state to compute the mass with |
double SurgSim::Physics::FemElement::getMassDensity | ( | ) | const |
Gets the mass density (in Kg.m-3)
size_t SurgSim::Physics::FemElement::getNodeId | ( | size_t | elementNodeId | ) | const |
Gets the elementNodeId-th node id.
const std::vector< size_t > & SurgSim::Physics::FemElement::getNodeIds | ( | ) | const |
Gets the node ids for this element.
size_t SurgSim::Physics::FemElement::getNumDofPerNode | ( | ) | const |
Gets the number of degree of freedom per node.
size_t SurgSim::Physics::FemElement::getNumNodes | ( | ) | const |
Gets the number of nodes connected by this element.
double SurgSim::Physics::FemElement::getPoissonRatio | ( | ) | const |
Gets the Poisson ratio (unitless)
|
pure virtual |
Gets the element volume based on the input state (in m-3)
state | The state to compute the volume with |
Implemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem3DElementTetrahedron, and SurgSim::Physics::Fem1DElementBeam.
double SurgSim::Physics::FemElement::getYoungModulus | ( | ) | const |
Gets the Young modulus (in N.m-2)
|
virtual |
Initialize the FemElement once everything has been set.
state | The state to initialize the FemElement with |
Reimplemented in SurgSim::Physics::Fem2DElementTriangle, SurgSim::Physics::Fem3DElementCube, SurgSim::Physics::Fem3DElementTetrahedron, SurgSim::Physics::Fem1DElementBeam, and SurgSim::Physics::Fem3DElementCorotationalTetrahedron.
bool SurgSim::Physics::FemElement::isValidCoordinate | ( | const SurgSim::Math::Vector & | naturalCoordinate | ) | const |
Determines whether a given natural coordinate is valid.
naturalCoordinate | Coordinate to check |
void SurgSim::Physics::FemElement::setMassDensity | ( | double | rho | ) |
Sets the mass density (in Kg.m-3)
rho | The mass density |
|
protected |
Sets the number of degrees of freedom per node.
numDofPerNode | The number of dof per node |
void SurgSim::Physics::FemElement::setPoissonRatio | ( | double | nu | ) |
Sets the Poisson ratio (unitless)
nu | The Poisson ratio |
void SurgSim::Physics::FemElement::setYoungModulus | ( | double | E | ) |
Sets the Young modulus (in N.m-2)
E | The Young modulus |
|
virtual |
Update the element based on a given state.
state | The state to compute the update from |
Reimplemented in SurgSim::Physics::Fem3DElementCorotationalTetrahedron.
|
protected |
Young modulus (in N.m-2)
|
protected |
Node ids connected by this element.
|
protected |
Poisson ratio (unitless)
|
protected |
Number of degree of freedom per node for this element.
|
protected |
Mass density (in Kg.m-3)