Skip to content
Snippets Groups Projects
Commit 9b429721 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

* don't try to reorient discrete surfaces

* don't allocate 0-sized kdtree 
parent 2c2ad501
No related branches found
No related tags found
No related merge requests found
...@@ -28,9 +28,10 @@ class MVertexPositionSet{ ...@@ -28,9 +28,10 @@ class MVertexPositionSet{
std::vector<MVertex*> &_vertices; std::vector<MVertex*> &_vertices;
public: public:
MVertexPositionSet(std::vector<MVertex*> &vertices, int maxDuplicates=10) MVertexPositionSet(std::vector<MVertex*> &vertices, int maxDuplicates=10)
: _vertices(vertices), _maxDuplicates(maxDuplicates) : _kdtree(0), _maxDuplicates(maxDuplicates), _vertices(vertices)
{ {
int totpoints = vertices.size(); int totpoints = vertices.size();
if(!totpoints) return;
_zeronodes = annAllocPts(totpoints, 3); _zeronodes = annAllocPts(totpoints, 3);
for(int i = 0; i < totpoints; i++){ for(int i = 0; i < totpoints; i++){
vertices[i]->setIndex(0); vertices[i]->setIndex(0);
...@@ -44,6 +45,7 @@ class MVertexPositionSet{ ...@@ -44,6 +45,7 @@ class MVertexPositionSet{
} }
~MVertexPositionSet() ~MVertexPositionSet()
{ {
if(!_kdtree) return;
delete _kdtree; delete _kdtree;
annDeallocPts(_zeronodes); annDeallocPts(_zeronodes);
delete [] _index; delete [] _index;
...@@ -51,6 +53,7 @@ class MVertexPositionSet{ ...@@ -51,6 +53,7 @@ class MVertexPositionSet{
} }
MVertex *find(double x, double y, double z, double tolerance) MVertex *find(double x, double y, double z, double tolerance)
{ {
if(!_kdtree) return 0;
double xyz[3] = {x, y, z}; double xyz[3] = {x, y, z};
_kdtree->annkSearch(xyz, _maxDuplicates, _index, _dist); _kdtree->annkSearch(xyz, _maxDuplicates, _index, _dist);
for(int i = 0; i < _maxDuplicates; i++){ for(int i = 0; i < _maxDuplicates; i++){
......
...@@ -1795,6 +1795,7 @@ void orientMeshGFace::operator()(GFace *gf) ...@@ -1795,6 +1795,7 @@ void orientMeshGFace::operator()(GFace *gf)
{ {
gf->model()->setCurrentMeshEntity(gf); gf->model()->setCurrentMeshEntity(gf);
if(gf->geomType() == GEntity::DiscreteSurface) return;
if(gf->geomType() == GEntity::ProjectionFace) return; if(gf->geomType() == GEntity::ProjectionFace) return;
if(gf->geomType() == GEntity::CompoundSurface) return; if(gf->geomType() == GEntity::CompoundSurface) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment