Back

Mesh

sofa::helper::io::Mesh
Abstract (AI generated)

The `Mesh` component manages mesh data by providing methods to access vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements, essential for spatial discretization in FEM simulations.

Metadata
module
Sofa.framework.Helper
namespace
sofa::helper::io
include
sofa/helper/io/Mesh.h
description

The Mesh class in the SOFA framework's sofa::helper::io namespace is designed to handle mesh data for simulations. It serves as a container and accessor for various components of the mesh, including vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements. The primary role of this component in the FEM simulation pipeline is to provide the spatial discretization required for the finite element method (FEM) analysis. This involves defining the mesh geometry through its nodal connectivity and grouping these elements into different categories to facilitate structured access to subsets of the mesh data.

The Mesh class does not directly implement governing equations or operators such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, or residual $R$. Instead, it provides the essential geometric and topological information required for these components to be derived in subsequent stages of the FEM simulation. Specifically, the mesh data is used to define the shape functions $N_i(X)$ and their derivatives $B_e$ which are critical for assembling the element matrices (e.g., mass matrix $M_e$, internal force vector $f^{e}_{int}$, and tangent stiffness matrix $K_e$).

The Mesh class interacts with other SOFA components through its API by providing methods that return references to the internal storage structures containing mesh information. These vectors can be accessed by various SOFA solvers and plugins for processing or visualization purposes.

For example:
- Vertices: $m_{vertices} = \{ extbf{x}_1, extbf{x}_2, extbf{x}_3, extdots, extbf{x}_{|V|} \}$ where $ extbf{x}_i$ represents the 3D coordinates of vertex $i$, and $|V|$ is the total number of vertices.
- Edges: $m_{edges} = \{ (v_1^e, v_2^e), extdots, (v_{|E|}^e) \}$ where each edge is represented by a tuple of vertex indices $(v_i^e)$ and $|E|$ is the total number of edges.
- Triangles: $m_{triangles} = \{ (v_1^t, v_2^t, v_3^t), extdots, (v_{|T|}^t) \}$ where each triangle is represented by a tuple of vertex indices $(v_i^t)$ and $|T|$ is the total number of triangles.
- Quads: $m_{quads} = \{ (v_1^q, v_2^q, v_3^q, v_4^q), extdots, (v_{|Q|}^q) \}$ where each quad is represented by a tuple of vertex indices $(v_i^q)$ and $|Q|$ is the total number of quads.
- Tetrahedra: $m_{tetrahedra} = \{ (v_1^{te}, v_2^{te}, v_3^{te}, v_4^{te}), extdots, (v_{|TE|}^{te}) \}$ where each tetrahedron is represented by a tuple of vertex indices $(v_i^{te})$ and $|TE|$ is the total number of tetrahedra.
- Hexahedra: $m_{hexahedra} = \{ (v_1^h, v_2^h, v_3^h, extdots, v_8^h), extdots, (v_{|H|}^h) \}$ where each hexahedron is represented by a tuple of vertex indices $(v_i^h)$ and $|H|$ is the total number of hexahedra.

Additionally, there are fields for material information and texture names. The Mesh class supports loading different types of geometric elements and their associated groups through its static factory methods which can load data from files with specified formats (loaders).

Overall, the Mesh class plays a crucial role in setting up the spatial discretization phase of the FEM simulation pipeline, providing the necessary information for subsequent stages such as assembly of element operators, nonlinear solution, and linear solve.

