diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp index 328473a5de0d5910fdce41a515a5b3f98cff640a..72b4d8865f88f418f832746ca29ebe555061f3ee 100644 --- a/Geo/GFaceCompound.cpp +++ b/Geo/GFaceCompound.cpp @@ -13,7 +13,7 @@ #include "GEdgeCompound.h" #include "intersectCurveSurface.h" -#if defined(HAVE_SOLVER) +#if defined(HAVE_SOLVER) && defined(HAVE_ANN) #include "Options.h" #include "MLine.h" @@ -45,9 +45,7 @@ #include "MPoint.h" #include "Numeric.h" #include "meshGFace.h" -#if defined(HAVE_ANN) #include <ANN/ANN.h> -#endif static void fixEdgeToValue(GEdge *ed, double value, dofManager<double> &myAssembler) { @@ -1217,14 +1215,12 @@ GFaceCompound::GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, nbSplit = 0; fillTris.clear(); -#if defined(HAVE_ANN) kdtree = NULL; uv_kdtree = NULL; uv_nodes = NULL; nodes = NULL; index = new ANNidx[2]; dist = new ANNdist[2]; -#endif } GFaceCompound::GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, @@ -1272,14 +1268,12 @@ GFaceCompound::GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, nbSplit = 0; fillTris.clear(); -#if defined(HAVE_ANN) uv_kdtree = NULL; kdtree = NULL; uv_nodes = NULL; nodes = NULL; index = new ANNidx[2]; dist = new ANNdist[2]; -#endif } GFaceCompound::~GFaceCompound() @@ -1295,15 +1289,12 @@ GFaceCompound::~GFaceCompound() if (_lsys)delete _lsys; delete ONE; delete MONE; -#if defined(HAVE_ANN) if(uv_kdtree) delete uv_kdtree; if(kdtree) delete kdtree; if(uv_nodes) annDeallocPts(uv_nodes); if(nodes) annDeallocPts(nodes); delete[]index; delete[]dist; -#endif - } SPoint2 GFaceCompound::getCoordinates(MVertex *v) const @@ -1972,7 +1963,6 @@ GPoint GFaceCompound::pointInRemeshedOctree(double par1, double par2) const octNew = new MElementOctree(myParamElems); //build kdtree boundary nodes in parametric space -#if defined(HAVE_ANN) uv_nodes = annAllocPts(myBCNodes.size(), 3); std::set<SPoint2>::iterator itp = myBCNodes.begin(); int ind = 0; @@ -1984,7 +1974,6 @@ GPoint GFaceCompound::pointInRemeshedOctree(double par1, double par2) const itp++; ind++; } uv_kdtree = new ANNkd_tree(uv_nodes, myBCNodes.size(), 3); -#endif } //now use new octree to find point @@ -2012,7 +2001,6 @@ GPoint GFaceCompound::pointInRemeshedOctree(double par1, double par2) const //if element not found in new octree find closest point else{ GPoint gp(50,50,50); -#if defined(HAVE_ANN) double pt[3] = {par1,par2,0.0}; uv_kdtree->annkSearch(pt, 2, index, dist); SPoint3 p1(uv_nodes[index[0]][0], uv_nodes[index[0]][1], uv_nodes[index[0]][2]); @@ -2040,9 +2028,6 @@ GPoint GFaceCompound::pointInRemeshedOctree(double par1, double par2) const else{ gp.setNoSuccess(); } -#else - gp.setNoSuccess(); -#endif if (gp.succeeded()) return gp; else{ @@ -2274,7 +2259,6 @@ void GFaceCompound::secondDer(const SPoint2 ¶m, void GFaceCompound::computeHessianMapping() const { - #if defined(HAVE_MESH) unsigned int sysDim = 6; //for 2D unsigned int minNbPtBlob = 3*sysDim; diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h index 225886c99ef63df89086709247f8f976d8a4c58e..e6c1660d5d3ecad28f28a0668bbdd6b5624c42e0 100644 --- a/Geo/GFaceCompound.h +++ b/Geo/GFaceCompound.h @@ -13,7 +13,7 @@ #include "GFace.h" template <class scalar> class simpleFunction; -#if defined(HAVE_SOLVER) +#if defined(HAVE_SOLVER) && defined(HAVE_ANN) #include "GEdge.h" #include "GEdgeCompound.h" @@ -21,11 +21,8 @@ template <class scalar> class simpleFunction; #include "linearSystem.h" #include "GRbf.h" #include "MElementOctree.h" - -#if defined(HAVE_ANN) #include <ANN/ANN.h> class ANNkd_tree; -#endif #define AR_MAX 5 //maximal geometrical aspect ratio @@ -101,14 +98,12 @@ class GFaceCompound : public GFace { mutable std::vector<double> _coords; mutable std::map<MVertex*, int> _mapV; linearSystem <double> *_lsys; -#if defined(HAVE_ANN) - mutable ANNkd_tree *uv_kdtree; - mutable ANNkd_tree *kdtree; - mutable ANNpointArray uv_nodes; - mutable ANNpointArray nodes; - ANNidxArray index; - ANNdistArray dist; -#endif + mutable ANNkd_tree *uv_kdtree; + mutable ANNkd_tree *kdtree; + mutable ANNpointArray uv_nodes; + mutable ANNpointArray nodes; + ANNidxArray index; + ANNdistArray dist; void buildOct() const ; void buildAllNodes() const; @@ -200,7 +195,6 @@ class GFaceCompound : public GFace { #else -//define empty class ifndef HAVE_SOLVER template<class scalar> class linearSystem; class GFaceCompound : public GFace { public: @@ -215,7 +209,7 @@ class GFaceCompound : public GFace { linearSystem<double>* lsys =0) : GFace(m, tag) { - Msg::Error("Gmsh has to be compiled with solver support to use GFaceCompounds"); + Msg::Error("Gmsh has to be compiled with Solver and ANN support to use GFaceCompounds"); } GFaceCompound(GModel *m, int tag, std::list<GFace*> &compound, std::list<GEdge*> &U0, std::list<GEdge*> &V0, @@ -225,7 +219,7 @@ class GFaceCompound : public GFace { linearSystem<double>* lsys =0) : GFace(m, tag) { - Msg::Error("Gmsh has to be compiled with solver support to use GFaceCompounds"); + Msg::Error("Gmsh has to be compiled with Solver and ANN support to use GFaceCompounds"); } virtual ~GFaceCompound() {} GPoint point(double par1, double par2) const { return GPoint(); }