Back

MechanicalVMultiOpVisitor

sofa::simulation::mechanicalvisitor::MechanicalVMultiOpVisitor
BaseMechanicalVisitor
Doc (from source)

Perform a sequence of linear vector accumulation operation $r_i = sum_j (v_j*f_{ij}) This is used to compute in on steps operations such as $v = v + a*dt, x = x + v*dt$. Note that if the result vector appears inside the expression, it must be the first operand.

Abstract (AI generated)

The `MechanicalVMultiOpVisitor` performs linear vector accumulation operations in mechanical simulations, such as velocity or position updates based on accelerations and time steps. It inherits from `BaseMechanicalVisitor`, enabling it to visit and operate on mechanical states within the simulation graph.

Metadata
module
Sofa.framework.Simulation.Core
namespace
sofa::simulation::mechanicalvisitor
include
sofa/simulation/mechanicalvisitor/MechanicalVMultiOpVisitor.h
inherits
  • BaseMechanicalVisitor
description
Methods
MechanicalVMultiOpVisitor & setMapped (bool m)
Result fwdMechanicalState (VisitorContext * ctx, sofa::core::behavior::BaseMechanicalState * mm) virtual
Result fwdMappedMechanicalState (VisitorContext * ctx, sofa::core::behavior::BaseMechanicalState * mm) virtual
int getInfos ()
bool isThreadSafe () virtual
void setVMultiOp (VMultiOp & o)
{
  "name": "MechanicalVMultiOpVisitor",
  "namespace": "sofa::simulation::mechanicalvisitor",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/mechanicalvisitor/MechanicalVMultiOpVisitor.h",
  "doc": "Perform a sequence of linear vector accumulation operation $r_i = sum_j (v_j*f_{ij})\n This is used to compute in on steps operations such as $v = v + a*dt, x = x + v*dt$.\n Note that if the result vector appears inside the expression, it must be the first operand.",
  "inherits": [
    "BaseMechanicalVisitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "setMapped",
      "return_type": "MechanicalVMultiOpVisitor &",
      "params": [
        {
          "name": "m",
          "type": "bool"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "fwdMechanicalState",
      "return_type": "Result",
      "params": [
        {
          "name": "ctx",
          "type": "VisitorContext *"
        },
        {
          "name": "mm",
          "type": "sofa::core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "fwdMappedMechanicalState",
      "return_type": "Result",
      "params": [
        {
          "name": "ctx",
          "type": "VisitorContext *"
        },
        {
          "name": "mm",
          "type": "sofa::core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getInfos",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "isThreadSafe",
      "return_type": "bool",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setVMultiOp",
      "return_type": "void",
      "params": [
        {
          "name": "o",
          "type": "VMultiOp &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `MechanicalVMultiOpVisitor` is a part of the SOFA framework that handles the computation and accumulation of vector operations in mechanical simulations, such as velocity or position updates based on acceleration and time steps. It inherits from `BaseMechanicalVisitor`, indicating it is designed to visit and operate on mechanical states within the simulation graph.\n\nThis component performs linear vector accumulation operations specified by a sequence of multi-vector operations ($r_i = sum_j (v_j*f_{ij})$). It supports both direct and mapped mechanical state operations, allowing for parallelized computation when needed. The `fwdMechanicalState` and `fwdMappedMechanicalState` methods are used to apply these operations on the mechanical states.\n\nThe component interacts with other SOFA components through its virtual method overrides (`fwdMechanicalState`, `fwdMappedMechanicalState`, `isThreadSafe`) and the `setVMultiOp` method, which configures the vector operation sequence. It also provides a way to set whether operations are mapped via `setMapped`. The `getInfos` method returns a string representation of the configured operations for debugging or logging purposes.\n\nThe practical usage of this component involves configuring it with the desired vector operations and applying it to the mechanical states during simulation steps. This allows for efficient computation of common operations like velocity and position updates within the simulation framework.",
  "maths": "The `MechanicalVMultiOpVisitor` is designed to perform linear vector accumulation operations in the context of mechanical simulations, which can be mathematically described as follows:\n\n### Governing Equations and Operators\n\n1. **Linear Vector Accumulation Operation**\n   - The component performs a sequence of linear vector accumulation operations defined by the equation:\n     \n     \\[ r_i = \\sum_j (v_j f_{ij}) \\]\n\n2. **Example Operations**\n   - Common examples include velocity and position updates such as:\n     \n     \\[ v = v + a dt \\]\n     \n     \\[ x = x + v dt \\]\n\n### Constitutive or Kinematic Laws Involved\n\n1. **Vector Accumulation Law**\n   - The component is used to accumulate multiple vector operations into a single resultant vector operation.\n   - This accumulation can involve any combination of input vectors and coefficients, such as:\n     \n     \\[ r = v_0 + c_1 v_1 + c_2 v_2 + ... \\]\n\n### Role in the Global FEM Pipeline\n\n- **Assembly Phase**: The component is not directly involved in assembling global matrices but rather performs specific vector operations that can be part of a larger assembly process.\n- **Time Integration**: This visitor can be used to compute intermediate results during time integration steps, such as updating velocities or positions based on accelerations and time increments.\n- **Nonlinear Solve**: While not directly involved in solving nonlinear systems, it can contribute by accumulating terms that are part of the overall residual calculation.\n\n### Numerical Methods or Discretization Choices Encoded\n\n1. **Vector Operations**\n   - The component encodes vector operations using a sequence of linear accumulations, which can be represented as:\n     \n     \\[ r = \\sum_{j=0}^{N-1} c_j v_j \\]\n\n2. **Parallelization Support**\n   - It supports parallel computation through the `isThreadSafe` method, indicating that operations can be safely performed in a multithreaded environment.\n\n### Integration into the Variational / Lagrangian Mechanics Framework\n\n- The component operates at the level of mechanical state vectors (e.g., positions and velocities) rather than directly on variational principles or constitutive laws. However, it plays a role in updating these states during each simulation step, contributing to the overall dynamics.\n- For example, in an implicit time integration scheme like Backward Euler, operations such as:\n  \n  \\[ v_{n+1} = v_n + a dt \\]\n\n  can be performed using this visitor to update velocities based on accelerations and time steps. Similarly, position updates can be handled by another set of vector accumulation operations.\n- The component facilitates efficient computation by grouping multiple vector operations into one step, thereby reducing the overhead of repeated operations during each simulation cycle.",
  "abstract": "The `MechanicalVMultiOpVisitor` performs linear vector accumulation operations in mechanical simulations, such as velocity or position updates based on accelerations and time steps. It inherits from `BaseMechanicalVisitor`, enabling it to visit and operate on mechanical states within the simulation graph.",
  "sheet": "# MechanicalVMultiOpVisitor\n\n## Overview\nThe `MechanicalVMultiOpVisitor` is a visitor component in SOFA that performs linear vector accumulation operations, such as velocity or position updates based on accelerations and time steps. It inherits from `BaseMechanicalVisitor`, indicating its role in visiting and operating on mechanical states within the simulation graph.\n\n## Mathematical Model\nThe component performs a sequence of linear vector accumulation operations defined by:\n\n\\[ r_i = \\sum_j (v_j f_{ij}) \\]\n\nCommon examples include velocity and position updates such as:\n\n\\[ v = v + a dt \\]\n\\[ x = x + v dt \\]\n\n## Parameters and Data\nThe component exposes the following methods to configure its behavior:\n- `setMapped(bool m)`: Sets whether operations are mapped.\n- `setVMultiOp(VMultiOp &o)`: Configures the vector operation sequence.\n\n## Dependencies and Connections\nThis visitor interacts with other SOFA components through method overrides such as `fwdMechanicalState` and `fwdMappedMechanicalState`, which apply these operations on mechanical states. The component also supports parallel computation via the `isThreadSafe` method, indicating that operations can be safely performed in a multithreaded environment.\n\n## Practical Notes\nThe visitor is designed to efficiently compute common vector operations during simulation steps. Configuring it with the desired operations and ensuring thread safety are key considerations for practical usage."
}