# GTMesh: A Highly Efficient C++ Template Library for Numerical Schemes on General Topology Meshes
## 2 Geometry and Topology of Unstructured Meshes  
The following definitions are motivated by meshing computational domains for the purpose of finite volume schemes. For an arbitrary set, \(S\subset\mathbb{R}^{d}\), denoted by \(m(S)\), the \(d\)-dimensional Lebesgue measure of \(S\), and by \(\hat{m}(S)\), the \((d-1)\)-dimensional Hausdorff measure of \(S\). Definition 1: Let the spatial domain \(\Omega\) be a bounded polytope in \(\mathbb{R}^{d}\), \(d\in\mathbb{N}\). Let \(\mathscr{T}\) be a set of polytopal cells, and denote by \(\mathscr{E}\) the set of all faces that constitute the boundaries of all elements of \(\mathscr{T}\). \(\mathscr{T}\) is called a \(d\)-dimensional conforming mesh on \(\Omega\), if the following properties are satisfied:  
1. \(\overline{\bigcup_{K\in\mathscr{T}}K}=\Omega\). 2. \((\forall K\in\mathscr{T})(\exists\mathscr{E}_{K}\subset\mathscr{E})\big{(} \partial K=\bigcup_{\
u\in\mathscr{E}_{K}}\varphi\big{)}\). 3. \((\forall K,L\in\mathscr{T})(K\
eq L\implies(\hat{m}(\bar{K}\cap L)=0\vee( \exists\sigma\in\mathscr{E})(\sigma=\bar{K}\cap L)))\). Next, we introduce the notation for the sets of _elements_ of different dimensions that form the geometry of the mesh. For example, in a 3D mesh, the boundaries of the 3D cells consist of 2D faces, which in turn represent flat surfaces bounded by 1D edges, which in turn span between their two 0D vertices. In order to avoid confusion with the notion of element in FEM, these objects are also called _entities_[27]. Definition 2: Let \(\mathscr{T}\) be a \(d\)-dimensional mesh, where \(d\in\mathbb{N}\). The set of elements of dimension \(k\in\{0,1,\ldots,d\}\) is denoted by \(\mathscr{T}^{k}\). \(N^{k}_{\mathscr{T}}=\left\lvert\mathscr{T}^{k}\right\rvert\) is the number of elements of dimension \(k\) in \(\mathscr{T}\). Finally, the complete system of geometrical elements is defined as  
\[\mathscr{T}^{*}=\bigcup_{k=0}^{d}\mathscr{T}^{k}.\]  
By Definition 2, we have \(\mathscr{E}=\mathscr{T}^{d-1}\). In terms of the mutual inclusion of elements of various dimensions, we define the relation of connection on \(\mathscr{T}^{*}\):  
Definition 3: \(e,f\in\mathscr{T}^{*}\) are connected \(\iff\big{(}e\subset\bar{f}\lor f\subset\bar{e}\big{)}\). An example of mesh connections can be seen in Figure 1.  
In a similar intuitive way, the neighborhood of elements is defined:  
Definition 4: Let \(e\in\mathscr{T}^{*}\). Then, the neighborhood of \(e\) is defined as  
\[N(e)=\big{\{}e^{\prime}\in\mathscr{T}^{*}\big{|}e^{\prime}\text{ is connected to }e\big{\}}.\]  
Figure 1: Example of connections in a simple 2D mesh. Vertices connected to element \(c_{1}\) are \(\{v_{3},v_{2},v_{4}\}\). The cells connected to element \(v_{1}\) are \(\{c_{1},c_{2}\}\). _Moreover, we denote the subset of the connected elements with the given dimension \(k\in\{0,1,\ldots,d\}\) as_  
\[N^{k}(e)=N(e)\cap\mathcal{T}^{k}.\]  
_Graph Description of a General Topology Mesh_  
All connections in the mesh can be represented by means of a graph \(G_{\mathcal{T}^{*}}=(V_{\mathcal{T}^{*}},E_{\mathcal{T}^{*}})\), where the vertices of the graph match the  
where \(\mathbb{A}_{G_{\mathcal{G}^{*}}}^{d_{1},d_{2}}\in\mathbb{R}^{N_{\mathcal{G}}^{d_{1} }\times N_{\mathcal{G}}^{d_{2}}}\). The connection matrix is a rectangular block of \(A_{G_{\mathcal{G}^{*}}}\). The primary aim of the data structure representing any unstructured mesh is to store all connections of the elements in the mesh. Equivalently, it must contain enough information for the reconstruction of the whole \(G_{\mathcal{G}^{*}}\). The graph is fully described by its adjacency matrix. Due to certain properties of the adjacency matrix of \(G_{\mathcal{G}^{*}}\), it is possible to reduce the amount of connections stored.