diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 279945e4d300b12db67faae5af13924592d2383b..256032c68aaec3fa13f7597abdd455bb22d3ec8f 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -736,14 +736,15 @@ int GModel::getNumMeshElements(unsigned c[5]) return 0; } -MElement *GModel::getMeshElementByCoord(SPoint3 &p, int dim) +MElement *GModel::getMeshElementByCoord(SPoint3 &p, int dim, bool strict) { if(!_octree){ Msg::Debug("Rebuilding mesh element octree"); _octree = new MElementOctree(this); } - return _octree->find(p.x(), p.y(), p.z(), dim); + return _octree->find(p.x(), p.y(), p.z(), dim, strict); } + std::vector<MElement*> GModel::getMeshElementsByCoord(SPoint3 &p, int dim) { if(!_octree){ diff --git a/Geo/GModel.h b/Geo/GModel.h index 537d88bd14198d6aecf8ad2b4f1011349ddf7c8e..257f6da1f110f03ce9fe8e1386095571fe4ae48a 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -312,8 +312,8 @@ class GModel int getNumMeshElements(unsigned c[5]); // access a mesh element by coordinates (using an octree search) - MElement *getMeshElementByCoord(SPoint3 &p, int dim = -1); - std::vector<MElement*> getMeshElementsByCoord(SPoint3 &p, int dim = -1); + MElement *getMeshElementByCoord(SPoint3 &p, int dim=-1, bool strict=true); + std::vector<MElement*> getMeshElementsByCoord(SPoint3 &p, int dim=-1); // access a mesh element by tag, using the element cache MElement *getMeshElementByTag(int n); @@ -487,7 +487,7 @@ class GModel std::vector<int> &elementary, std::vector<int> &partition); - // for elements cut having new vertices + // for elements cut having new vertices void store(std::vector<MVertex*> &vertices, int dim, std::map<int, std::vector<MElement*> > &entityMap, std::map<int, std::map<int, std::string> > &physicalMap); diff --git a/Geo/MElementOctree.cpp b/Geo/MElementOctree.cpp index fc72e0056637fb6d5e5d952b1d8942791fdabf28..c7e6a94ce84b69024f70665c2cb9cab2acbe35ab 100644 --- a/Geo/MElementOctree.cpp +++ b/Geo/MElementOctree.cpp @@ -158,7 +158,7 @@ MElement *MElementOctree::find(double x, double y, double z, int dim, bool stric double tol = initialTol; while (tol < 1){ tol *= 10; - MElement::setTolerance(tol); + MElement::setTolerance(tol); std::vector<GEntity*> entities; _gm->getEntities(entities); for(unsigned int i = 0; i < entities.size(); i++){ @@ -168,12 +168,13 @@ MElement *MElementOctree::find(double x, double y, double z, int dim, bool stric if (MElementInEle(e, P)){ MElement::setTolerance(initialTol); return e; - } + } } } } } MElement::setTolerance(initialTol); Msg::Warning("Point %g %g %g not found",x,y,z); - } return NULL; + } + return NULL; } diff --git a/Geo/partitionEdge.h b/Geo/partitionEdge.h index 69437b89d6c2e03dfb84e7b94ec4b26566278ac4..d78af1d483ce717643043841a07d34af0e34b4fb 100644 --- a/Geo/partitionEdge.h +++ b/Geo/partitionEdge.h @@ -6,6 +6,7 @@ #ifndef _PARTITION_EDGE_H_ #define _PARTITION_EDGE_H_ +#include <stdio.h> #include "GModel.h" #include "GEdge.h" #include "discreteEdge.h" @@ -14,8 +15,8 @@ class partitionEdge : public discreteEdge { public: std::vector<int> _partitions; public: - partitionEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1, - std::vector<int> &partitions) + partitionEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1, + std::vector<int> &partitions) : discreteEdge(model, num, _v0, _v1), _partitions(partitions) { std::sort(_partitions.begin(), _partitions.end()); @@ -24,15 +25,15 @@ class partitionEdge : public discreteEdge { virtual GeomType geomType() const { return PartitionCurve; } }; -struct Less_partitionEdge : +struct Less_partitionEdge : public std::binary_function<partitionEdge*, partitionEdge*, bool> { bool operator()(const partitionEdge* e1, const partitionEdge* e2) const { - if (e1->_partitions.size() < e2->_partitions.size()) return true; + if (e1->_partitions.size() < e2->_partitions.size()) return true; if (e1->_partitions.size() > e2->_partitions.size()) return false; for (unsigned int i = 0; i < e1->_partitions.size(); i++){ - if (e1->_partitions[i] < e2->_partitions[i]) return true; - if (e1->_partitions[i] > e2->_partitions[i]) return false; + if (e1->_partitions[i] < e2->_partitions[i]) return true; + if (e1->_partitions[i] > e2->_partitions[i]) return false; } return false; }