Back

WriteStateVisitor

sofa::simulation::WriteStateVisitor
Visitor
Abstract (AI generated)

The `WriteStateVisitor` traverses and writes out the mechanical state information from nodes in the SOFA simulation hierarchy.

Metadata
module
Sofa.framework.Simulation.Core
namespace
sofa::simulation
include
sofa/simulation/WriteStateVisitor.h
inherits
  • Visitor
description

The WriteStateVisitor is a utility component in the SOFA framework designed to traverse and write out the mechanical state information from nodes within the simulation hierarchy. This visitor processes each node top-down, checking if it contains a mechanical state (BaseMechanicalState). If so, it calls the writeState method of that mechanical state to output its current state into an output stream provided during instantiation.

Mathematical and Physical Description:

Governing Equations or Operators:

  • The WriteStateVisitor does not directly implement any governing equations or operators in the traditional sense, such as the mass matrix $M$, stiffness matrix $K$, internal force $oldsymbol{f}_{int}$, residual $R$, etc. Instead, it serves to output these quantities (among others) if they are stored within the BaseMechanicalState of a node.

Constitutive or Kinematic Laws:

  • The component does not involve any constitutive laws such as strain measures, stress tensors, hyperelastic potentials, damping models, constraint Jacobians, etc. It merely acts to retrieve and output these laws if they are part of the BaseMechanicalState.

Role in FEM Pipeline:

  • Assembly: The WriteStateVisitor does not contribute to the assembly phase of the simulation pipeline. Its role is purely for outputting state information after the assembly, time integration, nonlinear solve, and linear solve phases have been completed.
  • Time Integration: This component is agnostic to the specific time integration scheme used (e.g., implicit Euler or Newmark-type schemes). It retrieves and outputs the mechanical state of nodes post-integration.
  • Nonlinear Solve: The WriteStateVisitor does not influence the nonlinear solution phase. Instead, it might output the results after this phase has been completed.
  • Linear Solve: Similar to the nonlinear solve phase, this component is passive in the linear solve process and only outputs state information afterward.
  • Constraint Handling: It does not handle constraints directly but can output constraint-related information if stored within the BaseMechanicalState.
  • Mapping: The visitor does not perform any mappings between different meshes or resolutions. However, it can output mapped state data if such a mapping is part of the mechanical state.

Numerical Methods or Discretization Choices:

  • This component does not encode any specific numerical methods or discretization choices. It simply facilitates the output of information that may have been derived from these choices during the simulation process.

Variational / Lagrangian Mechanics Framework:

  • The WriteStateVisitor is a part of the broader SOFA framework which supports variational and Lagrangian mechanics principles in its core FEM pipeline. However, this specific component does not directly implement any aspect of these frameworks. Instead, it provides an interface to output state information that adheres to the principles established by the Lagrangian mechanics governing equations within the simulation.

Conclusion:

In summary, WriteStateVisitor serves as a utility for logging or exporting the mechanical state of nodes in the SOFA framework's scene graph. It does not contribute to the core mathematical and physical content but provides means to observe and record these states after they have been computed through other components within the FEM pipeline.

