MeshTrianLoader
Specific mesh loader for trian (only triangulations) file format. Cette classe permet la fabrication d'un visuel pour un fichier de type trian ces fichiers se presentent de la maniere suivante nombre de sommets liste des coordonnees des sommets ex 1.45 1.25 6.85 nombre de faces liste de toutes les faces ex 1 2 3 0 0 0 les 3 derniers chiffres ne sont pas utilises pour le moment
The `MeshTrianLoader` loads triangulated meshes from trian files into SOFA's simulation environment, supporting both 'trian' and 'trian2' formats.
- module
- Sofa.Component.IO.Mesh
- namespace
- sofa::component::io::mesh
- include
- sofa/component/io/mesh/MeshTrianLoader.h
- inherits
-
- MeshLoader
- description
The MeshTrianLoader component in the SOFA framework is designed to handle mesh files in the trian format, which represents triangulations. This loader supports two specific formats: 'trian' (default) and 'trian2', selected via a boolean flag (d_trian2). The primary function of this component is to load vertex coordinates and triangle indices from these file formats into SOFA's simulation environment for further processing or visualization.
Governing Equations and Operators
-
Positions: Vertex coordinates are loaded as position vectors $\mathbf{p}_i = (x_i, y_i, z_i)$, where $i$ ranges over the total number of vertices. These positions define the geometry of the mesh.
-
Triangles: Triangle indices are stored as sets of three vertex indices $(i_1, i_2, i_3)$. Each triangle is defined by its vertices and is used to construct the connectivity between nodes in the FEM discretization process.
Constitutive or Kinematic Laws Involved
-
Vertex Coordinates: The positions are directly read from the file without any modification. They form the basis for defining elements (triangles) in a finite element mesh, where each vertex $i$ has coordinates $(x_i, y_i, z_i)$.
-
Normals (for trian2 format): Normal vectors are also loaded as part of the
trian2format and can be used for rendering or shading purposes.
Role in the Global FEM Pipeline
-
Mesh Loading: This component is primarily responsible for reading and storing vertex coordinates and triangle indices, which are essential for mesh generation. The positions are stored in
d_positions, while triangle indices are stored ind_triangles. -
Data Storage: It stores additional metadata such as boundary edges (
d_edgesOnBorder) and triangles (d_trianglesOnBorderList). These pieces of information can be used for various purposes, including boundary condition application or geometric analysis.
Numerical Methods or Discretization Choices
-
File Parsing: The component parses the trian file format by reading vertex coordinates and triangle indices. For
trian2, it additionally reads normal vectors. -
Mesh Data Structure: It organizes data into positions (
d_positions), triangles (d_triangles), normals (d_normals), and boundary information (d_edgesOnBorder,d_trianglesOnBorderList).
Integration in the Variational / Lagrangian Mechanics Framework
The MeshTrianLoader component itself does not directly contribute to the variational or Lagrangian mechanics framework as it is primarily focused on mesh loading. However, the data it loads (vertex positions and triangle indices) are fundamental inputs for defining finite element meshes which subsequently form the basis of any FEM simulation.
Summary
The MeshTrianLoader component in SOFA provides a specialized mechanism to load triangulated meshes from trian files into the framework. It supports two file formats (trian and trian2) and stores vertex positions, triangle indices, normals (for trian2), and boundary information. This data is essential for further processing in FEM simulations within SOFA.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_trian2 |
bool | |
Set to true if the mesh is a trian2 format. |
Methods
bool
doLoad
()
virtual
void
doClearBuffers
()
virtual
bool
readTrian
(const char * filename)
bool
readTrian2
(const char * filename)
{
"name": "MeshTrianLoader",
"namespace": "sofa::component::io::mesh",
"module": "Sofa.Component.IO.Mesh",
"include": "sofa/component/io/mesh/MeshTrianLoader.h",
"doc": "Specific mesh loader for trian (only triangulations) file format.\n\nCette classe permet la fabrication d'un visuel pour un fichier de type trian\nces fichiers se presentent de la maniere suivante\nnombre de sommets\nliste des coordonnees des sommets ex 1.45 1.25 6.85\nnombre de faces\nliste de toutes les faces ex 1 2 3 0 0 0 les 3 derniers chiffres ne sont pas utilises pour le moment",
"inherits": [
"MeshLoader"
],
"templates": [],
"data_fields": [
{
"name": "d_trian2",
"type": "bool",
"xmlname": "trian2",
"help": "Set to true if the mesh is a trian2 format."
}
],
"links": [],
"methods": [
{
"name": "doLoad",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "doClearBuffers",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "readTrian",
"return_type": "bool",
"params": [
{
"name": "filename",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "readTrian2",
"return_type": "bool",
"params": [
{
"name": "filename",
"type": "const char *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
],
"description": "The `MeshTrianLoader` is a specific mesh loader in the SOFA framework, designed to handle files in the trian file format, which represents triangulations. It inherits from the base class `MeshLoader`. The primary purpose of `MeshTrianLoader` is to load and parse trian files into visual representations suitable for simulation and visualization within SOFA.\n\nThis loader supports two formats: 'trian' (default) and 'trian2', selected via the boolean data field `d_trian2`. It reads vertex coordinates, triangle indices, normals (for `trian2`), and additional metadata such as boundary edges and triangles. The loaded mesh is organized into positions, triangles, and optional normal vectors.\n\nThe component interacts with other SOFA components through its inherited methods (`doLoad`, `doClearBuffers`) and data fields like `d_positions`, `d_normals`, and `d_triangles`. These fields are used to store the parsed vertex coordinates and triangle indices. The `readTrian` and `readTrian2` methods handle the file parsing for each format.\n\nPractical usage involves setting up the component with the appropriate filename and optionally specifying the `trian2` format using the `d_trian2` data field.",
"maths": "The `MeshTrianLoader` component in the SOFA framework is designed to handle mesh files in the trian format, which represents triangulations. This loader supports two specific formats: 'trian' (default) and 'trian2', selected via a boolean flag (`d_trian2`). The primary function of this component is to load vertex coordinates and triangle indices from these file formats into SOFA's simulation environment for further processing or visualization.\n\n### Governing Equations and Operators\n- **Positions**: Vertex coordinates are loaded as position vectors \\(\\mathbf{p}_i = (x_i, y_i, z_i)\\), where \\(i\\) ranges over the total number of vertices. These positions define the geometry of the mesh.\n \n- **Triangles**: Triangle indices are stored as sets of three vertex indices \\((i_1, i_2, i_3)\\). Each triangle is defined by its vertices and is used to construct the connectivity between nodes in the FEM discretization process.\n\n### Constitutive or Kinematic Laws Involved\n- **Vertex Coordinates**: The positions are directly read from the file without any modification. They form the basis for defining elements (triangles) in a finite element mesh, where each vertex \\(i\\) has coordinates \\((x_i, y_i, z_i)\\).\n \n- **Normals** (for trian2 format): Normal vectors are also loaded as part of the `trian2` format and can be used for rendering or shading purposes.\n\n### Role in the Global FEM Pipeline\n- **Mesh Loading**: This component is primarily responsible for reading and storing vertex coordinates and triangle indices, which are essential for mesh generation. The positions are stored in `d_positions`, while triangle indices are stored in `d_triangles`.\n \n- **Data Storage**: It stores additional metadata such as boundary edges (`d_edgesOnBorder`) and triangles (`d_trianglesOnBorderList`). These pieces of information can be used for various purposes, including boundary condition application or geometric analysis.\n\n### Numerical Methods or Discretization Choices\n- **File Parsing**: The component parses the trian file format by reading vertex coordinates and triangle indices. For `trian2`, it additionally reads normal vectors.\n \n- **Mesh Data Structure**: It organizes data into positions (`d_positions`), triangles (`d_triangles`), normals (`d_normals`), and boundary information (`d_edgesOnBorder`, `d_trianglesOnBorderList`).\n\n### Integration in the Variational / Lagrangian Mechanics Framework\nThe `MeshTrianLoader` component itself does not directly contribute to the variational or Lagrangian mechanics framework as it is primarily focused on mesh loading. However, the data it loads (vertex positions and triangle indices) are fundamental inputs for defining finite element meshes which subsequently form the basis of any FEM simulation.\n\n### Summary\nThe `MeshTrianLoader` component in SOFA provides a specialized mechanism to load triangulated meshes from trian files into the framework. It supports two file formats (`trian` and `trian2`) and stores vertex positions, triangle indices, normals (for `trian2`), and boundary information. This data is essential for further processing in FEM simulations within SOFA.",
"abstract": "The `MeshTrianLoader` loads triangulated meshes from trian files into SOFA's simulation environment, supporting both 'trian' and 'trian2' formats.",
"sheet": "# MeshTrianLoader\n\n## Overview\nThe `MeshTrianLoader` is a specialized mesh loader component in the SOFA framework designed to handle files in the trian format. It inherits from the base class `MeshLoader`, providing functionality to load vertex coordinates and triangle indices into SOFA for further processing or visualization.\n\n## Parameters and Data\n- **d_trian2**: A boolean parameter (`bool`) that specifies whether the mesh is in 'trian2' format (default: false). This field controls the file parsing method used by `MeshTrianLoader`.\n\n## Dependencies and Connections\nThe `MeshTrianLoader` interacts with other SOFA components through its inherited methods such as `doLoad`, `doClearBuffers`, and data fields like `d_positions`, `d_normals`, and `d_triangles`. These fields store the parsed vertex coordinates, triangle indices, and normal vectors (for 'trian2' format)."
}