Back

SingleMatrixAccessor

sofa::core::behavior::SingleMatrixAccessor
MultiMatrixAccessor
Doc (from source)

Special case to access a single square matrix.

Abstract (AI generated)

The `SingleMatrixAccessor` manages a single square matrix in SOFA simulations by providing methods to set, retrieve, and access its properties.

Metadata
module
Sofa.framework.Core
namespace
sofa::core::behavior
include
sofa/core/behavior/SingleMatrixAccessor.h
inherits
  • MultiMatrixAccessor
description

The SingleMatrixAccessor is a specialized component in the SOFA framework designed to manage a single square matrix within the simulation context. It inherits from MultiMatrixAccessor, which provides mechanisms for accessing multiple matrices, but simplifies its functionality by focusing on a single matrix. This component serves as an intermediary between other mechanical states or solvers and a specific matrix that may represent various physical quantities (e.g., mass matrix $M$, stiffness matrix $K$) used in the FEM simulation pipeline.

Governing Equations or Operators:

  • Mass Matrix ($M$): Represents the inertia of the system. Each entry $M_{ij}$ relates to the nodal masses and their interconnection through shape functions.
  • Stiffness Matrix ($K$): Encodes the elastic behavior of the material. Entries $K_{ij}$ are derived from constitutive laws (e.g., linear elasticity, hyperelasticity) and strain measures.
  • Internal Force ($f_{int}$): Represents the internal forces due to deformation. This can be computed through element-wise integration of stresses and strains using the weak form of the governing equations.

Constitutive or Kinematic Laws Involved:

  • Strain Measures: The component may be used to store strain measures such as Green-Lagrange strain tensor $E$ or Almansi strain tensor.
  • Stress Tensors: Stress tensors like Cauchy stress $oldsymbol{ au}$, first Piola-Kirchhoff stress $oldsymbol{P}$, and second Piola-Kirchhoff stress $oldsymbol{S}$ may be represented within the matrix managed by this component.

Role in the Global FEM Pipeline:

  • Matrix Assembly: The SingleMatrixAccessor can store a pre-assembled mass or stiffness matrix resulting from spatial discretization via shape functions and element-wise integrations.
  • Time Integration: In implicit time integration schemes, such as backward Euler, the matrix may be used to solve for nodal displacements by inverting or solving linear systems involving $M$ and $K$.
  • Nonlinear Resolution: During Newton-Raphson iterations, the Jacobian (tangent stiffness) can be stored and accessed via this component.

Numerical Methods or Discretization Choices:

  • The SingleMatrixAccessor does not encode any specific numerical methods but rather provides a mechanism for accessing and managing matrices that are results of various discretizations and formulations within FEM.

Fit into the Broader Variational / Lagrangian Mechanics Framework:

  • This component fits into the broader framework by providing efficient access to matrices that represent physical quantities derived from variational principles and constitutive laws. These matrices are critical for solving nonlinear dynamical systems governed by Lagrangian mechanics, where the weak form of governing equations is solved using FEM.
