ENH: cv2DMesh: Do not add empty patches

This commit is contained in:
laurence
2013-01-04 12:47:56 +00:00
parent a517fbfcbe
commit 660ddd6d70
3 changed files with 27 additions and 10 deletions

View File

@ -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

View File

@ -50,17 +50,22 @@ typedef CGAL::indexedVertex<K> Vb;
typedef CGAL::indexedFace<K> 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<Vb> Vbh;
typedef CGAL::Triangulation_data_structure_2<Vbh, Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<K, Tds> DT;
typedef CGAL::Triangulation_hierarchy_2<DT> Delaunay;
#else
// Data structures for standard Delaunay triangulation
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<K, Tds> Delaunay;
#endif

View File

@ -163,20 +163,26 @@ int main(int argc, char *argv[])
Info<< "Constructing patches." << endl;
List<polyPatch*> 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)