Back

OffSequenceLoader

sofa::component::io::mesh::OffSequenceLoader
MeshOffLoader
Doc (from source)

Read and load an .off file at each timestep. This class load a sequence of .off mesh files, ordered by index in their name

Abstract (AI generated)

The `OffSequenceLoader` component loads a sequence of .off mesh files at each timestep, updating the simulation geometry dynamically based on file indices embedded within their names.

Metadata
module
Sofa.Component.IO.Mesh
namespace
sofa::component::io::mesh
include
sofa/component/io/mesh/OffSequenceLoader.h
inherits
  • MeshOffLoader
description

The OffSequenceLoader component in the SOFA framework is primarily concerned with loading a sequence of .off (Object File Format) mesh files at each timestep during a simulation. This component does not directly contribute to any governing equations, constitutive laws, or numerical methods related to FEM simulations. Instead, it provides a mechanism for dynamically updating the geometry of the system over time by sequentially reading predefined mesh files.

Mathematical and Physical Description:

Role in the Global FEM Pipeline:

  • Initialization (init): The init method ensures that the component is properly set up before the simulation begins. It checks for an empty filename attribute, parses the file name to determine the starting index of the sequence, and sets initial values.
  • Resetting (reset): The reset method resets the current state by setting the currentIndex back to the firstIndex, clearing all stored mesh data, and loading the first file in the sequence again. This is useful for restarting or resetting the simulation while maintaining consistency.
  • Event Handling (handleEvent): The handleEvent method listens for animation begin events (AnimateBeginEvent). At each event, it checks if the current time exceeds the cumulative duration of previously loaded files and loads the next file in the sequence accordingly. This ensures that the geometry is updated at the appropriate timesteps based on the specified durations.
  • Loading Files (load): The load method reads an .off file into memory, parsing its contents to extract vertex positions and mesh topology (edges, triangles, quads, polygons, tetrahedra, hexahedra). It also clears previous data before loading new files to prevent accumulation of outdated information.
  • Clearing Data (clear): The clear method removes all stored mesh data from memory. This is called during initialization and resetting to ensure that only the current file's geometry is active in the simulation.

Numerical Methods or Discretization Choices:

While the component itself does not involve FEM-specific numerical methods, it enables simulations where the discretized mesh can change over time. The sequence of .off files represents different states of the system at various timesteps, allowing for dynamic changes such as morphing shapes or progressive deformations.

Interactions with Other Components:

The OffSequenceLoader interacts with other SOFA components through event handling and initialization methods. It is a part of the broader framework that supports real-time or high-fidelity simulations involving complex geometry changes over time.

Summary:

The OffSequenceLoader component does not contribute to any governing equations, constitutive laws, or numerical methods directly related to FEM. Its role is to dynamically update the mesh geometry during a simulation by loading pre-defined .off files at specified timesteps, enabling simulations of systems with changing geometries.

