SOFA API  9fc4753c
Open source framework for multi-physics simuation
sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods > Class Template Reference

#include <RotationMethodsContainer.h>

A container for rotation computation methods in corotational formulations. More...

Inheritance diagram for sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >:

Detailed Description

template<class DataTypes, class ElementType, class... Methods>
class sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >

A container for rotation computation methods in corotational formulations.

This class provides a flexible mechanism to select and execute different rotation computation strategies for elements in corotational finite element simulations. The rotation methods calculate the element's rotation relative to its initial configuration, which is essential for corotational force fields.

Template Parameters
DataTypesThe data type used throughout the simulation (e.g., sofa::defaulttype::Vec3Types for 3D)
ElementTypeThe element type (e.g., sofa::geometry::Triangle, sofa::geometry::Tetrahedron)
Methods...A pack of rotation method classes implementing the computeRotation interface

Key Features:

  • Supports multiple rotation computation strategies via std::variant
  • Provides GUI-driven method selection through a Data-driven mechanism

Technical Details:

  • The active method is stored in m_rotationComputer (std::variant)
  • Method selection is driven by the d_rotationMethod data object (index-based)
  • The selectRotationMethod function updates the active method based on the selected index
  • The MAKE_SELECTABLE_ITEMS macro generates GUI items for method selection

Why Multiple Methods? Corotational formulations often require different rotation strategies depending on computational efficiency requirements.

This container enables seamless switching between methods without reconfiguring the entire simulation.

Classes

struct  RotationMethodsItems
 

Public Attributes

sofa::Data< RotationMethodsItemsd_rotationMethod
 

Static Public Attributes

static constexpr auto NumberOfMethods = std::variant_size_v<decltype(m_rotationComputer)>
 
static constexpr std::size_t NumberOfNodesInElement = ElementType::NumberOfNodes
 

Public Member Functions

 RotationMethodsContainer (sofa::core::objectmodel::BaseObject *parent)
 
void computeRotation (RotationMatrix &rotationMatrix, const RotationMatrix &initialRotationMatrix, const std::array< sofa::Coord_t< DataTypes >, NumberOfNodesInElement > &nodesPosition, const std::array< sofa::Coord_t< DataTypes >, NumberOfNodesInElement > &nodesRestPosition)
 
void selectRotationMethod ()
 

Attribute details

◆ d_rotationMethod

template<class DataTypes , class ElementType , class... Methods>
sofa::Data< RotationMethodsItems > sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::d_rotationMethod

◆ NumberOfMethods

template<class DataTypes , class ElementType , class... Methods>
constexpr auto sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::NumberOfMethods = std::variant_size_v<decltype(m_rotationComputer)>
staticconstexpr

◆ NumberOfNodesInElement

template<class DataTypes , class ElementType , class... Methods>
constexpr std::size_t sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::NumberOfNodesInElement = ElementType::NumberOfNodes
staticconstexpr

Constructor details

◆ RotationMethodsContainer()

template<class DataTypes , class ElementType , class... Methods>
sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::RotationMethodsContainer ( sofa::core::objectmodel::BaseObject parent)
inlineexplicit

Function details

◆ computeRotation()

template<class DataTypes , class ElementType , class... Methods>
void sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::computeRotation ( RotationMatrix rotationMatrix,
const RotationMatrix initialRotationMatrix,
const std::array< sofa::Coord_t< DataTypes >, NumberOfNodesInElement > &  nodesPosition,
const std::array< sofa::Coord_t< DataTypes >, NumberOfNodesInElement > &  nodesRestPosition 
)
inline

Computes the current rotation state relative to the initial configuration.

Parameters
rotationMatrixOutput: Current rotation matrix (relative to initial config)
initialRotationMatrixInitial rotation matrix (for reference)
nodesPositionCurrent positions of element nodes
nodesRestPositionRest positions of element nodes (initial configuration)

◆ selectRotationMethod()

template<class DataTypes , class ElementType , class... Methods>
void sofa::component::solidmechanics::fem::elastic::RotationMethodsContainer< DataTypes, ElementType, Methods >::selectRotationMethod ( )
inline

Selects the rotation method based on the current index

Note
This function is typically called by the GUI to update the active method.