Methods
int & getVertices ()
int & getEdges ()
int & getTriangles ()
int & getQuads ()
int & getTetrahedra ()
int & getHexahedra ()
int & getTexCoords ()
int & getNormals ()
int & getFacets ()
const int & getEdgesGroups ()
const int & getTrianglesGroups ()
const int & getQuadsGroups ()
const int & getPolygonsGroups ()
const int & getTetrahedraGroups ()
const int & getHexahedraGroups ()
const int & getPrismsGroups ()
const int & getPyramidsGroups ()
const int & getHighOrderEdgePositions ()
const int & getHighOrderTrianglePositions ()
const int & getHighOrderQuadPositions ()
const Material & getMaterial ()
const int & getMaterials ()
const int & getGroups ()
int & getTextureName ()
Mesh * Create (const int & filename)
Mesh * Create (const int & loader, const int & filename)
{
  "name": "Mesh",
  "namespace": "sofa::helper::io",
  "module": "Sofa.framework.Helper",
  "include": "sofa/helper/io/Mesh.h",
  "doc": "",
  "inherits": [],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "getVertices",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getEdges",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTriangles",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getQuads",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTetrahedra",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHexahedra",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTexCoords",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getNormals",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getFacets",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getEdgesGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTrianglesGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getQuadsGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getPolygonsGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTetrahedraGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHexahedraGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getPrismsGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getPyramidsGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHighOrderEdgePositions",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHighOrderTrianglePositions",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHighOrderQuadPositions",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMaterial",
      "return_type": "const Material &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMaterials",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getGroups",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTextureName",
      "return_type": "int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "Create",
      "return_type": "Mesh *",
      "params": [
        {
          "name": "filename",
          "type": "const int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "Create",
      "return_type": "Mesh *",
      "params": [
        {
          "name": "loader",
          "type": "const int &"
        },
        {
          "name": "filename",
          "type": "const int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    }
  ],
  "description": "The `Mesh` class in the SOFA framework's `sofa::helper::io` namespace is designed to handle mesh data for simulations. It provides methods to access various components of the mesh, including vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements. The class also supports grouping these elements into different categories, allowing for structured access to subsets of the mesh data.\n\n`Mesh` interacts with other SOFA components through its API by providing methods that return references to the internal storage structures (vectors) containing mesh information. These vectors can be accessed by various SOFA solvers and plugins for processing or visualization purposes.\n\nPractical usage involves creating a `Mesh` instance using static factory methods, which can load data from files with specified formats (loaders). The class supports loading different types of geometric elements and their associated groups, providing flexibility in handling complex mesh structures. Methods such as `getVertices`, `getTriangles`, etc., allow retrieval of these elements for further processing or simulation.\n\nData fields include vectors storing vertex coordinates, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order element positions. Additionally, there are fields for material information and texture names.",
  "maths": "The `Mesh` class in the SOFA framework's `sofa::helper::io` namespace is designed to handle mesh data for simulations. It serves as a container and accessor for various components of the mesh, including vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements. The primary role of this component in the FEM simulation pipeline is to provide the spatial discretization required for the finite element method (FEM) analysis. This involves defining the mesh geometry through its nodal connectivity and grouping these elements into different categories to facilitate structured access to subsets of the mesh data.\n\nThe `Mesh` class does not directly implement governing equations or operators such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, or residual $R$. Instead, it provides the essential geometric and topological information required for these components to be derived in subsequent stages of the FEM simulation. Specifically, the mesh data is used to define the shape functions $N_i(X)$ and their derivatives $B_e$ which are critical for assembling the element matrices (e.g., mass matrix $M_e$, internal force vector $f^{e}_{int}$, and tangent stiffness matrix $K_e$).\n\nThe `Mesh` class interacts with other SOFA components through its API by providing methods that return references to the internal storage structures containing mesh information. These vectors can be accessed by various SOFA solvers and plugins for processing or visualization purposes.\n\nFor example:\n- **Vertices**: $m_{vertices} = \\{ \textbf{x}_1, \textbf{x}_2, \textbf{x}_3, \textdots, \textbf{x}_{|V|} \\}$ where $\textbf{x}_i$ represents the 3D coordinates of vertex $i$, and $|V|$ is the total number of vertices.\n- **Edges**: $m_{edges} = \\{ (v_1^e, v_2^e), \textdots, (v_{|E|}^e) \\}$ where each edge is represented by a tuple of vertex indices $(v_i^e)$ and $|E|$ is the total number of edges.\n- **Triangles**: $m_{triangles} = \\{ (v_1^t, v_2^t, v_3^t), \textdots, (v_{|T|}^t) \\}$ where each triangle is represented by a tuple of vertex indices $(v_i^t)$ and $|T|$ is the total number of triangles.\n- **Quads**: $m_{quads} = \\{ (v_1^q, v_2^q, v_3^q, v_4^q), \textdots, (v_{|Q|}^q) \\}$ where each quad is represented by a tuple of vertex indices $(v_i^q)$ and $|Q|$ is the total number of quads.\n- **Tetrahedra**: $m_{tetrahedra} = \\{ (v_1^{te}, v_2^{te}, v_3^{te}, v_4^{te}), \textdots, (v_{|TE|}^{te}) \\}$ where each tetrahedron is represented by a tuple of vertex indices $(v_i^{te})$ and $|TE|$ is the total number of tetrahedra.\n- **Hexahedra**: $m_{hexahedra} = \\{ (v_1^h, v_2^h, v_3^h, \textdots, v_8^h), \textdots, (v_{|H|}^h) \\}$ where each hexahedron is represented by a tuple of vertex indices $(v_i^h)$ and $|H|$ is the total number of hexahedra.\n\nAdditionally, there are fields for material information and texture names. The `Mesh` class supports loading different types of geometric elements and their associated groups through its static factory methods which can load data from files with specified formats (loaders).\n\nOverall, the `Mesh` class plays a crucial role in setting up the spatial discretization phase of the FEM simulation pipeline, providing the necessary information for subsequent stages such as assembly of element operators, nonlinear solution, and linear solve.",
  "abstract": "The `Mesh` component manages mesh data by providing methods to access vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements, essential for spatial discretization in FEM simulations.",
  "sheet": "# Mesh\n\n## Overview\nThe `Mesh` class in the SOFA framework's `sofa::helper::io` namespace is designed to handle mesh data for simulations. It provides methods to access various components of the mesh, including vertices, edges, triangles, quads, tetrahedra, hexahedra, texture coordinates, normals, and high-order elements. The class serves as a container and accessor for these geometric and topological details required for finite element method (FEM) analysis.\n\n## Parameters and Data\nThe `Mesh` class provides methods to access the following significant data fields:\n- **Vertices**: $m_{vertices} = \\{ \\mathbf{x}_1, \\mathbf{x}_2, \\mathbf{x}_3, \\dots, \\mathbf{x}_{|V|} \\}$ where $\\mathbf{x}_i$ represents the 3D coordinates of vertex $i$, and $|V|$ is the total number of vertices.\n- **Edges**: $m_{edges} = \\{ (v_1^e, v_2^e), \\dots, (v_{|E|}^e) \\}$ where each edge is represented by a tuple of vertex indices $(v_i^e)$ and $|E|$ is the total number of edges.\n- **Triangles**: $m_{triangles} = \\{ (v_1^t, v_2^t, v_3^t), \\dots, (v_{|T|}^t) \\}$ where each triangle is represented by a tuple of vertex indices $(v_i^t)$ and $|T|$ is the total number of triangles.\n- **Quads**: $m_{quads} = \\{ (v_1^q, v_2^q, v_3^q, v_4^q), \\dots, (v_{|Q|}^q) \\}$ where each quad is represented by a tuple of vertex indices $(v_i^q)$ and $|Q|$ is the total number of quads.\n- **Tetrahedra**: $m_{tetrahedra} = \\{ (v_1^{te}, v_2^{te}, v_3^{te}, v_4^{te}), \\dots, (v_{|TE|}^{te}) \\}$ where each tetrahedron is represented by a tuple of vertex indices $(v_i^{te})$ and $|TE|$ is the total number of tetrahedra.\n- **Hexahedra**: $m_{hexahedra} = \\{ (v_1^h, v_2^h, v_3^h, \\dots, v_8^h), \\dots, (v_{|H|}^h) \\}$ where each hexahedron is represented by a tuple of vertex indices $(v_i^h)$ and $|H|$ is the total number of hexahedra.\n- **Texture Coordinates**: $m_{texcoords} = \\{ (t_1, t_2), \\dots, (t_{|TC|}) \\}$ where each texture coordinate is represented by a tuple $(t_i)$ and $|TC|$ is the total number of texture coordinates.\n- **Normals**: $m_{normals} = \\{ (n_1, n_2, n_3), \\dots, (n_{|N|}) \\}$ where each normal vector is represented by a tuple $(n_i)$ and $|N|$ is the total number of normals."
}