Data Fields
NameTypeDefaultHelp
d_nbFiles int number of files in the sequence
d_stepDuration double how long each file is loaded
Methods
void init () virtual
void reset () virtual
void handleEvent (sofa::core::objectmodel::Event * event) virtual
bool load (const char * filename) virtual
void clear ()
{
  "name": "OffSequenceLoader",
  "namespace": "sofa::component::io::mesh",
  "module": "Sofa.Component.IO.Mesh",
  "include": "sofa/component/io/mesh/OffSequenceLoader.h",
  "doc": "Read and load an .off file at each timestep.\n\nThis class load a sequence of .off mesh files, ordered by index in their name",
  "inherits": [
    "MeshOffLoader"
  ],
  "templates": [],
  "data_fields": [
    {
      "name": "d_nbFiles",
      "type": "int",
      "xmlname": "nbOfFiles",
      "help": "number of files in the sequence"
    },
    {
      "name": "d_stepDuration",
      "type": "double",
      "xmlname": "stepDuration",
      "help": "how long each file is loaded"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "reset",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "handleEvent",
      "return_type": "void",
      "params": [
        {
          "name": "event",
          "type": "sofa::core::objectmodel::Event *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "load",
      "return_type": "bool",
      "params": [
        {
          "name": "filename",
          "type": "const char *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "clear",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `OffSequenceLoader` is a SOFA component designed to load and read a sequence of .off (Object File Format) mesh files at each timestep in the simulation. It extends the functionality of the base class `MeshOffLoader`, allowing for dynamic loading based on file indices embedded within their names.\n\n**Role and Purpose**: \nThis component is essential for simulations where the geometry changes over time, such as morphing shapes or progressive deformations, by sequentially loading pre-defined mesh files. The `OffSequenceLoader` handles initialization, resetting, event handling, and clearing of loaded data to ensure seamless integration with SOFA's simulation pipeline.\n\n**Interactions with Other Components**: \nThe component interacts with other parts of the SOFA framework through virtual methods like `init`, `reset`, `handleEvent`, and `load`. These methods are overridden from its parent class `MeshOffLoader` to provide sequence-specific behavior. The event handling method (`handleEvent`) listens for animation begin events, triggering file loading at appropriate times.\n\n**Practical Usage Guidance**: \nThe primary configuration parameters are `nbOfFiles` (number of files in the sequence) and `stepDuration` (duration each file is loaded). These must be set correctly to ensure proper temporal behavior during simulation. The component automatically parses the filename to determine the index part, allowing for sequential loading without manual intervention.\n\n**Data Fields**: \nThe key data fields include:\n- `d_nbFiles`: Defines the number of files in the sequence (integer).\n- `d_stepDuration`: Specifies how long each file is loaded (double).",
  "maths": "The `OffSequenceLoader` component in the SOFA framework is primarily concerned with loading a sequence of .off (Object File Format) mesh files at each timestep during a simulation. This component does not directly contribute to any governing equations, constitutive laws, or numerical methods related to FEM simulations. Instead, it provides a mechanism for dynamically updating the geometry of the system over time by sequentially reading predefined mesh files.\n\n### Mathematical and Physical Description:\n\n#### Role in the Global FEM Pipeline:\n- **Initialization (`init`)**: The `init` method ensures that the component is properly set up before the simulation begins. It checks for an empty filename attribute, parses the file name to determine the starting index of the sequence, and sets initial values.\n- **Resetting (`reset`)**: The `reset` method resets the current state by setting the `currentIndex` back to the `firstIndex`, clearing all stored mesh data, and loading the first file in the sequence again. This is useful for restarting or resetting the simulation while maintaining consistency.\n- **Event Handling (`handleEvent`)**: The `handleEvent` method listens for animation begin events (`AnimateBeginEvent`). At each event, it checks if the current time exceeds the cumulative duration of previously loaded files and loads the next file in the sequence accordingly. This ensures that the geometry is updated at the appropriate timesteps based on the specified durations.\n- **Loading Files (`load`)**: The `load` method reads an .off file into memory, parsing its contents to extract vertex positions and mesh topology (edges, triangles, quads, polygons, tetrahedra, hexahedra). It also clears previous data before loading new files to prevent accumulation of outdated information.\n- **Clearing Data (`clear`)**: The `clear` method removes all stored mesh data from memory. This is called during initialization and resetting to ensure that only the current file's geometry is active in the simulation.\n\n#### Numerical Methods or Discretization Choices:\nWhile the component itself does not involve FEM-specific numerical methods, it enables simulations where the discretized mesh can change over time. The sequence of .off files represents different states of the system at various timesteps, allowing for dynamic changes such as morphing shapes or progressive deformations.\n\n#### Interactions with Other Components:\nThe `OffSequenceLoader` interacts with other SOFA components through event handling and initialization methods. It is a part of the broader framework that supports real-time or high-fidelity simulations involving complex geometry changes over time.\n\n### Summary:\nThe `OffSequenceLoader` component does not contribute to any governing equations, constitutive laws, or numerical methods directly related to FEM. Its role is to dynamically update the mesh geometry during a simulation by loading pre-defined .off files at specified timesteps, enabling simulations of systems with changing geometries.",
  "abstract": "The `OffSequenceLoader` component loads a sequence of .off mesh files at each timestep, updating the simulation geometry dynamically based on file indices embedded within their names.",
  "sheet": "# OffSequenceLoader\n\n## Overview\n\nThe `OffSequenceLoader` is an I/O component in SOFA that extends the functionality of the base class `MeshOffLoader`. It loads a sequence of .off (Object File Format) mesh files at each timestep, updating the simulation geometry dynamically based on file indices embedded within their names. This component is essential for simulations where the geometry changes over time.\n\n## Parameters and Data\n\nThe significant data fields exposed by this component are:\n\n- **`nbOfFiles` (int)**: Defines the number of files in the sequence. Default value not specified.\n- **`stepDuration` (double)**: Specifies how long each file is loaded before transitioning to the next one. Default value not specified."
}