Salome HOME
#19026 EDF 21355 - Problem with Belog to GEOM
authoreap <eap@opencascade.com>
Wed, 29 Apr 2020 16:54:39 +0000 (19:54 +0300)
committereap <eap@opencascade.com>
Wed, 29 Apr 2020 16:54:39 +0000 (19:54 +0300)
src/Controls/SMESH_Controls.cxx
src/SMESH/SMESH_subMesh.hxx
src/SMESH/SMESH_subMeshEventListener.hxx
src/StdMeshers/StdMeshers_FaceSide.cxx

index b3bd67a7db8a174ef1e4b181dee94559e3cbbd19..fce25f698618e8c45cd0dd472e5a40a4f7aae876 100644 (file)
@@ -35,6 +35,7 @@
 #include "SMESH_MeshAlgos.hxx"
 #include "SMESH_OctreeNode.hxx"
 
 #include "SMESH_MeshAlgos.hxx"
 #include "SMESH_OctreeNode.hxx"
 
+#include <GEOMUtils.hxx>
 #include <Basics_Utils.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
 #include <Basics_Utils.hxx>
 
 #include <BRepAdaptor_Surface.hxx>
@@ -4265,6 +4266,8 @@ private:
   bool isOutOfNone  (const gp_Pnt& p) { return true; }
   bool isBox        (const TopoDS_Shape& s);
 
   bool isOutOfNone  (const gp_Pnt& p) { return true; }
   bool isBox        (const TopoDS_Shape& s);
 
+  TopoDS_Shape prepareSolid( const TopoDS_Shape& theSolid );
+
   bool (Classifier::*          myIsOutFun)(const gp_Pnt& p);
   BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor
   Bnd_B3d                      myBox;
   bool (Classifier::*          myIsOutFun)(const gp_Pnt& p);
   BRepClass3d_SolidClassifier* mySolidClfr; // ptr because of a run-time forbidden copy-constructor
   Bnd_B3d                      myBox;
@@ -4524,11 +4527,17 @@ bool ElementsOnShape::IsSatisfy (const SMDS_MeshElement* elem)
     centerXYZ /= elem->NbNodes();
     isSatisfy = false;
     if ( myOctree )
     centerXYZ /= elem->NbNodes();
     isSatisfy = false;
     if ( myOctree )
+    {
+      myWorkClassifiers.clear();
+      myOctree->GetClassifiersAtPoint( centerXYZ, myWorkClassifiers );
       for ( size_t i = 0; i < myWorkClassifiers.size() && !isSatisfy; ++i )
         isSatisfy = ! myWorkClassifiers[i]->IsOut( centerXYZ );
       for ( size_t i = 0; i < myWorkClassifiers.size() && !isSatisfy; ++i )
         isSatisfy = ! myWorkClassifiers[i]->IsOut( centerXYZ );
+    }
     else
     else
+    {
       for ( size_t i = 0; i < myClassifiers.size() && !isSatisfy; ++i )
         isSatisfy = ! myClassifiers[i].IsOut( centerXYZ );
       for ( size_t i = 0; i < myClassifiers.size() && !isSatisfy; ++i )
         isSatisfy = ! myClassifiers[i].IsOut( centerXYZ );
+    }
   }
 
   return isSatisfy;
   }
 
   return isSatisfy;
@@ -4613,7 +4622,7 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
     }
     else
     {
     }
     else
     {
-      mySolidClfr = new BRepClass3d_SolidClassifier(theShape);
+      mySolidClfr = new BRepClass3d_SolidClassifier( prepareSolid( theShape ));
       myIsOutFun = & ElementsOnShape::Classifier::isOutOfSolid;
     }
     break;
       myIsOutFun = & ElementsOnShape::Classifier::isOutOfSolid;
     }
     break;
@@ -4692,6 +4701,25 @@ ElementsOnShape::Classifier::~Classifier()
   delete mySolidClfr; mySolidClfr = 0;
 }
 
   delete mySolidClfr; mySolidClfr = 0;
 }
 
+TopoDS_Shape ElementsOnShape::Classifier::prepareSolid( const TopoDS_Shape& theSolid )
+{
+  // try to limit tolerance of theSolid down to myTol (issue #19026)
+
+  // check if tolerance of theSolid is more than myTol
+  bool tolIsOk = true; // max tolerance is at VERTEXes
+  for ( TopExp_Explorer exp( theSolid, TopAbs_VERTEX ); exp.More() &&  tolIsOk; exp.Next() )
+    tolIsOk = ( myTol >= BRep_Tool::Tolerance( TopoDS::Vertex( exp.Current() )));
+  if ( tolIsOk )
+    return theSolid;
+
+  // make a copy to prevent the original shape from changes
+  TopoDS_Shape resultShape = BRepBuilderAPI_Copy( theSolid );
+
+  if ( !GEOMUtils::FixShapeTolerance( resultShape, TopAbs_SHAPE, myTol ))
+    return theSolid;
+  return resultShape;
+}
+
 bool ElementsOnShape::Classifier::isOutOfSolid( const gp_Pnt& p )
 {
   if ( isOutOfBox( p )) return true;
 bool ElementsOnShape::Classifier::isOutOfSolid( const gp_Pnt& p )
 {
   if ( isOutOfBox( p )) return true;
index 23ec4ed56e4b4472661f918d90d052b063a7962d..03dd98e491b9448c9cf04a8396f070004b62890f 100644 (file)
@@ -126,7 +126,7 @@ class SMESH_EXPORT SMESH_subMesh
   // ==================================================================
 
   /*!
   // ==================================================================
 
   /*!
-   * \brief Sets an event listener and its data to a submesh
+   * \brief Set an event listener and its data to a submesh
     * \param listener - the listener to store
     * \param data - the listener data to store
     * \param where - the submesh to store the listener and it's data
     * \param listener - the listener to store
     * \param data - the listener data to store
     * \param where - the submesh to store the listener and it's data
index cadfdce715d2880a9fef8b7a26e0a10730cadf65..dddc54d1ab0fe7d5918d914a2c2d3f27ad73912a 100644 (file)
@@ -92,7 +92,7 @@ struct SMESH_subMeshEventListenerData
                                             !! they are used to track intermesh
                                             dependencies at mesh loading as well !! */
 public:
                                             !! they are used to track intermesh
                                             dependencies at mesh loading as well !! */
 public:
-  SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable) {}
+  SMESH_subMeshEventListenerData(bool isDeletable):myIsDeletable(isDeletable),myType(-1) {}
   virtual ~SMESH_subMeshEventListenerData() {}
   bool IsDeletable() const { return myIsDeletable; }
 
   virtual ~SMESH_subMeshEventListenerData() {}
   bool IsDeletable() const { return myIsDeletable; }
 
index 2fc28f15bd0710221b40e29315faba9b25a2c8cc..da593c9c364ccf4431173d699bb6b0f62c8ada33 100644 (file)
@@ -450,6 +450,7 @@ const std::vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool   isXCons
         for ( size_t j = 0; j < u2nodeVec.size(); ++j )
           u2node.insert( u2node.end(), u2nodeVec[j] );
       }
         for ( size_t j = 0; j < u2nodeVec.size(); ++j )
           u2node.insert( u2node.end(), u2nodeVec[j] );
       }
+      continue;
     } // loop on myEdge's
 
     // Add 2nd VERTEX node for a last EDGE
     } // loop on myEdge's
 
     // Add 2nd VERTEX node for a last EDGE