4.3.7 Mesh Generation

ViennaMini utilizes the mesh generation and adaptation facilities of ViennaMesh, providing a unified interface to several meshing kernels. For instance, in the following a mesh is generated from an input geometry using the Netgen kernel.

1algorithm_handle mesher=algorithm_handle(new netgen::algorithm()); 
2mesher->set_input("cell_size", 0.1); 
3mesher->set_input("delaunay" , true); 
4mesher->set_input("default"  , input_geometry); 
5mesher->run();

The Netgen kernel is instantiated (Line 1), meshing parameters are set in a unified manner (Lines 2-4). The cell_size parameter indicates the maximum size of a mesh element, which’s meaning depends on the meshing backend. For example, CGAL relates the size parameter to the circumradius of a tetrahedron, Tetgen maps it to the volume of a tetrahedron, whereas Triangle interprets it as the area of a triangle. Consequently, the cell_size parameter stores a value without an associated physical unit due to the polymorphic nature. In this case the mesh element is abstractly referred to as a cell3 . The size of a mesh element is a typical basic parameter of mesh generation tools, as it provides a convenient method to guide the general resolution of the mesh. The delaunay parameter indicates a quality criterion, i.e., whether the mesh conforms to the Delaunay property [54]. This is a most common flag which is usually supported by all mesh generation tools for the field of CSE. Obviously not all mesh generation tools provide the same set of meshing properties, as, for instance, some tools provide different meshing algorithms, such as Triangle [62]. However, as already indicated most fundamental parameters, such as the cell size and the Delaunay property are potentially supported by the majority of tools and can thus be set in a unified manner, as depicted in the previous code sample. The default property indicates the input geometry object which must be discretized by the meshing tool. Finally, the meshing algorithm is executed (Line 5). Note that changing the meshing kernel to, for instance, Tetgen, solely requires to change the corresponding algorithm in Line 1 accordingly.

Generating meshes is used in the device template mechanism, where a customized device geometry has to be meshed.