Skip to content

raisim::fem::LinearElasticity ​

class · #include <raisim/fem/LinearElasticity.hpp>

Small-displacement, small-strain, isotropic, linear static elasticity with four-node tetrahedra. SI units: metres, newtons, pascals, kg/m^3. Instances are single-threaded. Changing loads or prescribed values reuses the factorization; changing the support mask rebuilds it.

Nested classes ​

Public types ​

SolverBackend ​

cpp
enum class SolverBackend
Enumerator
Automatic
SparseLDLT
IncompleteCholeskyCG
AlgebraicMultigridCG

SolveStage ​

cpp
enum class SolveStage

Stage reported to the solve() progress callback.

Enumerator
Assembly
Factorization
Iteration
Results

Constructors & destructor ​

LinearElasticity ​

cpp
explicit LinearElasticity(TetMesh mesh)
cpp
LinearElasticity(LinearElasticity &&) noexcept
cpp
LinearElasticity(const LinearElasticity &) = delete

~LinearElasticity ​

cpp
~LinearElasticity()

Public member functions ​

operator= ​

cpp
LinearElasticity &operator=(LinearElasticity &&) noexcept
cpp
LinearElasticity &operator=(const LinearElasticity &) = delete

mesh ​

cpp
const TetMesh &mesh() const

boundaryFaces ​

cpp
const std::vector<BoundaryFace> &boundaryFaces() const

setMaterial ​

cpp
void setMaterial(const Material &material)

Restores one uniform material, replacing any per-element materials.

setElementMaterials ​

cpp
void setElementMaterials(const std::vector<Material> &materials)

Empty resets to the uniform material. Otherwise one material per tetrahedron.

setSolverBackend ​

cpp
void setSolverBackend(SolverBackend backend)

Automatic uses CG preconditioned by cached smoothed-aggregation algebraic multigrid for >=5000 free DOFs, sparse LDLT otherwise. Both iterative backends solve to the same relative tolerance. Bolt connectors currently use LDLT.

setProgressCallback ​

cpp
void setProgressCallback(std::function<void(SolveStage stage, double fraction)> callback)

solve() calls this on its own thread with the current stage and the completed fraction of that stage in [0, 1]. Iteration fractions follow the logarithmic residual reduction of the iterative solver. An exception thrown by the callback stops solve() and propagates; the next solve() repeats the interrupted work. Empty disables reporting.

clearConstraints ​

cpp
void clearConstraints()

fix ​

cpp
void fix(unsigned int node)

prescribe ​

cpp
void prescribe(
    unsigned int node,
    unsigned int axis,
    double displacement=0.0)

release ​

cpp
void release(unsigned int node, unsigned int axis)

addLinearConstraint ​

cpp
size_t addLinearConstraint(
    const std::vector<ConstraintTerm> &terms,
    double value=0.0)

Exact linear multi-point constraint: sum(weight * displacement[node][axis]) = value. Redundant, consistent equations are accepted; conflicting equations are rejected by solve().

addDirectionalConstraint ​

cpp
size_t addDirectionalConstraint(
    unsigned int node,
    const Vec<3> &direction,
    double displacement=0.0)

setLinearConstraintValue ​

cpp
void setLinearConstraintValue(size_t constraint, double value)

clearLinearConstraints ​

cpp
void clearLinearConstraints()

addBolt ​

cpp
size_t addBolt(
    const CouplingPatch &head,
    const CouplingPatch &nut,
    const BoltProperties &properties)

Distributed, energy-consistent circular Timoshenko beam connector. Patches must have non-collinear nodes. The coupling transfers forces and moments without rigidifying either patch.

setBoltProperties ​

cpp
void setBoltProperties(size_t bolt, const BoltProperties &properties)

clearBolts ​

cpp
void clearBolts()

addElasticSupport ​

cpp
size_t addElasticSupport(
    unsigned int node,
    const Vec<3> &direction,
    double stiffness,
    double restDisplacement=0.0)

Physical elastic support along a unit direction; stiffness is N/m and rest displacement is m.

setElasticSupportRestDisplacement ​

cpp
void setElasticSupportRestDisplacement(
    size_t support,
    double restDisplacement)

Changing the rest displacement reuses the factorization.

clearElasticSupports ​

cpp
void clearElasticSupports()

clearLoads ​

cpp
void clearLoads()

Clear all applied forces, surface loads, and gravity.

addNodalForce ​

cpp
void addNodalForce(unsigned int node, const Vec<3> &force)

setGravity ​

cpp
void setGravity(const Vec<3> &acceleration)

addSurfaceTraction ​

cpp
void addSurfaceTraction(size_t boundaryFace, const Vec<3> &traction)

Integrated exactly over a linear boundary triangle; traction is N/m^2.

addSurfacePressure ​

cpp
void addSurfacePressure(size_t boundaryFace, double pressure)

Positive pressure acts inward, irrespective of the imported tetrahedron orientation.

solve ​

cpp
const Statistics &solve()

Throws for unsupported rigid modes, singular/ill-conditioned meshes, or an inaccurate solve. The cached result is invalidated by setters; query it after a successful solve.

displacements ​

cpp
const std::vector<Vec<3>> &displacements() const

reactions ​

cpp
const std::vector<Vec<3>> &reactions() const

elementResults ​

cpp
const std::vector<ElementResult> &elementResults() const

boltResults ​

cpp
const std::vector<BoltResult> &boltResults() const

statistics ​

cpp
const Statistics &statistics() const

writeVtk ​

cpp
void writeVtk(const std::string &path) const

Original mesh with displacement/reaction point fields and stress/strain cell fields.

RaiSim — physics for robotics and AI.