MechanicalGetMatrixDimensionVisitor
Compute the size of a mechanical matrix (mass or stiffness) of the whole scene */
The `MechanicalGetMatrixDimensionVisitor` computes the dimensions of mechanical matrices (mass or stiffness) for an entire simulation scene by traversing nodes to gather information about mechanical states and mappings.
- module
- Sofa.framework.Simulation.Core
- namespace
- sofa::simulation::mechanicalvisitor
- include
- sofa/simulation/mechanicalvisitor/MechanicalGetMatrixDimensionVisitor.h
- inherits
-
- BaseMechanicalVisitor
- description
The MechanicalGetMatrixDimensionVisitor is a SOFA component designed to compute the size (number of rows and columns) of mechanical matrices such as mass or stiffness for an entire simulation scene. This visitor class inherits from BaseMechanicalVisitor, which facilitates its traversal through nodes in the simulation graph to gather information about mechanical states and mappings.
Governing Equations / Operators
- Mass Matrix (oldsymbol{M}): Represents the distribution of mass throughout the deformable object, contributing to inertial effects. Its size is essential for solving dynamic equations.
- Stiffness Matrix (oldsymbol{K}): Encodes the elastic properties of materials and their response to deformation. The dimensions are critical for stiffness computations and linear solves in implicit integration schemes.
Constitutive or Kinematic Laws Involved
The component itself does not directly involve constitutive or kinematic laws. However, it is part of the broader framework where these laws contribute to constructing oldsymbol{M} and oldsymbol{K} matrices during assembly phases.
- Mass Matrix Construction: Involves integrating mass densities over elements to form the global matrix entries.
- Stiffness Matrix Construction: Requires computing stiffness contributions from each element based on material constitutive laws (e.g., linear elasticity, hyperelasticity).
Role in the Global FEM Pipeline
The MechanicalGetMatrixDimensionVisitor plays a crucial role during the assembly phase of the global FEM pipeline. Specifically:
- Assembly Phase: The component traverses through nodes to gather contributions from mechanical states and mappings. This information is used to determine the dimensions of oldsymbol{M} and oldsymbol{K}, essential for subsequent linear solve operations.
Numerical Methods or Discretization Choices
The visitor does not encode specific numerical methods but rather serves as a preparatory step in determining matrix sizes necessary for solving systems of equations. This includes:
- Matrix Size Determination: By traversing the simulation scene, it accumulates contributions to the size of oldsymbol{M} and oldsymbol{K}, ensuring these matrices are correctly sized before being populated with entries.
Fit into the Broader Variational / Lagrangian Mechanics Framework
In the broader context of variational mechanics and FEM:
- Variational Formulation: The visitor ensures that the global mass and stiffness matrices have correct dimensions, which is essential for solving weak formulations derived from variational principles (e.g., minimizing potential energy or action).
- Nonlinear Solve / Linear Solve: Properly sized oldsymbol{M} and oldsymbol{K} matrices are prerequisites for iterative solvers used in nonlinear solve steps of the simulation.
In summary, MechanicalGetMatrixDimensionVisitor is a key component in setting up mechanical systems within SOFA by accurately determining the dimensions of mass and stiffness matrices required for subsequent numerical solutions.
Methods
Result
fwdMechanicalState
(simulation::Node * , core::behavior::BaseMechanicalState * ms)
virtual
Result
fwdMechanicalMapping
(simulation::Node * , core::BaseMapping * mm)
virtual
Result
fwdMappedMechanicalState
(simulation::Node * , core::behavior::BaseMechanicalState * ms)
virtual
{
"name": "MechanicalGetMatrixDimensionVisitor",
"namespace": "sofa::simulation::mechanicalvisitor",
"module": "Sofa.framework.Simulation.Core",
"include": "sofa/simulation/mechanicalvisitor/MechanicalGetMatrixDimensionVisitor.h",
"doc": "Compute the size of a mechanical matrix (mass or stiffness) of the whole scene */",
"inherits": [
"BaseMechanicalVisitor"
],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "fwdMechanicalState",
"return_type": "Result",
"params": [
{
"name": "",
"type": "simulation::Node *"
},
{
"name": "ms",
"type": "core::behavior::BaseMechanicalState *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "fwdMechanicalMapping",
"return_type": "Result",
"params": [
{
"name": "",
"type": "simulation::Node *"
},
{
"name": "mm",
"type": "core::BaseMapping *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "fwdMappedMechanicalState",
"return_type": "Result",
"params": [
{
"name": "",
"type": "simulation::Node *"
},
{
"name": "ms",
"type": "core::behavior::BaseMechanicalState *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `MechanicalGetMatrixDimensionVisitor` is a SOFA component that computes the size (number of rows and columns) of a mechanical matrix (such as mass or stiffness) for an entire simulation scene. It inherits from `BaseMechanicalVisitor`, which indicates it traverses nodes in a simulation to gather information about mechanical states and mappings.\n\nThis visitor interacts with other SOFA components through methods like `fwdMechanicalState`, `fwdMechanicalMapping`, and `fwdMappedMechanicalState`. These methods are virtual, meaning they can be overridden by derived classes. In this component, these methods update the dimensions of the mechanical matrix based on the contributions from each visited node's mechanical state or mapping.\n\nPractical usage involves initializing an instance with pointers to store the row and column counts (`nbRow` and `nbCol`) and optionally a `MultiMatrixAccessor` object for more complex interactions. The component is typically used during setup phases when determining the required size of mechanical matrices for solving systems of equations in simulations.",
"maths": "The `MechanicalGetMatrixDimensionVisitor` is a SOFA component designed to compute the size (number of rows and columns) of mechanical matrices such as mass or stiffness for an entire simulation scene. This visitor class inherits from `BaseMechanicalVisitor`, which facilitates its traversal through nodes in the simulation graph to gather information about mechanical states and mappings.\n\n### Governing Equations / Operators\n- **Mass Matrix (\boldsymbol{M})**: Represents the distribution of mass throughout the deformable object, contributing to inertial effects. Its size is essential for solving dynamic equations.\n- **Stiffness Matrix (\boldsymbol{K})**: Encodes the elastic properties of materials and their response to deformation. The dimensions are critical for stiffness computations and linear solves in implicit integration schemes.\n\n### Constitutive or Kinematic Laws Involved\nThe component itself does not directly involve constitutive or kinematic laws. However, it is part of the broader framework where these laws contribute to constructing \boldsymbol{M} and \boldsymbol{K} matrices during assembly phases.\n- **Mass Matrix Construction**: Involves integrating mass densities over elements to form the global matrix entries.\n- **Stiffness Matrix Construction**: Requires computing stiffness contributions from each element based on material constitutive laws (e.g., linear elasticity, hyperelasticity).\n\n### Role in the Global FEM Pipeline\nThe `MechanicalGetMatrixDimensionVisitor` plays a crucial role during the assembly phase of the global FEM pipeline. Specifically:\n- **Assembly Phase**: The component traverses through nodes to gather contributions from mechanical states and mappings. This information is used to determine the dimensions of \boldsymbol{M} and \boldsymbol{K}, essential for subsequent linear solve operations.\n\n### Numerical Methods or Discretization Choices\nThe visitor does not encode specific numerical methods but rather serves as a preparatory step in determining matrix sizes necessary for solving systems of equations. This includes:\n- **Matrix Size Determination**: By traversing the simulation scene, it accumulates contributions to the size of \boldsymbol{M} and \boldsymbol{K}, ensuring these matrices are correctly sized before being populated with entries.\n\n### Fit into the Broader Variational / Lagrangian Mechanics Framework\nIn the broader context of variational mechanics and FEM:\n- **Variational Formulation**: The visitor ensures that the global mass and stiffness matrices have correct dimensions, which is essential for solving weak formulations derived from variational principles (e.g., minimizing potential energy or action).\n- **Nonlinear Solve / Linear Solve**: Properly sized \boldsymbol{M} and \boldsymbol{K} matrices are prerequisites for iterative solvers used in nonlinear solve steps of the simulation.\n\nIn summary, `MechanicalGetMatrixDimensionVisitor` is a key component in setting up mechanical systems within SOFA by accurately determining the dimensions of mass and stiffness matrices required for subsequent numerical solutions.",
"abstract": "The `MechanicalGetMatrixDimensionVisitor` computes the dimensions of mechanical matrices (mass or stiffness) for an entire simulation scene by traversing nodes to gather information about mechanical states and mappings.",
"sheet": "# MechanicalGetMatrixDimensionVisitor\n\n## Overview\nThe `MechanicalGetMatrixDimensionVisitor` is a visitor component that inherits from `BaseMechanicalVisitor`. It computes the dimensions of mechanical matrices (such as mass or stiffness) for an entire simulation scene by traversing nodes to gather information about mechanical states and mappings. This component plays a crucial role in setting up mechanical systems within SOFA, ensuring that the global mass and stiffness matrices have correct dimensions before being populated with entries.\n\n## Dependencies and Connections\nThe `MechanicalGetMatrixDimensionVisitor` interacts with other components through methods like `fwdMechanicalState`, `fwdMechanicalMapping`, and `fwdMappedMechanicalState`. These methods are virtual, meaning they can be overridden by derived classes. The component typically requires pointers to store the row and column counts (`nbRow` and `nbCol`) and optionally a `MultiMatrixAccessor` object for more complex interactions."
}