]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
precision auto
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 7 Jan 2015 18:57:20 +0000 (18:57 +0000)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 7 Jan 2015 18:57:20 +0000 (18:57 +0000)
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_QuadtreeNode.cxx
src/HYDROData/HYDROData_QuadtreeNode.hxx

index 202ffe337a3007267452b65c5f35a3639410af98..623f2eef2f53d9862555ad8d938d6a7363503879 100644 (file)
@@ -246,12 +246,23 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint) const
     }
 
   std::map<double, const gp_XYZ*> dist2nodes;
-  aQuadtree->NodesAround(thePoint, dist2nodes, 1.0);
+  aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
+  while (dist2nodes.size() == 0)
+    {
+      aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
+      DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+      aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
+    }
+  aQuadtree->NodesAround(thePoint, dist2nodes, 5.0);
   if (dist2nodes.size())
     {
       std::map<double, const gp_XYZ*>::const_iterator it = dist2nodes.begin();
       aResAltitude = it->second->Z();
-      //DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude);
+      DEBTRACE("  number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude);
+    }
+  else
+    {
+      DEBTRACE("  number of points found: 0");
     }
 
   return aResAltitude;
index 64d3ecb06288a5af74f1a807b301c17cb74c3cae..ba940dad7317689812958fdf7b38b9884d13330c 100644 (file)
@@ -47,7 +47,7 @@ HYDROData_QuadtreeNode::HYDROData_QuadtreeNode(Nodes_3D* theNodes,
                                                const int maxLevel,
                                                const int maxNbNodes,
                                                const double minBoxSize) :
-    HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes)
+    HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25)
 {
   DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
    if (myNodes)
@@ -62,10 +62,9 @@ HYDROData_QuadtreeNode::HYDROData_QuadtreeNode(Nodes_3D* theNodes,
  * \brief Constructor used to allocate a child
  */
 HYDROData_QuadtreeNode::HYDROData_QuadtreeNode() :
-    HYDROData_Quadtree()
+    HYDROData_Quadtree(), myNodes(0), myPrecision(0.25)
 {
-  if (myNodes == 0)
-    myNodes = new Nodes_3D();
+  myNodes = new Nodes_3D();
 }
 
 /*!
index 9dfe0a07b8fce94b4da5a03198abcb6e81c6e897..78497ffae78a521d0457700ebc98ef86184d4fe6 100644 (file)
@@ -93,6 +93,9 @@ public:
   //! tells us if the tree as already bin computed
   bool isEmpty() const { return myChildren == 0; }
 
+  inline double getPrecision() {return myPrecision; }
+  inline double setPrecision(double precision)  {myPrecision = precision; }
+
 protected:
 
   struct Limit: public HYDROData_TreeLimit
@@ -117,6 +120,9 @@ protected:
 
   //! The set of nodes inside the box of the Quadtree (Empty if Quadtree is not a leaf)
   Nodes_3D* myNodes;
+
+  //! distance to look for nearest nodes
+  double myPrecision;
 };
 
 #endif