diff --git a/contrib/Tetgen1.5/example.poly b/contrib/Tetgen1.5/example.poly index d49c54cfb0cacae4f491a85e64c23499f5d7d740..9394d8dbbbca0d27498645e0926ee1737be161f7 100644 --- a/contrib/Tetgen1.5/example.poly +++ b/contrib/Tetgen1.5/example.poly @@ -8,7 +8,7 @@ # # Part 1 - node list -54 3 0 0 +56 3 0 0 1 -13.716000000000001 -5.0800000000000001 0 2 -13.716000000000001 5.0800000000000001 0 3 -11.43 5.0800000000000001 0 @@ -64,9 +64,12 @@ 53 11.43 5.0800000000000001 -13.715999999999999 54 -11.43 5.0800000000000001 -13.715999999999999 +55 -6.6628777242868491 -0.9950764223207208 -6.66287772428685 +56 4.2067426959563958 0.1964514680670118 -5.7864151699132815 + # Part 2 - facet list -29 1 -1 0 1 +30 1 +1 0 2 14 1 2 3 6 5 4 42 31 7 10 9 8 21 32 1 0 1 7 9 10 15 14 13 12 11 @@ -82,7 +85,7 @@ 4 14 15 20 19 1 0 1 4 10 7 20 15 -1 0 1 +1 0 3 18 7 31 30 29 28 27 26 25 24 23 22 21 8 16 17 18 19 20 1 0 1 4 21 22 33 32 @@ -116,7 +119,7 @@ 4 47 48 49 50 1 0 1 8 3 2 47 50 54 53 46 45 -1 0 1 +1 0 4 17 42 4 52 51 49 48 1 32 33 34 35 36 37 38 39 40 41 1 0 1 4 2 1 48 47 @@ -125,6 +128,10 @@ 1 0 1 4 54 51 52 53 +# The following facet is a single segment with marker -1 +1 0 -1 +2 55 56 + # Part 3 - hole list 0 diff --git a/contrib/Tetgen1.5/tetgen.cxx b/contrib/Tetgen1.5/tetgen.cxx index 24d231329a9f44a22f60b8787e49fde29894bb5e..062f9bad9cbde250486765b9ba7b3b4e51183227 100644 --- a/contrib/Tetgen1.5/tetgen.cxx +++ b/contrib/Tetgen1.5/tetgen.cxx @@ -17031,6 +17031,7 @@ bool tetgenmesh::formcavity(triface* searchtet, arraypool* missingshs, if (b->verbose > 2) { printf(" Form the cavity of missing region.\n"); } + missingsubfacecount += missingshs->objects; // Mark this edge to avoid testing it later. markedge(*searchtet); crossedges->newindex((void **) &parytet); @@ -17237,6 +17238,7 @@ bool tetgenmesh::formcavity(triface* searchtet, arraypool* missingshs, printf(" Formed cavity: %ld (%ld) cross tets (edges).\n", crosstets->objects, crossedges->objects); } + crossingtetcount += crosstets->objects; // Unmark all marked edges. for (i = 0; i < crossedges->objects; i++) { @@ -24331,7 +24333,7 @@ void tetgenmesh::reconstructmesh() // Subfaces will be inserted into the mesh. if (in->trifacelist != NULL) { - // The boundary faces are given. Insert them. + // A .face file is given. It may contain boundary faces. Insert them. for (i = 0; i < in->numberoftrifaces; i++) { // Is it a subface? if (in->trifacemarkerlist != NULL) { @@ -24406,8 +24408,9 @@ void tetgenmesh::reconstructmesh() } // if (bondflag) } // if (marker > 0) } // i - } else { - // No input boundary faces. Indentify subfaces from the mesh. + } // if (in->trifacelist) + + // Indentify subfaces from the mesh. // Create subfaces for hull faces (if they're not subface yet) and // interior faces which separate two different materials. eextras = in->numberoftetrahedronattributes; @@ -24452,7 +24455,6 @@ void tetgenmesh::reconstructmesh() } tetloop.tet = tetrahedrontraverse(); } - } // if (!in->trifacelist) // Connect subfaces together. subfaces->traversalinit(); @@ -24492,7 +24494,7 @@ void tetgenmesh::reconstructmesh() // Segments will be introudced. if (in->edgelist != NULL) { - // There are edges given. Insert segments. + // A .edge file is given. It may contain boundary edges. Insert them. for (i = 0; i < in->numberofedges; i++) { // Is it a segment? if (in->edgemarkerlist != NULL) { @@ -24550,7 +24552,8 @@ void tetgenmesh::reconstructmesh() } } // if (marker != 0) } // i - } else { + } // if (in->edgelist) + // Identify segments from the mesh. // Create segments for non-manifold edges (which are shared by more // than two subfaces), and for non-coplanar edges, i.e., two subfaces @@ -24623,7 +24626,6 @@ void tetgenmesh::reconstructmesh() } subloop.sh = shellfacetraverse(subfaces); } - } // if (!in->edgelist) // Remember the number of input segments. insegments = subsegs->items; @@ -27152,13 +27154,16 @@ void tetgenmesh::recoverdelaunay() // Queue new faces for flips. for (j = 0; j < cavetetlist->objects; j++) { parytet = (triface *) fastlookup(cavetetlist, j); - for (parytet->ver = 0; parytet->ver < 4; parytet->ver++) { - // Avoid queue a face twice. - fsym(*parytet, neightet); - if (!facemarked(neightet)) { - flippush(flipstack, parytet); - } - } // parytet->ver + // A queued new tet may be dead. + if (!isdeadtet(*parytet)) { + for (parytet->ver = 0; parytet->ver < 4; parytet->ver++) { + // Avoid queue a face twice. + fsym(*parytet, neightet); + if (!facemarked(neightet)) { + flippush(flipstack, parytet); + } + } // parytet->ver + } } // j cavetetlist->restart(); // Remove locally non-Delaunay faces. New non-Delaunay edges @@ -27386,7 +27391,7 @@ long tetgenmesh::improvequalitybyflips() } } } // i - if (!remflag > 0) { + if (!remflag) { // An unremoved bad tet. Queue it again. unflipqueue->newindex((void **) &parybface); *parybface = *bface; diff --git a/contrib/Tetgen1.5/tetgen.h b/contrib/Tetgen1.5/tetgen.h index 848af504f1aac8644ad9d6d490fca086d257030b..41634d03f49ee9d805eb18e5511c672f8d23478a 100644 --- a/contrib/Tetgen1.5/tetgen.h +++ b/contrib/Tetgen1.5/tetgen.h @@ -1393,7 +1393,7 @@ public: long maxbowatcavsize, totalbowatcavsize, totaldeadtets; long triedgcount, triedgcopcount; long across_face_count, across_edge_count, across_max_count; - long fillregioncount; + long fillregioncount, missingsubfacecount, crossingtetcount; long cavitycount, cavityexpcount, maxcavsize, maxregionsize; long maxcrossfacecount, maxflipsequence; long dbg_ignore_facecount, dbg_unflip_facecount; @@ -2006,7 +2006,7 @@ public: maxbowatcavsize = totalbowatcavsize = totaldeadtets = 0l; triedgcount = triedgcopcount = 0l; across_face_count = across_edge_count = across_max_count = 0l; - fillregioncount = 0l; + fillregioncount = missingsubfacecount = crossingtetcount = 0l; cavitycount = cavityexpcount = 0l; maxcavsize = maxregionsize = 0l; maxcrossfacecount = maxflipsequence = 0l;