Back

STLExporter

sofa::component::_stlexporter_::STLExporter
BaseSimulationExporter
Doc (from source)

Save a topology in file.

Abstract (AI generated)

The STLExporter component exports topology data from a SOFA simulation into STL files, supporting both ASCII and binary formats based on the `d_binaryFormat` parameter.

Metadata
module
Sofa.Component.IO.Mesh
namespace
sofa::component::_stlexporter_
include
sofa/component/io/mesh/STLExporter.h
inherits
  • BaseSimulationExporter
description

The MergeROIs component in the SOFA framework is designed to merge multiple Regions Of Interest (ROIs), represented as vectors of indices, into a single structured output vector. This process does not involve any physical or mathematical operations that are typically associated with FEM simulations such as mass matrices, stiffness matrices, internal forces, or residuals. Instead, it focuses on data management and organization within the simulation environment.

Mathematical and Physical Description:

Governing Equations and Operators

  • Mass Matrix ((M")), Stiffness Matrix ((K"), Internal Force ((f_{int}"), Residual ((R"): None. The MergeROIs component does not contribute to these FEM operators.

Constitutive or Kinematic Laws Involved

  • Strain measures, stress tensors, hyperelastic potentials, damping models, constraint Jacobians: None. This component is purely data-related and does not involve any constitutive laws or kinematic formulations.

Role in the Global FEM Pipeline

  • Assembly: No contribution to assembling mass matrices, stiffness matrices, internal forces, etc.
  • Time Integration: Not involved in time integration schemes such as implicit Euler or Newmark-type methods.
  • Nonlinear Resolution: Does not participate in nonlinear solve steps like Newton-Raphson iterations.
  • Linear Resolution: No involvement in linear solvers or matrix-free operations.
  • Update: Does not contribute to state update, velocity reconstruction, or timestep advancement.

Numerical Methods and Discretization Choices

  • The component does not encode any numerical methods or discretization choices related to FEM. It is purely a data manipulation utility for merging ROIs represented as index lists.

Integration into the Variational / Lagrangian Mechanics Framework

  • Variational Formulation: None. This component operates on input data and outputs merged ROI lists without affecting any variational or Lagrangian formulations.
  • Lagrangian Mechanics: No contribution to Lagrangian mechanics principles, as it is purely a data management tool.

Summary

The MergeROIs component in SOFA is used for merging multiple ROIs (represented as vectors of indices) into a single structured output vector. It does not contribute to the mathematical or physical aspects of FEM simulations but plays a role in organizing and preparing ROI data for further processing within the simulation environment.

Data Fields
NameTypeDefaultHelp
d_binaryFormat bool if true, save in binary format, otherwise in ascii
Methods
void doInit () virtual
void doReInit () virtual
void handleEvent (Event * ) virtual
bool write () virtual
bool writeSTL (bool autonumbering)
bool writeSTLBinary (bool autonumbering)
{
  "name": "STLExporter",
  "namespace": "sofa::component::_stlexporter_",
  "module": "Sofa.Component.IO.Mesh",
  "include": "sofa/component/io/mesh/STLExporter.h",
  "doc": "Save a topology in file.",
  "inherits": [
    "BaseSimulationExporter"
  ],
  "templates": [],
  "data_fields": [
    {
      "name": "d_binaryFormat",
      "type": "bool",
      "xmlname": "binaryformat",
      "help": "if true, save in binary format, otherwise in ascii"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "doInit",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "doReInit",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "handleEvent",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "Event *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "write",
      "return_type": "bool",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "writeSTL",
      "return_type": "bool",
      "params": [
        {
          "name": "autonumbering",
          "type": "bool"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "writeSTLBinary",
      "return_type": "bool",
      "params": [
        {
          "name": "autonumbering",
          "type": "bool"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The STLExporter is a component designed to save the geometry (topology) data from a simulation into an STL file format, which is commonly used for 3D modeling and printing. This component inherits functionality from BaseSimulationExporter.\n\n### Key Features:\n- **File Export**: It can export the topology data as both ASCII and binary STL files.\n- **Data Sources**: The component retrieves position, triangle, and quad indices either from a VisualModel or Topology in the simulation context.\n- **Customization**: Users can specify whether to write the file in ASCII or binary format through a boolean parameter `d_binaryFormat`.\n\n### Detailed Workflow:\n1. **Initialization** (`doInit`, `doReInit`): The component initializes and reinitializes by obtaining necessary data (position, triangles, quads) from either VisualModel or Topology if available. If these are not set explicitly, the component searches for them in the context.\n2. **Writing to File**: \nThe `write()` method delegates the actual writing based on the value of `d_binaryFormat`. It calls `writeSTL()` for ASCII and `writeSTLBinary()` for binary STL files.\n  - **ASCII Format** (`writeSTL`): Writes a header, followed by each facet with vertices and normals (set to zero) in an ASCII format.\n  - **Binary Format** (`writeSTLBinary`): Creates the file with a fixed-size header and then writes the number of facets and their respective vertex coordinates in binary form.\n3. **Event Handling**: The `handleEvent()` method listens for specific GUI events and triggers the export when an event named 'STLExport' is detected, using either ASCII or binary format based on `d_binaryFormat` value.\n\n### Configuration Parameters:\n- `d_binaryFormat`: A boolean parameter to specify whether to write in binary (true) or ASCII (false) STL format.",
  "maths": "The `STLExporter` component in the SOFA framework is primarily an I/O utility designed to export topology data from a simulation into STL (Stereolithography) format files, which are widely used for 3D modeling and printing. This component does not directly contribute to any of the core mathematical or physical operators typically associated with finite element analysis (FEM), such as mass matrix (\\(M\")), stiffness matrix (\\(K\")), internal force vector (\\(f_{int}\")), residual vector (\\(R\")), etc. Instead, its role is purely in exporting the geometric information represented by vertices and their connectivity (triangles or quads) for visualization or further processing outside of SOFA.\n\n### Key Features:\n- **File Export:** The component saves the topology data as both ASCII and binary STL files. \n  - In ASCII format, it writes a header followed by each facet with vertex coordinates and normal vectors (set to zero).\n  - In binary format, it creates a fixed-size header, followed by the number of facets and their respective vertex coordinates in binary form.\n- **Data Sources:** The `STLExporter` retrieves position, triangle, and quad indices from either a VisualModel or BaseMeshTopology within the simulation context. \n\n### Detailed Workflow:\n1. **Initialization (`doInit`, `doReInit`):** The component initializes by obtaining necessary data (position, triangles, quads) from either VisualModel or Topology if available. If these are not explicitly set, it searches for them in the simulation's context.\n2. **Writing to File:** \n  - The `write()` method delegates the actual writing based on the value of the boolean parameter `d_binaryFormat`. It calls `writeSTL()` for ASCII and `writeSTLBinary()` for binary STL files.\n  - **ASCII Format (`writeSTL`):** Writes a header, followed by each facet with vertices (and normals set to zero) in an ASCII format.\n  - **Binary Format (`writeSTLBinary`):** Creates the file with a fixed-size header and then writes the number of facets and their respective vertex coordinates in binary form.\n3. **Event Handling:** The `handleEvent()` method listens for specific GUI events, specifically one named 'STLExport'. Upon detecting this event, it triggers an export using either ASCII or binary format based on the value of `d_binaryFormat`.\n\n### Configuration Parameters:\n- `d_binaryFormat`: A boolean parameter specifying whether to write in binary (true) or ASCII (false) STL format.\n\nIn summary, the `STLExporter` does not implement any mathematical operators relevant to FEM simulation but instead focuses on exporting the geometric data from a simulation for external use.",
  "abstract": "The STLExporter component exports topology data from a SOFA simulation into STL files, supporting both ASCII and binary formats based on the `d_binaryFormat` parameter.",
  "sheet": "# STLExporter\n\n**Overview:**\nThe STLExporter is an I/O utility that exports topology data from a SOFA simulation into STL (Stereolithography) format files. It supports both ASCII and binary STL file formats, with the choice controlled by the `d_binaryFormat` parameter.\n\n**Parameters and Data:*\n- **d_binaryFormat**: A boolean parameter specifying whether to write in binary (true) or ASCII (false) STL format. The default value is false, indicating ASCII format.\n\n**Dependencies and Connections:**\nThe component retrieves position, triangle, and quad indices from either a VisualModel or BaseMeshTopology within the simulation context. It does not require any specific SOFA components but relies on the simulation's topology data for exporting."
}