Methods
void setMatrix (BaseMatrix * m)
BaseMatrix * getMatrix ()
int getGlobalDimension ()
int getGlobalOffset (const core::behavior::BaseMechanicalState * ) virtual
MatrixRef getMatrix (const core::behavior::BaseMechanicalState * ) virtual
InteractionMatrixRef getMatrix (const core::behavior::BaseMechanicalState * mstate1, const core::behavior::BaseMechanicalState * mstate2) virtual
{
  "name": "SingleMatrixAccessor",
  "namespace": "sofa::core::behavior",
  "module": "Sofa.framework.Core",
  "include": "sofa/core/behavior/SingleMatrixAccessor.h",
  "doc": "Special case to access a single square matrix.",
  "inherits": [
    "MultiMatrixAccessor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "setMatrix",
      "return_type": "void",
      "params": [
        {
          "name": "m",
          "type": "BaseMatrix *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMatrix",
      "return_type": "BaseMatrix *",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getGlobalDimension",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getGlobalOffset",
      "return_type": "int",
      "params": [
        {
          "name": "",
          "type": "const core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMatrix",
      "return_type": "MatrixRef",
      "params": [
        {
          "name": "",
          "type": "const core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMatrix",
      "return_type": "InteractionMatrixRef",
      "params": [
        {
          "name": "mstate1",
          "type": "const core::behavior::BaseMechanicalState *"
        },
        {
          "name": "mstate2",
          "type": "const core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `SingleMatrixAccessor` is a specialized component in the SOFA framework designed to access and manage a single square matrix within the simulation context. It inherits from `MultiMatrixAccessor`, which provides mechanisms for accessing multiple matrices, but simplifies its functionality by focusing on a single matrix. This component can be used to set and retrieve a specific matrix through methods like `setMatrix` and `getMatrix`. Additionally, it provides access to the global dimension of this matrix via `getGlobalDimension`. The method `getGlobalOffset` is overridden and returns 0 in all cases.\n\nIn terms of interactions with other SOFA components, `SingleMatrixAccessor` is primarily involved with managing matrix data that may be used by various mechanical states or solvers within the simulation. It does not have explicit links to specific data fields but relies on its methods for interaction with other parts of the scene-graph architecture.\n\nPractically, this component can be utilized in scenarios where a single matrix needs to be accessed and manipulated without the complexity of handling multiple matrices simultaneously. Its usage involves setting the matrix via `setMatrix` and retrieving it as needed through various overloads of the `getMatrix` method.",
  "maths": "The `SingleMatrixAccessor` is a specialized component in the SOFA framework designed to manage a single square matrix within the simulation context. It inherits from `MultiMatrixAccessor`, which provides mechanisms for accessing multiple matrices, but simplifies its functionality by focusing on a single matrix. This component serves as an intermediary between other mechanical states or solvers and a specific matrix that may represent various physical quantities (e.g., mass matrix $M$, stiffness matrix $K$) used in the FEM simulation pipeline.\n\n### Governing Equations or Operators:\n- **Mass Matrix ($M$):** Represents the inertia of the system. Each entry $M_{ij}$ relates to the nodal masses and their interconnection through shape functions.\n- **Stiffness Matrix ($K$):** Encodes the elastic behavior of the material. Entries $K_{ij}$ are derived from constitutive laws (e.g., linear elasticity, hyperelasticity) and strain measures.\n- **Internal Force ($f_{int}$):** Represents the internal forces due to deformation. This can be computed through element-wise integration of stresses and strains using the weak form of the governing equations.\n\n### Constitutive or Kinematic Laws Involved:\n- **Strain Measures:** The component may be used to store strain measures such as Green-Lagrange strain tensor $E$ or Almansi strain tensor.\n- **Stress Tensors:** Stress tensors like Cauchy stress $\boldsymbol{\tau}$, first Piola-Kirchhoff stress $\boldsymbol{P}$, and second Piola-Kirchhoff stress $\boldsymbol{S}$ may be represented within the matrix managed by this component.\n\n### Role in the Global FEM Pipeline:\n- **Matrix Assembly:** The `SingleMatrixAccessor` can store a pre-assembled mass or stiffness matrix resulting from spatial discretization via shape functions and element-wise integrations.\n- **Time Integration:** In implicit time integration schemes, such as backward Euler, the matrix may be used to solve for nodal displacements by inverting or solving linear systems involving $M$ and $K$.\n- **Nonlinear Resolution:** During Newton-Raphson iterations, the Jacobian (tangent stiffness) can be stored and accessed via this component.\n\n### Numerical Methods or Discretization Choices:\n- The `SingleMatrixAccessor` does not encode any specific numerical methods but rather provides a mechanism for accessing and managing matrices that are results of various discretizations and formulations within FEM.\n\n### Fit into the Broader Variational / Lagrangian Mechanics Framework:\n- This component fits into the broader framework by providing efficient access to matrices that represent physical quantities derived from variational principles and constitutive laws. These matrices are critical for solving nonlinear dynamical systems governed by Lagrangian mechanics, where the weak form of governing equations is solved using FEM.",
  "abstract": "The `SingleMatrixAccessor` manages a single square matrix in SOFA simulations by providing methods to set, retrieve, and access its properties.",
  "sheet": "# SingleMatrixAccessor\n\n## Overview\n\nThe `SingleMatrixAccessor` is a specialized component that inherits from `MultiMatrixAccessor`, designed to manage a single square matrix within the simulation context. It provides methods for setting (`setMatrix`) and retrieving matrices (`getMatrix`), as well as accessing their global dimensions (`getGlobalDimension`). This component simplifies interactions with other mechanical states or solvers by focusing on a single matrix.\n\n## Dependencies and Connections\n\nThe `SingleMatrixAccessor` typically interacts with various mechanical states or solvers within the SOFA scene graph. It is used to store matrices that represent physical quantities such as mass ($M$) or stiffness ($K$), which are critical for solving nonlinear dynamical systems governed by Lagrangian mechanics using FEM.\n\nThis component does not have explicit links to specific data fields but relies on its methods for interaction with other parts of the scene-graph architecture."
}