Back

CleanupVisitor

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

`CleanupVisitor` traverses the scene graph of a simulation to clean up objects, ensuring proper resource deallocation and preventing memory leaks.

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

The CleanupVisitor is a class in the SOFA framework under the sofa::simulation namespace, inheriting from the Visitor class. Its primary role is to facilitate the cleanup process by traversing and cleaning up objects within the scene graph of a simulation. It ensures that objects are properly cleaned up, even if their removal affects the structure of the node list during the cleanup process.

Governing Equations or Operators:

  • The CleanupVisitor does not contribute to any governing equations (e.g., mass matrix $M$, stiffness matrix $K$, internal force $f_{ ext{int}}$, residual $R$) directly. Instead, it ensures that objects within the scene graph are properly cleaned up and finalized.

Constitutive or Kinematic Laws Involved:

  • The CleanupVisitor does not involve any constitutive or kinematic laws (e.g., strain measures, stress tensors, hyperelastic potentials, damping models). It is a utility class for managing the cleanup of objects within the scene graph.

Role in the Global FEM Pipeline:

  • Assembly: Not applicable.
  • Time Integration: Not applicable.
  • Nonlinear Solve: Not applicable.
  • Linear Solve: Not applicable.
  • Constraint Handling: Not directly involved, but ensures that constraints and related objects are properly cleaned up.
  • Mapping: Not applicable.

Numerical Methods or Discretization Choices:

  • The CleanupVisitor does not encode any specific numerical methods or discretization choices. It is a utility class for managing the cleanup process within the scene graph, ensuring that all resources are properly released and no memory leaks occur.

Fit into the Broader Variational / Lagrangian Mechanics Framework:

  • The CleanupVisitor ensures that objects are cleaned up correctly at the end of a simulation. This is crucial for maintaining the integrity of the simulation framework but does not directly influence any variational or Lagrangian mechanics computations.
Methods
Result processNodeTopDown (Node * node) virtual
void processNodeBottomUp (Node * node) virtual
{
  "name": "CleanupVisitor",
  "namespace": "sofa::simulation",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/CleanupVisitor.h",
  "doc": "",
  "inherits": [
    "Visitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "processNodeTopDown",
      "return_type": "Result",
      "params": [
        {
          "name": "node",
          "type": "Node *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "processNodeBottomUp",
      "return_type": "void",
      "params": [
        {
          "name": "node",
          "type": "Node *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `CleanupVisitor` is a class in the SOFA framework under the `sofa::simulation` namespace, inheriting from the `Visitor` class. Its primary role is to facilitate the cleanup process by traversing and cleaning up objects within the scene graph of a simulation. It ensures that objects are properly cleaned up, even if their removal affects the structure of the node list during the cleanup process.\n\n### Interactions with Other Components:\nThe `CleanupVisitor` interacts with nodes in the SOFA scene graph through methods such as `processNodeTopDown`, which is responsible for visiting each node and cleaning up objects within it. The method `processNodeBottomUp` exists but does not perform any actions in this implementation.\n\n### Practical Usage Guidance:\nThe component is typically used internally by the framework during cleanup phases of a simulation to ensure that all resources are properly released and no memory leaks occur. It iterates through each node and its objects, invoking their `cleanup()` method to finalize resource deallocation. The process ensures that modifications to the graph structure do not interfere with the cleaning sequence.",
  "maths": "The `CleanupVisitor` is a class in the SOFA framework under the `sofa::simulation` namespace, inheriting from the `Visitor` class. Its primary role is to facilitate the cleanup process by traversing and cleaning up objects within the scene graph of a simulation. It ensures that objects are properly cleaned up, even if their removal affects the structure of the node list during the cleanup process.\n\n### Governing Equations or Operators:\n- The `CleanupVisitor` does not contribute to any governing equations (e.g., mass matrix $M$, stiffness matrix $K$, internal force $f_{\text{int}}$, residual $R$) directly. Instead, it ensures that objects within the scene graph are properly cleaned up and finalized.\n\n### Constitutive or Kinematic Laws Involved:\n- The `CleanupVisitor` does not involve any constitutive or kinematic laws (e.g., strain measures, stress tensors, hyperelastic potentials, damping models). It is a utility class for managing the cleanup of objects within the scene graph.\n\n### Role in the Global FEM Pipeline:\n- **Assembly:** Not applicable.\n- **Time Integration:** Not applicable.\n- **Nonlinear Solve:** Not applicable.\n- **Linear Solve:** Not applicable.\n- **Constraint Handling:** Not directly involved, but ensures that constraints and related objects are properly cleaned up.\n- **Mapping:** Not applicable.\n\n### Numerical Methods or Discretization Choices:\n- The `CleanupVisitor` does not encode any specific numerical methods or discretization choices. It is a utility class for managing the cleanup process within the scene graph, ensuring that all resources are properly released and no memory leaks occur.\n\n### Fit into the Broader Variational / Lagrangian Mechanics Framework:\n- The `CleanupVisitor` ensures that objects are cleaned up correctly at the end of a simulation. This is crucial for maintaining the integrity of the simulation framework but does not directly influence any variational or Lagrangian mechanics computations.",
  "abstract": "`CleanupVisitor` traverses the scene graph of a simulation to clean up objects, ensuring proper resource deallocation and preventing memory leaks.",
  "sheet": "# CleanupVisitor\n\n**Overview:**\n`CleanupVisitor` is a utility class under the `sofa::simulation` namespace that inherits from the `Visitor` class. Its primary role is to facilitate the cleanup process by traversing and cleaning up objects within the scene graph of a simulation, ensuring proper resource deallocation and preventing memory leaks."
}