Tetgen a Quality Tetrahedral Mesh Generator and Three-Dimensional Delaunay Triangulator
Total Page:16
File Type:pdf, Size:1020Kb
TetGen A Quality Tetrahedral Mesh Generator and Three-Dimensional Delaunay Triangulator Version 1.4 User’s Manual January 18, 2006 Hang Si [email protected] http://tetgen.berlios.de c 2002, 2004, 2005, 2006 Abstract TetGen generates tetrahedral meshes and Delaunay tetrahedral- izations. The tetrahedral meshes are suitable for finite element and finite volume methods. The algorithms implemented are the state of the art. This documents briefly explains the problems solved by TetGen and is a detailed user’s guide. Readers will learn how to create tetra- hedral meshes using input files from the command line. Furthermore, the programming interface for calling TetGen from other programs is explained. keywords: tetrahedral mesh, Delaunay tetrahedralization, con- strained Delaunay tetrahedralization, mesh quality, mesh generation 2 Contents 1 Introduction 5 1.1DelaunayTriangulationandTheConvexHull......... 5 1.2ConstrainedDelaunayTetrahedralization............ 8 1.2.1 Piecewise Linear Complex . ............. 12 1.3QualityTetrahedralMesh.................... 13 1.3.1 TheRadius-EdgeRatioQualityMeasure........ 14 2 Getting Started 16 2.1Compilation............................ 16 2.1.1 Unix/Linux........................ 16 2.1.2 Windows 9x/NT/2000/XP . ............. 17 2.2Testing............................... 17 2.3Visualization........................... 20 2.3.1 TetView.......................... 20 2.3.2 OtherMeshViewers................... 21 3UsingTetGen 22 3.1CommandLineSyntax...................... 22 3.2CommandLineSwitches..................... 22 3.2.1 -pTetrahedralizesaPLC................. 24 3.2.2 -qQualitymeshgeneration............... 24 3.2.3 -aImposesvolumeconstraints.............. 25 3.2.4 -A Assigns region attributes . ............. 25 3.2.5 -rReconstructs/refinesamesh.............. 25 3.2.6 -iInsertsadditionalpoints................ 26 3.2.7 -TSetsatolerance.................... 27 3.2.8 -Y Prohibit Steiner Points on Boundary ........ 27 3.2.9 OtherSwitches...................... 27 3.3CommandLineExamples.................... 28 3.3.1 GenerateDelaunaytetrahedralizations......... 28 3.3.2 Generate Constrained Delaunay tetrahedralizations . 28 3.3.3 MeshQuality,MeshSizeControl............ 29 4 File Formats 31 4.1TetGenFileFormats....................... 31 4.1.1 .nodefiles......................... 31 4.1.2 .polyfiles......................... 32 4.1.3 .smeshfiles........................ 36 4.1.4 .elefiles.......................... 37 3 4.1.5 .facefiles.......................... 38 4.1.6 .edgefiles......................... 38 4.1.7 .volfiles.......................... 39 4.1.8 .varfiles.......................... 39 4.1.9 .neighfiles......................... 40 4.2 Supported File Formats ..................... 40 4.2.1 .offfiles.......................... 41 4.2.2 .plyfiles.......................... 41 4.2.3 .stlfiles.......................... 41 4.2.4 .meshfiles......................... 42 4.3FileFormatExamples...................... 42 4.3.1 A PLC with Two Boundary Markers .......... 42 4.3.2 APLCwithTwoRegions................ 45 5 Calling TetGen from Another Program 48 5.1TheHeaderFile.......................... 48 5.2 The Calling Convention ..................... 48 5.3The“tetgenio”DataType.................... 49 5.4DescriptionofArrays....................... 50 5.4.1 MemoryManagement................... 51 5.4.2 The“facet”DataStructure............... 52 5.5AnExample............................ 54 A Some Combinatorial Topology 58 References 59 4 1 Introduction The TetGen program generates tetrahedral meshes from three-dimensional domains. The goal is to generate suitable tetrahedral meshes for numerical simulation using finite element and finite volume methods. Besides, as a tetrahedral mesh generator, it can be used as a meshing component in many scientific and engineering applications. For a three-dimensional domain, defined by its boundary (such as a sur- face mesh), TetGen generates the boundary constrained (Delaunay) tetra- hedralization, conforming (Delaunay) tetrahedralization, quality (Delaunay) mesh. The latter is nicely graded and the tetrahedra have circumradius-to- shortest-edge ratio bounded. For a three-dimensional point set, the Delaunay tetrahedralization and convex hull are generated. The code, written in C++, may be compiled into an executable program or a library for integrating into other applications. All major operating systems, e.g. Unix/Linux, MacOS, Windows, etc, are supported. The algorithms used in TetGen are of Delaunay type. The remainder of this section is to give a brief description of the mesh problems that TetGen solves. The algorithms implemented in TetGen are described. References are given for people who are particularly interesting in these approaches. However, this information is not really crucial for all users. Most of the sections can be skipped but Section 1.2.1 and 1.3.1, which contain some important points to get a solvable problem. 1.1 Delaunay Triangulation and The Convex Hull The Delaunay triangulation of a vertex set, introduced by Delaunay [1] in 1934, has many favorable properties which make it be a useful geometric structure. It has been used extensively both in the design of efficient algo- rithms and in practical applications. The language of combinatorial topology will be used to describe Delaunay triangulations. Understanding of some basic notions is necessary, such as convex hull, simplex, simplical complex. A brief explanation of these notions is provided in Appendix A. Let V be a set of vertices, s be a k-simplex (0 ≤ k ≤ n)formedfrom vertices of V .Thecircumsphere of s is a sphere that passes through all vertices of s.Ifk = d, s has a unique circumsphere, otherwise, there are infinitely many circumspheres of s.Thesimplexs is Delaunay if there exists a circumsphere of s such that no vertex of V lies inside it. Figure 1 (a) shows Delaunay simplices in a set of two-dimensional vertices. 5 a a c c b b d d e e (a) (b) Figure 1: The Delaunay criterion and Delaunay triangulation in two dimen- sions. (a) Both the 2-simplex abc and the 1-simplex de are Delaunay. (b) The corresponding Delaunay triangulation of the point set shown in (a). The Delaunay triangulation D of V is a simplical complex consisting of Delaunay simplices, and the set of all simplices of D covers the convex hull of V . A two-dimensional Delaunay triangulation is illustrated in Figure 1 (b). In three dimensions, it is also called Delaunay tetrahedralization. A Delaunay triangulation in Rd corresponds to a convex hull in Rd+1.For d + point p =(p1,p2, ···,pd) ∈ R , define itslift point p =(p1,p2, ··· ,pd,pd+1) ∈ d+1 d 2 d + + R ,wherepd+1 = i=1 pi . For a point set V ⊂ R , define V = {p | p ∈ V }. V + is the set of points “lifted” from points of V in Rd and on a paraboloid in Rd+1 (see Figure 2 (a)). Then the convex hull con(V +)is a d + 1-dimensional convex polytope. The Delaunay triangulation of V can be produced by projecting con(V +)intod dimensions. Figure 2 illustrates the relationship when d = 2. For this reason, convex hull algorithms [18, 13] can be used to generate Delaunay triangulations. In fact, a Delaunay triangulation is one of regular triangulations,orequiv- alently weighted Delaunay triangulations [23]. Such triangulations are related to convex polytopes [20] which makes them interesting in three or higher di- mensional combinatorial structures [39]. Recent research shows that they’re effective in removing slivers in quality mesh generation [33, 34]. The Delaunay triangulation has many optimal properties. For example, among all triangulations of a set of points in R2, it maximizes the min- imum angle, and also minimizes the maximum circumradii; optimal time complexity algorithms (divide-and-conquer and plane-sweep) are known. A discussion on some optimal properties of the Delaunay triangulation in three or higher dimensions can be found in [16]. In the following, we introduce two properties which are both useful in numerical methods and the design of efficient algorithms. 6 z p+ y/1.0e-01 x/1.0e-01 p (a) (b) Figure 2: The relation between Delaunay triangulation in Rd and convex hull in Rd+1 (here d =2). (a) Some 2D points and their corresponding 3D lift points. (b) The Delaunay triangulation of a set of 2D points and the lower convex hull of its 3D lifted points. The dual of the Delaunay triangulation is the Voronoi diagram defined on the same vertex set. For any vertex a ∈ V ,theVoronoi cell of a is the set of points with distance to a not greater than to any other vertex of V , i.e. it is the set {x ∈ Rn ||x − a|≤|x − b|, ∀b ∈ V },where|·| stands for the Euclidean distance. The Voronoi diagram of V is a subdivision of space Rn into Voronoi cells (some of which may be unbounded). Delaunay triangulation and Voronoi diagram are geometrically dual. For example, in two dimensions, Voronoi polygons correspond to Delaunay vertices, Voronoi edges correspond to Delaunay edges, and Voronoi vertices correspond to De- launay triangles (illustrated in Figure 3 (a)). Another useful property is the localization of the Delaunay property. Let T be an arbitrary triangulation of V ,ands be a simplex of T .LetK be asubcomplexofT formed by simplices containing s. s is locally Delaunay if there exists a circumsphere of s enclosing no vertices from the vertex set of K in its interior. Figure 3 (b) illustrates the property in two dimensions. Evidently, if every simplex of T is locally Delaunay, then T is Delaunay triangulation. It is well known that the Delaunay triangulations can be constructed by “flips”. A flip is an operation to transform a set of