diff --git a/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2DKernel.H b/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2DKernel.H index 8bbbe59920..28002f962f 100644 --- a/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2DKernel.H +++ b/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2DKernel.H @@ -36,14 +36,20 @@ Description #include "CGAL/Delaunay_triangulation_2.h" #ifdef CGAL_INEXACT + // Fast kernel using a double as the storage type but the triangulation // may fail #include "CGAL/Exact_predicates_inexact_constructions_kernel.h" + typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + #else + // Very robust but expensive kernel #include "CGAL/Exact_predicates_exact_constructions_kernel.h" + typedef CGAL::Exact_predicates_exact_constructions_kernel K; + #endif diff --git a/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2Ddefs.H b/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2Ddefs.H index 6a17732356..8731926548 100644 --- a/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2Ddefs.H +++ b/applications/utilities/mesh/generation/cv2DMesh/CGALTriangulation2Ddefs.H @@ -50,17 +50,22 @@ typedef CGAL::indexedVertex Vb; typedef CGAL::indexedFace Fb; #ifdef CGAL_HIERARCHY + // Data structures for hierarchical Delaunay triangulation which is more // efficient but also uses more storage #include "CGAL/Triangulation_hierarchy_2.h" + typedef CGAL::Triangulation_hierarchy_vertex_base_2 Vbh; typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Delaunay_triangulation_2 DT; typedef CGAL::Triangulation_hierarchy_2
Delaunay; + #else + // Data structures for standard Delaunay triangulation typedef CGAL::Triangulation_data_structure_2 Tds; typedef CGAL::Delaunay_triangulation_2 Delaunay; + #endif diff --git a/applications/utilities/mesh/generation/cv2DMesh/cv2DMesh.C b/applications/utilities/mesh/generation/cv2DMesh/cv2DMesh.C index 98ec79e102..e44a249f28 100644 --- a/applications/utilities/mesh/generation/cv2DMesh/cv2DMesh.C +++ b/applications/utilities/mesh/generation/cv2DMesh/cv2DMesh.C @@ -163,20 +163,26 @@ int main(int argc, char *argv[]) Info<< "Constructing patches." << endl; List patches(poly2DMesh.patchNames().size()); + label countPatches = 0; forAll(patches, patchI) { - patches[patchI] = new polyPatch - ( - poly2DMesh.patchNames()[patchI], - poly2DMesh.patchSizes()[patchI], - poly2DMesh.patchStarts()[patchI], - patchI, - pMesh.boundaryMesh(), - word::null - ); - } + if (poly2DMesh.patchSizes()[patchI] != 0) + { + patches[countPatches] = new polyPatch + ( + poly2DMesh.patchNames()[patchI], + poly2DMesh.patchSizes()[patchI], + poly2DMesh.patchStarts()[patchI], + countPatches, + pMesh.boundaryMesh(), + word::null + ); + countPatches++; + } + } + patches.setSize(countPatches); pMesh.addPatches(patches); if (extrude)