Pre-existing codebase

I was provided with a substantial amount of pre-existing code by Vincent Chabannes, my supervisor. This codebase includes a comprehensive framework for constructing, manipulating, and exporting meshes. The key components of this framework are defined across several files, including point.hpp, mesh.hpp, mesh.cpp, meshio.hpp, and meshio.cpp.

1. Overview of the mesh framework

The relationships between the main classes involved in mesh construction and manipulation are illustrated in the following UML diagram:


uml codebase 1
Figure 1. Mesh framework class structure

At the core of this framework is the Point class, defined in point.hpp, which inherits from Eigen::Matrix. This class serves as the foundation for geometric points in the mesh. Derived from Point, the MeshPoint class represents specific points within the mesh structure.

Mesh entities are represented by classes such as MeshEdge, MeshTriangle, MeshQuadrangle, and MeshTetrahedron, which are defined in mesh.hpp and mesh.cpp. These entities are fundamental in defining the edges, faces, and volumes within the mesh.

The Mesh class acts as the container and manager of these entities, handling the overall structure, operations, and transformations applied to the terrain mesh.

Import and export functionalities, which are crucial for handling mesh data in different formats like STL and MSH, are encapsulated in classes defined in meshio.hpp and meshio.cpp. These processes are illustrated in the following UML diagram:


uml codebase 2
Figure 2. Mesh import/export workflow

2. Key components and their roles

  • MeshPoint: Represents a 3D point with coordinates (x, y, z). This class includes methods to manipulate these points, such as applying affine transformations and accessing or modifying individual coordinates.

  • MeshEdge: Represents an edge within the mesh, connecting two MeshPoint instances. This class can compute the length of the edge based on the Euclidean distance between its endpoints.

  • MeshTriangle and MeshQuadrangle: These classes represent triangular and quadrangular polygonal entities, respectively, within the mesh. They provide methods for calculating the area, managing connected edges, and determining the normal vectors for the surfaces they represent.

  • Mesh: The central class that encapsulates all mesh entities (MeshPoint, MeshEdge, MeshTriangle, MeshQuadrangle, and MeshTetrahedron). The Mesh class supports operations such as merging multiple meshes, applying transformations, and managing markers for different mesh regions. It plays a crucial role in ensuring the integrity and coherence of the mesh structure during generation and manipulation.

  • ExporterMeshGmsh: Handles the export of mesh data in the Gmsh format. This class was essential for converting the generated meshes into a format suitable for visualization and further processing, a task that was central to my work during this internship.



References