From 9b429721207e7f74cc24a24e7b3f06b167c40479 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 27 Aug 2010 08:06:57 +0000 Subject: [PATCH] * don't try to reorient discrete surfaces * don't allocate 0-sized kdtree --- Geo/MVertexPositionSet.h | 5 ++++- Mesh/meshGFace.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Geo/MVertexPositionSet.h b/Geo/MVertexPositionSet.h index 91770e913f..f912e53ddc 100644 --- a/Geo/MVertexPositionSet.h +++ b/Geo/MVertexPositionSet.h @@ -28,9 +28,10 @@ class MVertexPositionSet{ std::vector<MVertex*> &_vertices; public: MVertexPositionSet(std::vector<MVertex*> &vertices, int maxDuplicates=10) - : _vertices(vertices), _maxDuplicates(maxDuplicates) + : _kdtree(0), _maxDuplicates(maxDuplicates), _vertices(vertices) { int totpoints = vertices.size(); + if(!totpoints) return; _zeronodes = annAllocPts(totpoints, 3); for(int i = 0; i < totpoints; i++){ vertices[i]->setIndex(0); @@ -44,6 +45,7 @@ class MVertexPositionSet{ } ~MVertexPositionSet() { + if(!_kdtree) return; delete _kdtree; annDeallocPts(_zeronodes); delete [] _index; @@ -51,6 +53,7 @@ class MVertexPositionSet{ } MVertex *find(double x, double y, double z, double tolerance) { + if(!_kdtree) return 0; double xyz[3] = {x, y, z}; _kdtree->annkSearch(xyz, _maxDuplicates, _index, _dist); for(int i = 0; i < _maxDuplicates; i++){ diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 4b51ffb710..b1040e0ff7 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1795,6 +1795,7 @@ void orientMeshGFace::operator()(GFace *gf) { gf->model()->setCurrentMeshEntity(gf); + if(gf->geomType() == GEntity::DiscreteSurface) return; if(gf->geomType() == GEntity::ProjectionFace) return; if(gf->geomType() == GEntity::CompoundSurface) return; -- GitLab