Back

MeshSubsetEngine

sofa::component::engine::select::MeshSubsetEngine
DataEngine
Doc (from source)

Extract a mesh subset based on selected vertices. This class extracts a mesh subset based on selected vertices

Abstract (AI generated)

`MeshSubsetEngine` extracts a subset of a mesh based on selected vertex indices, outputting the positions and elements of the extracted subset.

Metadata
module
Sofa.Component.Engine.Select
namespace
sofa::component::engine::select
include
sofa/component/engine/select/MeshSubsetEngine.h
inherits
  • DataEngine
templates
  • sofa::defaulttype::Vec3Types
summary
details
  • This component takes as input the positions and elements (edges, triangles, quads, tetrahedra, hexahedra) of a full mesh, along with a list of selected vertex indices. It then outputs a new mesh that includes only those elements whose vertices are in the specified subset.
  • The `MeshSubsetEngine` inherits from the `Inherited` class (likely part of SOFA's engine hierarchy), and initializes its input and output data fields during construction.
inputs
  • {'name': 'inputPosition', 'description': 'Positions of all vertices in the original mesh.', 'type': 'SeqPositions'}
  • {'name': 'inputEdges', 'description': 'Edges of the original mesh.', 'type': 'SeqEdges'}
  • {'name': 'inputTriangles', 'description': 'Triangles (faces) of the original mesh.', 'type': 'SeqTriangles'}
  • {'name': 'inputQuads', 'description': 'Quadrilaterals of the original mesh.', 'type': 'SeqQuads'}
  • {'name': 'inputTetrahedra', 'description': 'Tetrahedral elements of the original mesh.', 'type': 'SeqTetrahedra'}
  • {'name': 'inputHexahedra', 'description': 'Hexahedral elements (volumes) of the original mesh.', 'type': 'SeqHexahedra'}
  • {'name': 'indices', 'description': 'A list of selected vertex indices to form the subset.', 'type': 'SetIndices'}
outputs
  • {'name': 'position', 'description': 'Positions of vertices in the extracted mesh subset.', 'type': 'SeqPositions'}
  • {'name': 'edges', 'description': 'Edges of the extracted mesh subset.', 'type': 'SeqEdges'}
  • {'name': 'triangles', 'description': 'Triangles (faces) of the extracted mesh subset.', 'type': 'SeqTriangles'}
  • {'name': 'quads', 'description': 'Quadrilaterals of the extracted mesh subset.', 'type': 'SeqQuads'}
  • {'name': 'tetrahedra', 'description': 'Tetrahedral elements of the extracted mesh subset.', 'type': 'SeqTetrahedra'}
  • {'name': 'hexahedra', 'description': 'Hexahedral elements (volumes) of the extracted mesh subset.', 'type': 'SeqHexahedra'}
methods
  • {'name': 'init()', 'description': 'Initializes the engine and marks it as dirty to ensure an update.'}
  • {'name': 'reinit()', 'description': 'Reinitializes the engine by calling `update()`.'}
  • {'name': 'doUpdate()', 'description': 'The main method that extracts elements of the mesh subset based on the selected indices. It processes each type of element (edges, triangles, quads, tetrahedra, hexahedra) to ensure only those whose vertices are part of the specified subset are included in the output.'}
example_usage
  • {'description': 'Registering `MeshSubsetEngine` in an object factory for use within SOFA simulations.', 'code_snippet': 'sofa::core::ObjectFactory* factory = ...;\nfactory->registerObjects(core::ObjectRegistrationData("Extract a mesh subset based on selected vertices.").add<MeshSubsetEngine<defaulttype::Vec3Types>>());'}

The MeshSubsetEngine is an engine component in the SOFA (Simulation Open-Framework Architecture) framework that extracts a subset of a mesh based on specified vertex indices. This operation does not directly contribute to any governing equations, constitutive laws, or numerical methods typically associated with FEM. Instead, it serves as a utility for filtering and extracting specific parts of a mesh, which can be useful in various stages of the simulation pipeline.

Mathematical Description:

Inputs:

  • Positions: The input position data d_inputPosition is represented by the set of coordinates $\mathbf{P} = egin{pmatrix} \mathbf{p}_1 & \mathbf{p}_2 & \cdots & \mathbf{p}_N \end{pmatrix}$, where each $oldsymbol{p}_i$ is a vertex in the original mesh.
  • Elements: The input elements (edges, triangles, quads, tetrahedra, hexahedra) are described by sets of indices that define connectivity. For example, an edge is defined as a pair of vertex indices $egin{pmatrix} i & j \\ \end{pmatrix}$, where $i$ and $j$ refer to vertices in the position data.
  • Indices: The list of selected vertex indices d_indices is represented by a set $I = egin{pmatrix} k_1 & k_2 & \cdots & k_M \\ \end{pmatrix}$, where each $k_i$ is an index into the original position data.

Outputs:

  • Positions: The output position data d_position contains only the positions of vertices in the selected subset, represented by $ ilde{oldsymbol{P}} = egin{pmatrix} oldsymbol{p}_{k_1} & oldsymbol{p}_{k_2} & \cdots & oldsymbol{p}_{k_M} \\ \end{pmatrix}$.
  • Elements: The output elements (edges, triangles, quads, tetrahedra, hexahedra) are filtered to include only those that reference vertices in the selected subset.

Process:

The MeshSubsetEngine performs a mapping operation to extract a subset of the original mesh. It first creates a map $F$ from the full set of vertex indices to the subset index space, given by:

$$ F: I \to egin{pmatrix} 0 & 1 & \cdots & M-1 \\ \end{pmatrix} $$

For each element type (edges, triangles, quads, tetrahedra, hexahedra), the extractElements function checks if all vertices of an element are in the subset defined by d_indices. If they are, it remaps those vertices using the map $F$ and adds them to the output list.

Numerical Methods:

The component does not involve any numerical integration or solution methods. It is purely a data transformation tool that filters and re-indexes mesh elements based on selected vertex indices.

Role in FEM Pipeline:

Although MeshSubsetEngine itself does not contribute to the governing equations of FEM, it can be used during pre-processing stages to extract specific regions of interest from larger meshes for further analysis or simulation. This can help reduce computational complexity by focusing on relevant parts of a model.

Variational Framework:

The component operates at a purely geometric level and does not involve any variational principles or constitutive laws directly. Its primary function is to manipulate mesh data structures, which can be used in the broader context of setting up and solving FEM problems.

Data Fields
NameTypeDefaultHelp
d_inputPosition SeqPositions input vertices
d_inputEdges SeqEdges input edges
d_inputTriangles SeqTriangles input triangles
d_inputQuads SeqQuads input quads
d_inputTetrahedra SeqTetrahedra input tetrahedra
d_inputHexahedra SeqHexahedra input hexahedra
d_indices SetIndices Index lists of the selected vertices
d_position SeqPositions Vertices of mesh subset
d_edges SeqEdges edges of mesh subset
d_triangles SeqTriangles Triangles of mesh subset
d_quads SeqQuads Quads of mesh subset
d_tetrahedra SeqTetrahedra Tetrahedra of mesh subset
d_hexahedra SeqHexahedra Hexahedra of mesh subset
Methods
void init () virtual
void reinit () virtual
void doUpdate () virtual
{
  "name": "MeshSubsetEngine",
  "namespace": "sofa::component::engine::select",
  "module": "Sofa.Component.Engine.Select",
  "include": "sofa/component/engine/select/MeshSubsetEngine.h",
  "doc": "Extract a mesh subset based on selected vertices.\n\nThis class extracts a mesh subset based on selected vertices",
  "inherits": [
    "DataEngine"
  ],
  "templates": [
    "sofa::defaulttype::Vec3Types"
  ],
  "data_fields": [
    {
      "name": "d_inputPosition",
      "type": "SeqPositions",
      "xmlname": "inputPosition",
      "help": "input vertices"
    },
    {
      "name": "d_inputEdges",
      "type": "SeqEdges",
      "xmlname": "inputEdges",
      "help": "input edges"
    },
    {
      "name": "d_inputTriangles",
      "type": "SeqTriangles",
      "xmlname": "inputTriangles",
      "help": "input triangles"
    },
    {
      "name": "d_inputQuads",
      "type": "SeqQuads",
      "xmlname": "inputQuads",
      "help": "input quads"
    },
    {
      "name": "d_inputTetrahedra",
      "type": "SeqTetrahedra",
      "xmlname": "inputTetrahedra",
      "help": "input tetrahedra"
    },
    {
      "name": "d_inputHexahedra",
      "type": "SeqHexahedra",
      "xmlname": "inputHexahedra",
      "help": "input hexahedra"
    },
    {
      "name": "d_indices",
      "type": "SetIndices",
      "xmlname": "indices",
      "help": "Index lists of the selected vertices"
    },
    {
      "name": "d_position",
      "type": "SeqPositions",
      "xmlname": "position",
      "help": "Vertices of mesh subset"
    },
    {
      "name": "d_edges",
      "type": "SeqEdges",
      "xmlname": "edges",
      "help": "edges of mesh subset"
    },
    {
      "name": "d_triangles",
      "type": "SeqTriangles",
      "xmlname": "triangles",
      "help": "Triangles of mesh subset"
    },
    {
      "name": "d_quads",
      "type": "SeqQuads",
      "xmlname": "quads",
      "help": "Quads of mesh subset"
    },
    {
      "name": "d_tetrahedra",
      "type": "SeqTetrahedra",
      "xmlname": "tetrahedra",
      "help": "Tetrahedra of mesh subset"
    },
    {
      "name": "d_hexahedra",
      "type": "SeqHexahedra",
      "xmlname": "hexahedra",
      "help": "Hexahedra of mesh subset"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "reinit",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "doUpdate",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": {
    "summary": "The `MeshSubsetEngine` is an engine component in the SOFA (Simulation Open-Framework Architecture) framework that extracts a subset of a mesh based on specified vertex indices.",
    "details": [
      "This component takes as input the positions and elements (edges, triangles, quads, tetrahedra, hexahedra) of a full mesh, along with a list of selected vertex indices. It then outputs a new mesh that includes only those elements whose vertices are in the specified subset.",
      "The `MeshSubsetEngine` inherits from the `Inherited` class (likely part of SOFA's engine hierarchy), and initializes its input and output data fields during construction."
    ],
    "inputs": [
      {
        "name": "inputPosition",
        "description": "Positions of all vertices in the original mesh.",
        "type": "SeqPositions"
      },
      {
        "name": "inputEdges",
        "description": "Edges of the original mesh.",
        "type": "SeqEdges"
      },
      {
        "name": "inputTriangles",
        "description": "Triangles (faces) of the original mesh.",
        "type": "SeqTriangles"
      },
      {
        "name": "inputQuads",
        "description": "Quadrilaterals of the original mesh.",
        "type": "SeqQuads"
      },
      {
        "name": "inputTetrahedra",
        "description": "Tetrahedral elements of the original mesh.",
        "type": "SeqTetrahedra"
      },
      {
        "name": "inputHexahedra",
        "description": "Hexahedral elements (volumes) of the original mesh.",
        "type": "SeqHexahedra"
      },
      {
        "name": "indices",
        "description": "A list of selected vertex indices to form the subset.",
        "type": "SetIndices"
      }
    ],
    "outputs": [
      {
        "name": "position",
        "description": "Positions of vertices in the extracted mesh subset.",
        "type": "SeqPositions"
      },
      {
        "name": "edges",
        "description": "Edges of the extracted mesh subset.",
        "type": "SeqEdges"
      },
      {
        "name": "triangles",
        "description": "Triangles (faces) of the extracted mesh subset.",
        "type": "SeqTriangles"
      },
      {
        "name": "quads",
        "description": "Quadrilaterals of the extracted mesh subset.",
        "type": "SeqQuads"
      },
      {
        "name": "tetrahedra",
        "description": "Tetrahedral elements of the extracted mesh subset.",
        "type": "SeqTetrahedra"
      },
      {
        "name": "hexahedra",
        "description": "Hexahedral elements (volumes) of the extracted mesh subset.",
        "type": "SeqHexahedra"
      }
    ],
    "methods": [
      {
        "name": "init()",
        "description": "Initializes the engine and marks it as dirty to ensure an update."
      },
      {
        "name": "reinit()",
        "description": "Reinitializes the engine by calling `update()`."
      },
      {
        "name": "doUpdate()",
        "description": "The main method that extracts elements of the mesh subset based on the selected indices. It processes each type of element (edges, triangles, quads, tetrahedra, hexahedra) to ensure only those whose vertices are part of the specified subset are included in the output."
      }
    ],
    "example_usage": [
      {
        "description": "Registering `MeshSubsetEngine` in an object factory for use within SOFA simulations.",
        "code_snippet": "sofa::core::ObjectFactory* factory = ...;\nfactory->registerObjects(core::ObjectRegistrationData(\"Extract a mesh subset based on selected vertices.\").add<MeshSubsetEngine<defaulttype::Vec3Types>>());"
      }
    ]
  },
  "maths": "The `MeshSubsetEngine` is an engine component in the SOFA (Simulation Open-Framework Architecture) framework that extracts a subset of a mesh based on specified vertex indices. This operation does not directly contribute to any governing equations, constitutive laws, or numerical methods typically associated with FEM. Instead, it serves as a utility for filtering and extracting specific parts of a mesh, which can be useful in various stages of the simulation pipeline.\n\n### Mathematical Description:\n\n#### Inputs:\n- **Positions:** The input position data `d_inputPosition` is represented by the set of coordinates \\(\\mathbf{P} = \begin{pmatrix} \\mathbf{p}_1 & \\mathbf{p}_2 & \\cdots & \\mathbf{p}_N \\end{pmatrix}\\), where each \\(\boldsymbol{p}_i\\) is a vertex in the original mesh.\n- **Elements:** The input elements (edges, triangles, quads, tetrahedra, hexahedra) are described by sets of indices that define connectivity. For example, an edge is defined as a pair of vertex indices \\(\begin{pmatrix} i & j \\\\ \\end{pmatrix}\\), where \\(i\\) and \\(j\\) refer to vertices in the position data.\n- **Indices:** The list of selected vertex indices `d_indices` is represented by a set \\(I = \begin{pmatrix} k_1 & k_2 & \\cdots & k_M \\\\ \\end{pmatrix}\\), where each \\(k_i\\) is an index into the original position data.\n\n#### Outputs:\n- **Positions:** The output position data `d_position` contains only the positions of vertices in the selected subset, represented by \\(\tilde{\boldsymbol{P}} = \begin{pmatrix} \boldsymbol{p}_{k_1} & \boldsymbol{p}_{k_2} & \\cdots & \boldsymbol{p}_{k_M} \\\\ \\end{pmatrix}\\).\n- **Elements:** The output elements (edges, triangles, quads, tetrahedra, hexahedra) are filtered to include only those that reference vertices in the selected subset.\n\n#### Process:\nThe `MeshSubsetEngine` performs a mapping operation to extract a subset of the original mesh. It first creates a map \\(F\\) from the full set of vertex indices to the subset index space, given by:\n\\[ F: I \\to \begin{pmatrix} 0 & 1 & \\cdots & M-1 \\\\ \\end{pmatrix} \\]\nFor each element type (edges, triangles, quads, tetrahedra, hexahedra), the `extractElements` function checks if all vertices of an element are in the subset defined by `d_indices`. If they are, it remaps those vertices using the map \\(F\\) and adds them to the output list.\n\n### Numerical Methods:\nThe component does not involve any numerical integration or solution methods. It is purely a data transformation tool that filters and re-indexes mesh elements based on selected vertex indices.\n\n### Role in FEM Pipeline:\nAlthough `MeshSubsetEngine` itself does not contribute to the governing equations of FEM, it can be used during pre-processing stages to extract specific regions of interest from larger meshes for further analysis or simulation. This can help reduce computational complexity by focusing on relevant parts of a model.\n\n### Variational Framework:\nThe component operates at a purely geometric level and does not involve any variational principles or constitutive laws directly. Its primary function is to manipulate mesh data structures, which can be used in the broader context of setting up and solving FEM problems.",
  "abstract": "`MeshSubsetEngine` extracts a subset of a mesh based on selected vertex indices, outputting the positions and elements of the extracted subset.",
  "sheet": "# MeshSubsetEngine\n\n## Overview\nThe `MeshSubsetEngine` is an engine component in SOFA that extracts a subset of a mesh based on specified vertex indices. It inherits from `DataEngine` and processes input vertices and elements to produce a filtered output.\n\n## Parameters and Data\n- **inputPosition (`d_inputPosition`, SeqPositions)**: Positions of all vertices in the original mesh.\n- **inputEdges (`d_inputEdges`, SeqEdges)**: Edges of the original mesh.\n- **inputTriangles (`d_inputTriangles`, SeqTriangles)**: Triangles (faces) of the original mesh.\n- **inputQuads (`d_inputQuads`, SeqQuads)**: Quadrilaterals of the original mesh.\n- **inputTetrahedra (`d_inputTetrahedra`, SeqTetrahedra)**: Tetrahedral elements of the original mesh.\n- **inputHexahedra (`d_inputHexahedra`, SeqHexahedra)**: Hexahedral elements (volumes) of the original mesh.\n- **indices (`d_indices`, SetIndices)**: A list of selected vertex indices to form the subset.\n\n**Outputs:**\n- **position (`d_position`, SeqPositions)**: Positions of vertices in the extracted mesh subset.\n- **edges (`d_edges`, SeqEdges)**: Edges of the extracted mesh subset.\n- **triangles (`d_triangles`, SeqTriangles)**: Triangles (faces) of the extracted mesh subset.\n- **quads (`d_quads`, SeqQuads)**: Quadrilaterals of the extracted mesh subset.\n- **tetrahedra (`d_tetrahedra`, SeqTetrahedra)**: Tetrahedral elements of the extracted mesh subset.\n- **hexahedra (`d_hexahedra`, SeqHexahedra)**: Hexahedral elements (volumes) of the extracted mesh subset.\n\n## Dependencies and Connections\n`MeshSubsetEngine` typically requires input from components that provide vertex positions and element connectivity. It is often used in conjunction with other SOFA components to preprocess or filter mesh data for further simulation stages."
}