Back

MeshBoundaryROI

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

Outputs indices of boundary vertices of a triangle/quad mesh This class outputs indices of boundary vertices of a triangle/quad mesh The boundary is detected using the number elements associated to the edges. An edge is considered on the boundary if it has a unique associated element. @author benjamin gilles

Abstract (AI generated)

The `MeshBoundaryROI` component identifies boundary vertices in triangle/quad meshes by counting the number of elements associated with each edge.

Metadata
module
Sofa.Component.Engine.Select
namespace
sofa::component::engine::select
include
sofa/component/engine/select/MeshBoundaryROI.h
inherits
  • DataEngine
description

The MeshBoundaryROI component in the SOFA framework identifies boundary vertices for triangle or quad meshes. It operates on the principle that an edge is considered part of the boundary if it is associated with a single element (triangle or quad). This approach leverages topological properties to determine boundary vertices without involving constitutive laws, strain measures, or stress tensors directly.

Mathematical Description:

Topology and Boundary Detection

The component processes mesh elements defined by triangles and quads. Let $ T $ be the set of triangle indices, and $ Q $ be the set of quad indices. Each element in these sets is represented as a sequence of vertex indices.

An edge can be represented as an ordered pair of vertices, $ (i, j) $, where $ i \neq j $. The component constructs a map to count the number of elements associated with each unique edge:

$$ C: \{ (i,j) | i < j, ext{i and j are vertices} \} \rightarrow \mathbb{Z} $$

where $ C(i, j) $ is the count of elements that contain edge $(i, j)$.

For each triangle $ t = (t_0, t_1, t_2) \in T $:
- Increment $ C(t_0, t_1) $, $ C(t_1, t_2) $, and $ C(t_2, t_0) $.

For each quad $ q = (q_0, q_1, q_2, q_3) \in Q $:
- Increment $ C(q_0, q_1) $, $ C(q_1, q_2) $, $ C(q_2, q_3) $, and $ C(q_3, q_0) $.

An edge $(i,j)$ is considered to be on the boundary if:

$$ C(i, j) = 1 $$

Boundary Vertex Indices

The set of boundary vertices $ B $ is determined by collecting all unique vertex indices from edges that have a count of one in the map $ C $:

$$ B = \{ v | (i,j) \in \text{keys}(C), C(i, j) = 1, v \in \{i, j\} \} $$

The component outputs these boundary vertex indices via the d_indices data field.

Numerical Methods and Discretization Choices:

The detection of boundary vertices is based on topological operations (edge counting), which is a discrete process. The algorithm does not involve any spatial discretization or numerical integration, as it relies solely on combinatorial analysis of mesh elements.

Role in the FEM Pipeline:

The MeshBoundaryROI component plays an auxiliary role within the broader simulation pipeline. It helps identify boundary vertices for potential use in applying boundary conditions, surface analysis, or other applications that require knowledge about mesh boundaries.

In summary, while the MeshBoundaryROI component does not directly contribute to constitutive laws, strain measures, or stress tensors, it provides a critical topological function by identifying boundary vertices based on edge connectivity.