Methods
Result processNodeTopDown (simulation::Node * ) virtual
{
  "name": "WriteStateVisitor",
  "namespace": "sofa::simulation",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/WriteStateVisitor.h",
  "doc": "",
  "inherits": [
    "Visitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "processNodeTopDown",
      "return_type": "Result",
      "params": [
        {
          "name": "",
          "type": "simulation::Node *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `WriteStateVisitor` is a component in the SOFA framework, specifically within the `sofa::simulation` namespace, which inherits from the `Visitor` class. Its primary role is to traverse and write out the mechanical state information from nodes within the simulation hierarchy.\n\nThis visitor processes each node top-down and checks if it contains a mechanical state (`BaseMechanicalState`). If so, it calls the `writeState` method of that mechanical state to output its current state into an output stream provided during instantiation. The component does not maintain any additional data fields or inherit from other components.\n\nThe `processNodeTopDown` method is overridden from the base Visitor class and handles the traversal logic by continuing to process child nodes recursively if a node's mechanical state is written successfully.",
  "maths": "The `WriteStateVisitor` is a utility component in the SOFA framework designed to traverse and write out the mechanical state information from nodes within the simulation hierarchy. This visitor processes each node top-down, checking if it contains a mechanical state (`BaseMechanicalState`). If so, it calls the `writeState` method of that mechanical state to output its current state into an output stream provided during instantiation.\n\n### Mathematical and Physical Description:\n\n#### Governing Equations or Operators:\n- The `WriteStateVisitor` does not directly implement any governing equations or operators in the traditional sense, such as the mass matrix $M$, stiffness matrix $K$, internal force $\boldsymbol{f}_{int}$, residual $R$, etc. Instead, it serves to output these quantities (among others) if they are stored within the `BaseMechanicalState` of a node.\n\n#### Constitutive or Kinematic Laws:\n- The component does not involve any constitutive laws such as strain measures, stress tensors, hyperelastic potentials, damping models, constraint Jacobians, etc. It merely acts to retrieve and output these laws if they are part of the `BaseMechanicalState`.\n\n#### Role in FEM Pipeline:\n- **Assembly**: The `WriteStateVisitor` does not contribute to the assembly phase of the simulation pipeline. Its role is purely for outputting state information after the assembly, time integration, nonlinear solve, and linear solve phases have been completed.\n- **Time Integration**: This component is agnostic to the specific time integration scheme used (e.g., implicit Euler or Newmark-type schemes). It retrieves and outputs the mechanical state of nodes post-integration.\n- **Nonlinear Solve**: The `WriteStateVisitor` does not influence the nonlinear solution phase. Instead, it might output the results after this phase has been completed.\n- **Linear Solve**: Similar to the nonlinear solve phase, this component is passive in the linear solve process and only outputs state information afterward.\n- **Constraint Handling**: It does not handle constraints directly but can output constraint-related information if stored within the `BaseMechanicalState`.\n- **Mapping**: The visitor does not perform any mappings between different meshes or resolutions. However, it can output mapped state data if such a mapping is part of the mechanical state.\n\n#### Numerical Methods or Discretization Choices:\n- This component does not encode any specific numerical methods or discretization choices. It simply facilitates the output of information that may have been derived from these choices during the simulation process.\n\n#### Variational / Lagrangian Mechanics Framework:\n- The `WriteStateVisitor` is a part of the broader SOFA framework which supports variational and Lagrangian mechanics principles in its core FEM pipeline. However, this specific component does not directly implement any aspect of these frameworks. Instead, it provides an interface to output state information that adheres to the principles established by the Lagrangian mechanics governing equations within the simulation.\n\n### Conclusion:\nIn summary, `WriteStateVisitor` serves as a utility for logging or exporting the mechanical state of nodes in the SOFA framework's scene graph. It does not contribute to the core mathematical and physical content but provides means to observe and record these states after they have been computed through other components within the FEM pipeline.",
  "abstract": "The `WriteStateVisitor` traverses and writes out the mechanical state information from nodes in the SOFA simulation hierarchy.",
  "sheet": "# WriteStateVisitor\n\n## Overview\n\nThe `WriteStateVisitor` is a utility component within the `sofa::simulation` namespace that inherits from the `Visitor` class. Its primary role is to traverse and write out the mechanical state information from nodes within the simulation hierarchy, facilitating logging or exporting of state data.\n\n## Practical Notes\n\nThis component does not maintain any additional data fields or inherit from other components beyond its base `Visitor`. It processes each node top-down, checking if it contains a mechanical state (`BaseMechanicalState`). If so, it calls the `writeState` method to output the current state into an output stream provided during instantiation. The `WriteStateVisitor` is agnostic to specific numerical methods or discretization choices and does not influence core simulation phases such as assembly, time integration, nonlinear solve, linear solve, constraint handling, or mapping."
}