Data Fields
NameTypeDefaultHelp
d_triangles SeqTriangles input triangles
d_quads SeqQuads input quads
d_inputROI SetIndex optional subset of the input mesh
d_indices SetIndex Index lists of the closing vertices
Methods
void init () virtual
void reinit () virtual
void doUpdate () virtual
void countEdge (int & edgeCount, PointPair & edge)
bool inROI (const PointID & index)
{
  "name": "MeshBoundaryROI",
  "namespace": "sofa::component::engine::select",
  "module": "Sofa.Component.Engine.Select",
  "include": "sofa/component/engine/select/MeshBoundaryROI.h",
  "doc": "Outputs indices of boundary vertices of a triangle/quad mesh\n\nThis class outputs indices of boundary vertices of a triangle/quad mesh\nThe boundary is detected using the number elements associated to the edges.\nAn edge is considered on the boundary if it has a unique associated element.\n@author benjamin gilles",
  "inherits": [
    "DataEngine"
  ],
  "templates": [],
  "data_fields": [
    {
      "name": "d_triangles",
      "type": "SeqTriangles",
      "xmlname": "triangles",
      "help": "input triangles"
    },
    {
      "name": "d_quads",
      "type": "SeqQuads",
      "xmlname": "quads",
      "help": "input quads"
    },
    {
      "name": "d_inputROI",
      "type": "SetIndex",
      "xmlname": "inputROI",
      "help": "optional subset of the input mesh"
    },
    {
      "name": "d_indices",
      "type": "SetIndex",
      "xmlname": "indices",
      "help": "Index lists of the closing vertices"
    }
  ],
  "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"
    },
    {
      "name": "countEdge",
      "return_type": "void",
      "params": [
        {
          "name": "edgeCount",
          "type": "int &"
        },
        {
          "name": "edge",
          "type": "PointPair &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "inROI",
      "return_type": "bool",
      "params": [
        {
          "name": "index",
          "type": "const PointID &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `MeshBoundaryROI` component in SOFA is designed to output the indices of boundary vertices for triangle or quad meshes. It detects mesh boundaries by counting the number of elements associated with each edge, considering an edge as part of the boundary if it is uniquely connected to one element.\n\n### Role and Purpose:\nThe primary role of `MeshBoundaryROI` is to identify boundary vertices in a given mesh topology. This information can be crucial for various simulation tasks that require knowledge about mesh boundaries, such as applying boundary conditions or analyzing surface properties.\n\n### Interactions with Other Components:\n- **Inputs:** The component accepts inputs through the `d_triangles`, `d_quads`, and `d_inputROI` data fields. It can use either triangles or quads to define the mesh topology, and an optional subset of vertices (`d_inputROI`) can be specified.\n- **Outputs:** The primary output is the set of indices of boundary vertices via the `d_indices` field.\n\n### Practical Usage Guidance:\nThe component automatically searches for a `BaseMeshTopology` in its context if no specific topology data (triangles or quads) are provided. It processes both triangles and quads to determine the boundaries based on their edge connectivity. The optional region of interest (`d_inputROI`) allows specifying which vertices should be considered for boundary detection.\n\n### Data Fields:\n- **`d_triangles`:** Specifies the input triangle elements of the mesh.\n- **`d_quads`:** Specifies the input quad elements of the mesh.\n- **`d_inputROI`:** An optional subset of vertices to consider for boundary detection.\n- **`d_indices`:** Outputs the indices of identified boundary vertices.",
  "maths": "The **MeshBoundaryROI** component in the SOFA framework identifies boundary vertices for triangle or quad meshes. It operates on the principle that an edge is considered part of the boundary if it is associated with a single element (triangle or quad). This approach leverages topological properties to determine boundary vertices without involving constitutive laws, strain measures, or stress tensors directly.\n\n### Mathematical Description:\n\n#### Topology and Boundary Detection\nThe component processes mesh elements defined by triangles and quads. Let \\( T \\) be the set of triangle indices, and \\( Q \\) be the set of quad indices. Each element in these sets is represented as a sequence of vertex indices.\n\nAn edge can be represented as an ordered pair of vertices, \\( (i, j) \\), where \\( i \\neq j \\). The component constructs a map to count the number of elements associated with each unique edge:\n\\[\n    C: \\{ (i,j) | i < j, \text{i and j are vertices} \\} \\rightarrow \\mathbb{Z}\n\\]\nwhere \\( C(i, j) \\) is the count of elements that contain edge \\((i, j)\\).\n\nFor each triangle \\( t = (t_0, t_1, t_2) \\in T \\):\n- Increment \\( C(t_0, t_1) \\), \\( C(t_1, t_2) \\), and \\( C(t_2, t_0) \\).\n\nFor each quad \\( q = (q_0, q_1, q_2, q_3) \\in Q \\):\n- Increment \\( C(q_0, q_1) \\), \\( C(q_1, q_2) \\), \\( C(q_2, q_3) \\), and \\( C(q_3, q_0) \\).\n\nAn edge \\((i,j)\\) is considered to be on the boundary if:\n\\[\n    C(i, j) = 1\n\\]\n\n#### Boundary Vertex Indices\nThe set of boundary vertices \\( B \\) is determined by collecting all unique vertex indices from edges that have a count of one in the map \\( C \\):\n\\[\n    B = \\{ v | (i,j) \\in \\text{keys}(C), C(i, j) = 1, v \\in \\{i, j\\} \\}\n\\]\n\nThe component outputs these boundary vertex indices via the `d_indices` data field.\n\n### Numerical Methods and Discretization Choices:\nThe detection of boundary vertices is based on topological operations (edge counting), which is a discrete process. The algorithm does not involve any spatial discretization or numerical integration, as it relies solely on combinatorial analysis of mesh elements.\n\n### Role in the FEM Pipeline:\nThe **MeshBoundaryROI** component plays an auxiliary role within the broader simulation pipeline. It helps identify boundary vertices for potential use in applying boundary conditions, surface analysis, or other applications that require knowledge about mesh boundaries.\n\nIn summary, while the **MeshBoundaryROI** component does not directly contribute to constitutive laws, strain measures, or stress tensors, it provides a critical topological function by identifying boundary vertices based on edge connectivity.",
  "abstract": "The `MeshBoundaryROI` component identifies boundary vertices in triangle/quad meshes by counting the number of elements associated with each edge.",
  "sheet": "# MeshBoundaryROI\n\n**Overview:**\n\nThe `MeshBoundaryROI` component is an engine that outputs indices of boundary vertices for triangle or quad meshes. It detects mesh boundaries by counting the number of elements associated with each edge, considering an edge as part of the boundary if it has a unique element association.\n\n**Parameters and Data:*\n\n- **d_triangles:** Specifies the input triangle elements of the mesh.\n- **d_quads:** Specifies the input quad elements of the mesh.\n- **d_inputROI:** An optional subset of vertices to consider for boundary detection.\n- **d_indices:** Outputs the indices of identified boundary vertices.\n\n**Dependencies and Connections:*\n\nThe component requires inputs through the `d_triangles`, `d_quads`, and optionally `d_inputROI` data fields. It outputs the set of indices of boundary vertices via the `d_indices` field."
}