0032448: Modeling Algorithms - Provide exact validating (as option) using GeomLib_Che...
authorakaftasev <akaftasev@opencascade.com>
Thu, 28 Oct 2021 16:23:37 +0000 (19:23 +0300)
committerinv <inv@opencascade.com>
Sun, 21 Nov 2021 09:42:09 +0000 (12:42 +0300)
Add '-exact' option to checkshape command to use exact method to validate edges using BRepLib_ValidateEdge class. Default mode is calculating in finite number of points.

27 files changed:
dox/upgrade/upgrade.md
dox/user_guides/draw_test_harness/draw_test_harness.md
src/BRepCheck/BRepCheck_Analyzer.cxx
src/BRepCheck/BRepCheck_Analyzer.hxx
src/BRepCheck/BRepCheck_Edge.cxx
src/BRepCheck/BRepCheck_Edge.hxx
src/BRepLib/BRepLib_CheckCurveOnSurface.cxx
src/BRepLib/BRepLib_CheckCurveOnSurface.hxx
src/BRepLib/BRepLib_ValidateEdge.cxx
src/BRepLib/BRepLib_ValidateEdge.hxx
src/BRepTest/BRepTest_CheckCommands.cxx
src/GeomLib/GeomLib_CheckCurveOnSurface.cxx
src/GeomLib/GeomLib_CheckCurveOnSurface.hxx
src/IntTools/IntTools_Tools.cxx
tests/heal/begin
tests/heal/checkshape/bug27814_10
tests/heal/checkshape/bug27814_11
tests/heal/checkshape/bug32448_1 [new file with mode: 0644]
tests/heal/checkshape/bug32448_10 [new file with mode: 0644]
tests/heal/checkshape/bug32448_2 [new file with mode: 0644]
tests/heal/checkshape/bug32448_3 [new file with mode: 0644]
tests/heal/checkshape/bug32448_4 [new file with mode: 0644]
tests/heal/checkshape/bug32448_5 [new file with mode: 0644]
tests/heal/checkshape/bug32448_6 [new file with mode: 0644]
tests/heal/checkshape/bug32448_7 [new file with mode: 0644]
tests/heal/checkshape/bug32448_8 [new file with mode: 0644]
tests/heal/checkshape/bug32448_9 [new file with mode: 0644]

index 96765a20154a1f1ddda9c4c964e2cacacc429547..ffa19e9390360a238628260551f58efb74eb49ce 100644 (file)
@@ -2293,3 +2293,22 @@ void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
   - *BRepAlgo_Cut*
   - *BRepAlgo_Section*
   The corresponding classes from the *BRepAlgoAPI* package have to be used instead.
+  
+@section upgrade_occt770 Upgrade to OCCT 7.7.0
+
+@subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
+theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
+ - BRepCheck_Analyzer
+ - BRepCheck_Edge
+ - BRepLib_ValidateEdge
+ - GeomLib_CheckCurveOnSurface
+ - BRepLib_CheckCurveOnSurface
+
+Now, to set this flag, it is necessary to use method SetParallel()
+For example:
+~~~~{.cpp}
+BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
+aValidateEdge.SetParallel(toRunParallel);
+aValidateEdge.Process();
+~~~~ 
\ No newline at end of file
index 33ca38fc0b9890b372643d4b4dca91cceee0ea3d..bac73167839c308f027d74d1ca6fc29c8d47b127 100644 (file)
@@ -7545,7 +7545,7 @@ xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
 
 Syntax:
 ~~~~{.php}
-checkshape [-top] shape [result] [-short] [-parallel]
+checkshape [-top] shape [result] [-short] [-parallel] [-exact]
 ~~~~
 
 Where: 
@@ -7554,6 +7554,7 @@ Where:
 * *result* -- optional parameter, defines custom prefix for the output shape names.
 * *short* -- a short description of the check. 
 * *parallel* -- run check in multithread mode.
+* *exact*    -- run check using exact method.
 
 **checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape. 
 
index 1e777665ce7d04ed977177f595bff465e4a891bc..67ca44e664cec1e852f5cb80fed6a46f6caf49e4 100644 (file)
@@ -346,8 +346,7 @@ private:
 //purpose  :
 //=======================================================================
 void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
-                               const Standard_Boolean B,
-                               const Standard_Boolean theIsParallel)
+                               const Standard_Boolean B)
 {
   if (theShape.IsNull())
   {
@@ -356,8 +355,8 @@ void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
 
   myShape = theShape;
   myMap.Clear();
-  Put (theShape, B, theIsParallel);
-  Perform (theIsParallel);
+  Put (theShape, B);
+  Perform();
 }
 
 //=======================================================================
@@ -365,8 +364,7 @@ void BRepCheck_Analyzer::Init (const TopoDS_Shape& theShape,
 //purpose  :
 //=======================================================================
 void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
-                              const Standard_Boolean B,
-                              const Standard_Boolean theIsParallel)
+                              const Standard_Boolean B)
 {
   if (myMap.Contains (theShape))
   {
@@ -382,6 +380,7 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
     case TopAbs_EDGE:
       HR = new BRepCheck_Edge (TopoDS::Edge (theShape));
       Handle(BRepCheck_Edge)::DownCast(HR)->GeometricControls (B);
+      Handle(BRepCheck_Edge)::DownCast(HR)->SetExactMethod(myIsExact);
       break;
     case TopAbs_WIRE:
       HR = new BRepCheck_Wire (TopoDS::Wire (theShape));
@@ -406,13 +405,13 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
 
   if (!HR.IsNull())
   {
-    HR->SetParallel (theIsParallel);
+    HR->SetParallel (myIsParallel);
   }
   myMap.Add (theShape, HR);
 
   for (TopoDS_Iterator theIterator (theShape); theIterator.More(); theIterator.Next())
   {
-    Put (theIterator.Value(), B, theIsParallel); // performs minimum on each shape
+    Put (theIterator.Value(), B); // performs minimum on each shape
   }
 }
 
@@ -420,7 +419,7 @@ void BRepCheck_Analyzer::Put (const TopoDS_Shape& theShape,
 //function : Perform
 //purpose  :
 //=======================================================================
-void BRepCheck_Analyzer::Perform (Standard_Boolean theIsParallel)
+void BRepCheck_Analyzer::Perform()
 {
   const Standard_Integer aMapSize = myMap.Size();
   const Standard_Integer aMinTaskSize = 10;
@@ -453,7 +452,7 @@ void BRepCheck_Analyzer::Perform (Standard_Boolean theIsParallel)
   }
 
   BRepCheck_ParallelAnalyzer aParallelAnalyzer (aArrayOfArray, myMap);
-  OSD_Parallel::For (0, aArrayOfArray.Size(), aParallelAnalyzer, !theIsParallel);
+  OSD_Parallel::For (0, aArrayOfArray.Size(), aParallelAnalyzer, !myIsParallel);
 }
 
 //=======================================================================
index f604214fa921ffea11ffca566fb263ba537ea1af..1f549fab5d109bffe8f6ebf82eb79a5fabf4bfd2 100644 (file)
@@ -59,9 +59,12 @@ public:
   //! BRepCheck_SelfIntersectingWire
   BRepCheck_Analyzer (const TopoDS_Shape& S,
                       const Standard_Boolean GeomControls = Standard_True,
-                      const Standard_Boolean theIsParallel = Standard_False)
+                      const Standard_Boolean theIsParallel = Standard_False,
+                      const Standard_Boolean theIsExact = Standard_False)
+    : myIsParallel(theIsParallel),
+      myIsExact(theIsExact)
   {
-    Init (S, GeomControls, theIsParallel);
+    Init (S, GeomControls);
   }
 
   //! <S> is the  shape  to control.  <GeomControls>  If
@@ -81,8 +84,35 @@ public:
   //! For a wire :
   //! BRepCheck_SelfIntersectingWire
   Standard_EXPORT void Init (const TopoDS_Shape& S,
-                             const Standard_Boolean GeomControls = Standard_True,
-                             const Standard_Boolean theIsParallel = Standard_False);
+                             const Standard_Boolean GeomControls = Standard_True);
+
+  //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
+  //! is false, faster, but possible not correct result) or exact calculating by using 
+  //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
+  //! Exact method is used only when edge is SameParameter.
+  //! Default method is calculating in finite number of points
+  void SetExactMethod(const Standard_Boolean theIsExact)
+  {
+    myIsExact = theIsExact;
+  }
+
+  //! Returns true if exact method selected
+  Standard_Boolean IsExactMethod()
+  {
+    return myIsExact;
+  }
+
+  //! Sets parallel flag
+  void SetParallel(const Standard_Boolean theIsParallel)
+  {
+    myIsParallel = theIsParallel;
+  }
+
+  //! Returns true if parallel flag is set
+  Standard_Boolean IsParallel()
+  {
+    return myIsParallel;
+  }
 
   //! <S> is a  subshape of the  original shape. Returns
   //! <STandard_True> if no default has been detected on
@@ -141,10 +171,9 @@ public:
 private:
 
   Standard_EXPORT void Put (const TopoDS_Shape& S,
-                            const Standard_Boolean Gctrl,
-                            const Standard_Boolean theIsParallel);
+                            const Standard_Boolean Gctrl);
 
-  Standard_EXPORT void Perform (Standard_Boolean theIsParallel);
+  Standard_EXPORT void Perform();
 
   Standard_EXPORT Standard_Boolean ValidSub (const TopoDS_Shape& S, const TopAbs_ShapeEnum SubType) const;
 
@@ -152,6 +181,8 @@ private:
 
   TopoDS_Shape myShape;
   BRepCheck_IndexedDataMapOfShapeResult myMap;
+  Standard_Boolean myIsParallel;
+  Standard_Boolean myIsExact;
 
 };
 
index 48c3b8c56e4eaf74ce24d81823657aed592e3eb4..4e5cd6ca22d279db74536f241e6a60785ba881a4 100644 (file)
@@ -75,6 +75,7 @@ BRepCheck_Edge::BRepCheck_Edge(const TopoDS_Edge& E)
 {
   Init(E);
   myGctrl = Standard_True;
+  myIsExactMethod = Standard_False;
 }
 
 //=======================================================================
@@ -321,6 +322,7 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
 
       BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
       Standard_Real eps = Precision::PConfusion();
+      Standard_Boolean toRunParallel = !myMutex.IsNull();
       while (itcr.More()) {
         const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
         if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
@@ -385,6 +387,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
 
             BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
             aValidateEdge.SetExitIfToleranceExceeded(Tol);
+            aValidateEdge.SetExactMethod(myIsExactMethod);
+            aValidateEdge.SetParallel(toRunParallel);
             aValidateEdge.Process();
             if (!aValidateEdge.IsDone() || !aValidateEdge.CheckTolerance(Tol))
             {
@@ -407,6 +411,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
 
               BRepLib_ValidateEdge aValidateEdgeOnClosedSurf(myHCurve, ACS, SameParameter);
               aValidateEdgeOnClosedSurf.SetExitIfToleranceExceeded(Tol);
+              aValidateEdgeOnClosedSurf.SetExactMethod(myIsExactMethod);
+              aValidateEdgeOnClosedSurf.SetParallel(toRunParallel);
               aValidateEdgeOnClosedSurf.Process();
               if (!aValidateEdgeOnClosedSurf.IsDone() || !aValidateEdgeOnClosedSurf.CheckTolerance(Tol))
               {
@@ -466,6 +472,8 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
 
             BRepLib_ValidateEdge aValidateEdgeProj(myHCurve, ACS, SameParameter);
             aValidateEdgeProj.SetExitIfToleranceExceeded(Tol);
+            aValidateEdgeProj.SetExactMethod(myIsExactMethod);
+            aValidateEdgeProj.SetParallel(toRunParallel);
             aValidateEdgeProj.Process();
             if (!aValidateEdgeProj.IsDone() || !aValidateEdgeProj.CheckTolerance(Tol))
             {
index 3051c1767387a07418ce78a758b00c6542126e7b..3a8ef877c821c3db8296fe4dc66ec05800ce716a 100644 (file)
@@ -51,7 +51,23 @@ public:
   
   //! Sets status of Edge;
   Standard_EXPORT void SetStatus (const BRepCheck_Status theStatus);
+
+  //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
+  //! is false, faster, but possible not correct result) or exact calculating by using 
+  //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
+  //! Exact method is used only when edge is SameParameter.
+  //! Default method is calculating in finite number of points
+  void SetExactMethod(Standard_Boolean theIsExact)
+  {
+    myIsExactMethod = theIsExact;
+  }
   
+  //! Returns true if exact method selected
+  Standard_Boolean IsExactMethod()
+  {
+    return myIsExactMethod;
+  }
+
   //! Checks, if polygon on triangulation of heEdge
   //! is out of 3D-curve of this edge.
   Standard_EXPORT BRepCheck_Status CheckPolygonOnTriangulation (const TopoDS_Edge& theEdge);
@@ -64,7 +80,7 @@ private:
   Handle(BRep_CurveRepresentation) myCref;
   Handle(Adaptor3d_Curve) myHCurve;
   Standard_Boolean myGctrl;
-
+  Standard_Boolean myIsExactMethod;
 };
 
 #endif // _BRepCheck_Edge_HeaderFile
index 8f656f81d4492da64be375c0c16f06f2e451619a..29d5d42f399019a62ed93416d2f92387ddf60db2 100644 (file)
@@ -32,6 +32,7 @@
 BRepLib_CheckCurveOnSurface::BRepLib_CheckCurveOnSurface
                                             ( const TopoDS_Edge& theEdge,
                                               const TopoDS_Face& theFace)
+  : myIsParallel(Standard_False)
 {
   Init(theEdge, theFace);
 }
@@ -89,10 +90,10 @@ void BRepLib_CheckCurveOnSurface::Init(const TopoDS_Edge& theEdge, const TopoDS_
 //function : Perform
 //purpose  : if isTheMTDisabled == TRUE parallelization is not used
 //=======================================================================
-void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean isMultiThread)
+void BRepLib_CheckCurveOnSurface::Perform()
 {
   // Compute the max distance
-  Compute(myAdaptorCurveOnSurface, isMultiThread);
+  Compute(myAdaptorCurveOnSurface);
   if (ErrorStatus())
   {
     return;
@@ -102,7 +103,7 @@ void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean isMultiThread)
   {
     // compute max distance for myAdaptorCurveOnSurface2
     // (for the second curve on closed surface)
-    Compute(myAdaptorCurveOnSurface2, isMultiThread);
+    Compute(myAdaptorCurveOnSurface2);
   }
 }
 
@@ -110,8 +111,8 @@ void BRepLib_CheckCurveOnSurface::Perform(const Standard_Boolean isMultiThread)
 //function : Compute
 //purpose  : if isTheMTDisabled == TRUE parallelization is not used
 //=======================================================================
-void BRepLib_CheckCurveOnSurface::Compute(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
-                                          const Standard_Boolean isMultiThread)
+void BRepLib_CheckCurveOnSurface::Compute(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface)
 {
-  myCOnSurfGeom.Perform(theCurveOnSurface, isMultiThread);
+  myCOnSurfGeom.SetParallel(myIsParallel);
+  myCOnSurfGeom.Perform(theCurveOnSurface);
 }
index 328493b48a7a621e1907fa313f296fbd9016a8ef..84e4a5fb30f49a3e9ca490d2b47422812e73b1c4 100644 (file)
@@ -27,7 +27,10 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Default constructor
-  BRepLib_CheckCurveOnSurface() {}
+  BRepLib_CheckCurveOnSurface() 
+    : myIsParallel(Standard_False)
+  {
+  }
   
   //! Constructor
   Standard_EXPORT BRepLib_CheckCurveOnSurface(const TopoDS_Edge& theEdge,
@@ -37,8 +40,8 @@ public:
   Standard_EXPORT void Init (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
 
   //! Performs the calculation
-  //! If isMultiThread == Standard_True then computation will be performed in parallel.
-  Standard_EXPORT void Perform(const Standard_Boolean isMultiThread = Standard_False);
+  //! If myIsParallel == Standard_True then computation will be performed in parallel.
+  Standard_EXPORT void Perform();
   
   //! Returns true if the max distance has been found
   Standard_Boolean IsDone() const
@@ -46,6 +49,18 @@ public:
     return myCOnSurfGeom.ErrorStatus() == 0;
   }
   
+  //! Sets parallel flag
+  void SetParallel(const Standard_Boolean theIsParallel)
+  {
+    myIsParallel = theIsParallel;
+  }
+
+  //! Returns true if parallel flag is set
+  Standard_Boolean IsParallel()
+  {
+    return myIsParallel;
+  }
+
   //! Returns error status
   //! The possible values are:
   //! 0 - OK;
@@ -74,14 +89,14 @@ protected:
   //! Computes the max distance for the 3d curve of <myCOnSurfGeom>
   //! and 2d curve <theCurveOnSurface>
   //! If isMultiThread == Standard_True then computation will be performed in parallel.
-  Standard_EXPORT void Compute (const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
-                                const Standard_Boolean isMultiThread);
+  Standard_EXPORT void Compute (const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface);
 
 private:
 
   GeomLib_CheckCurveOnSurface myCOnSurfGeom;
   Handle(Adaptor3d_CurveOnSurface) myAdaptorCurveOnSurface;
   Handle(Adaptor3d_CurveOnSurface) myAdaptorCurveOnSurface2;
+  Standard_Boolean myIsParallel;
 };
 
 #endif // _BRepLib_CheckCurveOnSurface_HeaderFile
index f97a13640e22378d4f160e40d823ff93b9ce33ba..ba34e4faa1bd5464f941153eed98af663369c5b8 100644 (file)
@@ -17,6 +17,7 @@
 #include <Adaptor3d_CurveOnSurface.hxx>
 #include <BRepCheck.hxx>
 #include <Extrema_LocateExtPC.hxx>
+#include <GeomLib_CheckCurveOnSurface.hxx>
 
 //=============================================================================
 //function : BRepLib_ValidateEdge
@@ -32,7 +33,9 @@ BRepLib_ValidateEdge::BRepLib_ValidateEdge(Handle(Adaptor3d_Curve) theReferenceC
   myToleranceForChecking(0),
   myCalculatedDistance(0),
   myExitIfToleranceExceeded(Standard_False),
-  myIsDone(Standard_False)
+  myIsDone(Standard_False),
+  myIsExactMethod(Standard_False),
+  myIsMultiThread(Standard_False)
 { }
 
 //=============================================================================
@@ -96,6 +99,22 @@ void BRepLib_ValidateEdge::SetExitIfToleranceExceeded(Standard_Real theTolerance
 //purpose  : 
 //=============================================================================
 void BRepLib_ValidateEdge::Process()
+{
+  if (myIsExactMethod && mySameParameter)
+  {
+    processExact();
+  }
+  else
+  {
+    processApprox();
+  }
+}
+
+//=============================================================================
+//function : processApprox
+//purpose  : 
+//=============================================================================
+void BRepLib_ValidateEdge::processApprox()
 {
   myIsDone = Standard_True;
   Standard_Real aSquareToleranceForChecking = myToleranceForChecking * myToleranceForChecking;
@@ -212,3 +231,20 @@ void BRepLib_ValidateEdge::Process()
   }
   myCalculatedDistance = Sqrt(aMaxSquareDistance);
 }
+
+//=============================================================================
+//function : processExact
+//purpose  : 
+//=============================================================================
+void BRepLib_ValidateEdge::processExact()
+{
+  GeomLib_CheckCurveOnSurface aCheckCurveOnSurface(myReferenceCurve);
+  aCheckCurveOnSurface.SetParallel(myIsMultiThread);
+  aCheckCurveOnSurface.Perform(myOtherCurve);
+  myIsDone = aCheckCurveOnSurface.IsDone();
+  if (myIsDone)
+  {
+    myCalculatedDistance = aCheckCurveOnSurface.MaxDistance();
+  }
+}
+
index 48fc25c7f2543f06024fbe0a32c8753ab28d60ce..e5698dcb6356ba7191beef7a6bc23d22a9b2e5ad 100644 (file)
@@ -21,8 +21,9 @@
 class Adaptor3d_Curve;
 class Adaptor3d_CurveOnSurface;
 
-//! Computes the max distance between 3D-curve and curve on 
-//! surface in fixed points number
+//! Computes the max distance between 3D-curve and curve on surface.
+//! This class uses 2 methods: approximate using finite
+//! number of points (default) and exact 
 class BRepLib_ValidateEdge
 {
 public:
@@ -31,25 +32,54 @@ public:
                                        const Handle(Adaptor3d_CurveOnSurface) theOtherCurve,
                                        Standard_Boolean theSameParameter);
 
+  //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
+  //! is false, faster, but possible not correct result) or exact calculating by using 
+  //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
+  //! Exact method is used only when edge is SameParameter.
+  //! Default method is calculating in finite number of points
+  void SetExactMethod(Standard_Boolean theIsExact)
+  {
+    myIsExactMethod = theIsExact;
+  }
+
+  //! Returns true if exact method selected
+  Standard_Boolean IsExactMethod()
+  {
+    return myIsExactMethod;
+  }
+
+  //! Sets parallel flag
+  void SetParallel(Standard_Boolean theIsMultiThread)
+  {
+    myIsMultiThread = theIsMultiThread;
+  }
+
+  //! Returns true if parallel flag is set
+  Standard_Boolean IsParallel()
+  {
+    return myIsMultiThread;
+  }
+
   //! Set control points number (if you need a value other than 22)
   void SetControlPointsNumber(Standard_Integer theControlPointsNumber)
   {
     myControlPointsNumber = theControlPointsNumber;
   }
 
-  //! Sets the maximal allowed distance in the Process() function. If the distance greater than 
-  //! theToleranceForChecking the Process() function stops. Use this for best performance 
-  //! in case of checking of tolerance.
-  Standard_EXPORT void SetExitIfToleranceExceeded(Standard_Real theToleranceForChecking);
+  //! Sets limit to compute a distance in the Process() function. If the distance greater than 
+  //! theToleranceForChecking the Process() function stopped. Use this in case checking of 
+  //! tolerance for best performcnce. Has no effect in case using exact method.
+  void SetExitIfToleranceExceeded(Standard_Real theToleranceForChecking);
 
   //! Computes the max distance for the 3d curve <myReferenceCurve>
   //! and curve on surface <myOtherCurve>. If the SetExitIfToleranceExceeded()
   //!  function was called before <myCalculatedDistance> contains first 
-  //! greater than SetExitIfToleranceExceeded() parameter value
+  //! greater than SetExitIfToleranceExceeded() parameter value. In case 
+  //! using exact method always computes real max distance.
   Standard_EXPORT void Process();
 
   //! Returns true if the distance has been found for all points
-  Standard_Boolean IsDone()
+  Standard_Boolean IsDone() const
   {
     return myIsDone;
   }
@@ -67,6 +97,12 @@ private:
   //! Adds some margin for distance checking
   Standard_Real correctTolerance(Standard_Real theTolerance);
 
+  //! Calculating in finite number of points
+  void processApprox();
+
+  //! Calculating by using BRepLib_CheckCurveOnSurface class
+  void processExact();
+
 private:
   Handle(Adaptor3d_Curve) myReferenceCurve;
   Handle(Adaptor3d_CurveOnSurface) myOtherCurve;
@@ -76,6 +112,8 @@ private:
   Standard_Real myCalculatedDistance;
   Standard_Boolean myExitIfToleranceExceeded;
   Standard_Boolean myIsDone;
+  Standard_Boolean myIsExactMethod;
+  Standard_Boolean myIsMultiThread;
 };
 
-#endif  // _BRepLib_ValidateEdge_HeaderFile
\ No newline at end of file
+#endif // _BRepLib_ValidateEdge_HeaderFile
index 5f52c7a267879858c8f57f14304b61fdb23ea585..35b1c10a5c381e4a9307ffe9aef6ea25889817be 100644 (file)
@@ -855,19 +855,20 @@ static Standard_Integer checkshape (Draw_Interpretor& theCommands,
   if (narg == 1)
   {
     theCommands << "\n";
-    theCommands << "Usage : checkshape [-top] shape [result] [-short] [-parallel]\n";
+    theCommands << "Usage : checkshape [-top] shape [result] [-short] [-parallel] [-exact]\n";
     theCommands << "\n";
     theCommands << "Where :\n";
-    theCommands << "   -top   - check topology only.\n";
-    theCommands << "   shape  - the name of the shape to test.\n";
-    theCommands << "   result - the prefix of the output shape names. If it is used, structural\n";
-    theCommands << "            output style will be used. Otherwise - contextual one.\n";
-    theCommands << "   -short - short description of check.\n";
+    theCommands << "   -top      - check topology only.\n";
+    theCommands << "   shape     - the name of the shape to test.\n";
+    theCommands << "   result    - the prefix of the output shape names. If it is used, structural\n";
+    theCommands << "               output style will be used. Otherwise - contextual one.\n";
+    theCommands << "   -short    - short description of check.\n";
     theCommands << "   -parallel - run check in parallel.\n";
+    theCommands << "   -exact    - run check using exact method.\n";
     return 0;
   }
 
-  if (narg > 6)
+  if (narg > 7)
   {
     theCommands << "Invalid number of args!!!\n";
     theCommands << "No args to have help.\n";
@@ -901,6 +902,7 @@ static Standard_Integer checkshape (Draw_Interpretor& theCommands,
   Standard_Boolean IsShortDump = Standard_False;
   Standard_Boolean IsContextDump = Standard_True;
   Standard_Boolean IsParallel = Standard_False;
+  Standard_Boolean IsExact = Standard_False;
   Standard_CString aPref(NULL);
   if (aCurInd < narg && strncmp(a[aCurInd], "-", 1))
   {
@@ -921,6 +923,10 @@ static Standard_Integer checkshape (Draw_Interpretor& theCommands,
     {
       IsParallel = Standard_True;
     }
+    else if (anArg == "-exact")
+    {
+      IsExact = Standard_True;
+    }
     else
     {
       theCommands << "Syntax error at '" << anArg << "'";
@@ -931,7 +937,7 @@ static Standard_Integer checkshape (Draw_Interpretor& theCommands,
   try 
   {
     OCC_CATCH_SIGNALS
-    BRepCheck_Analyzer anAna (aShape, aGeomCtrl, IsParallel);
+    BRepCheck_Analyzer anAna (aShape, aGeomCtrl, IsParallel, IsExact);
     Standard_Boolean   isValid = anAna.IsValid();
 
     if (isValid)
index c736d458d8ec93f93e23d1a6a1c9dfb3644dcd50..6f68afd05f490ddcc33b151668d5686d30163b50 100644 (file)
@@ -319,7 +319,8 @@ GeomLib_CheckCurveOnSurface::GeomLib_CheckCurveOnSurface()
   myErrorStatus(0),
   myMaxDistance(RealLast()),
   myMaxParameter(0.),
-  myTolRange(Precision::PConfusion())
+  myTolRange(Precision::PConfusion()),
+  myIsParallel(Standard_False)
 {
 }
 
@@ -334,7 +335,8 @@ GeomLib_CheckCurveOnSurface::
   myErrorStatus(0),
   myMaxDistance(RealLast()),
   myMaxParameter(0.),
-  myTolRange(theTolRange)
+  myTolRange(theTolRange),
+  myIsParallel(Standard_False)
 {
 }
 
@@ -369,8 +371,7 @@ void GeomLib_CheckCurveOnSurface::Init( const Handle(Adaptor3d_Curve)& theCurve,
 //function : Perform
 //purpose  : 
 //=======================================================================
-void GeomLib_CheckCurveOnSurface::Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
-                                          const Standard_Boolean isMultiThread)
+void GeomLib_CheckCurveOnSurface::Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface)
 {
   if( myCurve.IsNull() ||
       theCurveOnSurface.IsNull())
@@ -415,7 +416,7 @@ void GeomLib_CheckCurveOnSurface::Perform(const Handle(Adaptor3d_CurveOnSurface)
     FillSubIntervals(myCurve, theCurveOnSurface->GetCurve(),
                      myCurve->FirstParameter(), myCurve->LastParameter(), aNbParticles, &anIntervals);
 
-    const Standard_Integer aNbThreads = isMultiThread ? Min(anIntervals.Size(), OSD_ThreadPool::DefaultPool()->NbDefaultThreadsToLaunch()) : 1;
+    const Standard_Integer aNbThreads = myIsParallel ? Min(anIntervals.Size(), OSD_ThreadPool::DefaultPool()->NbDefaultThreadsToLaunch()) : 1;
     Array1OfHCurve aCurveArray(0, aNbThreads - 1);
     Array1OfHCurve aCurveOnSurfaceArray(0, aNbThreads - 1);
     for (Standard_Integer anI = 0; anI < aNbThreads; ++anI)
index bc68342407fe510b52505b56be59ffd65a092e77..98cb7b631ca8f42567627da127c9d741abb22052 100644 (file)
@@ -48,8 +48,19 @@ public:
   //! Computes the max distance for the 3d curve <myCurve>
   //! and 2d curve <theCurveOnSurface>
   //! If isMultiThread == Standard_True then computation will be performed in parallel.
-  Standard_EXPORT void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
-                               const Standard_Boolean isMultiThread = Standard_False);
+  Standard_EXPORT void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface);
+
+  //! Sets parallel flag
+  void SetParallel(const Standard_Boolean theIsParallel)
+  {
+    myIsParallel = theIsParallel;
+  }
+
+  //! Returns true if parallel flag is set
+  Standard_Boolean IsParallel()
+  {
+    return myIsParallel;
+  }
 
   //! Returns true if the max distance has been found
   Standard_Boolean IsDone() const
@@ -87,6 +98,7 @@ private:
   Standard_Real myMaxDistance;
   Standard_Real myMaxParameter;
   Standard_Real myTolRange;
+  Standard_Boolean myIsParallel;
 };
 
 #endif // _BRepLib_CheckCurveOnSurface_HeaderFile
index bf7b91e634b2734a0f40a3b2797b0e8a1413dcce..8ea8e0cf743e9dab632b1c6a13e112820a1a58b7 100644 (file)
@@ -807,7 +807,8 @@ Standard_Boolean IntTools_Tools::ComputeTolerance
     new Adaptor3d_CurveOnSurface(aGeom2dAdaptorCurve, aGeomAdaptorSurface);
 
   aCS.Init(aGeomAdaptorCurve, theTolRange);
-  aCS.Perform(anAdaptor3dCurveOnSurface, theToRunParallel);
+  aCS.SetParallel(theToRunParallel);
+  aCS.Perform(anAdaptor3dCurveOnSurface);
   if (!aCS.IsDone()) {
     return Standard_False;
   }
index 4fb705ac10a40f70a34719345a5d327c2d0bcf89..b1f35eccf03bdc84d1d6b9413a9efdda36405886 100755 (executable)
@@ -1,7 +1,7 @@
 pload TOPTEST
 
-# To prevent loops limit to 5 minutes
-cpulimit 300
+# Execution time limit to prevent loops
+cpulimit 1000
 
 if { [info exists imagedir] == 0 } {
    set imagedir .
index c1862aa347943865bae7218afbe0c2af4fefb044..71374563112ee0c3aca80f5e23d7911915a29115 100644 (file)
@@ -1,7 +1,7 @@
-puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_51"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_31"
 puts "=========="
 puts "0027814: Parallelize BRepCheck_Analyzer"
 puts "=========="
 puts ""
 
-CheckPerform [locate_data_file OCC394.brep]
\ No newline at end of file
+CheckPerform [locate_data_file OCC396.brep]
\ No newline at end of file
index 71374563112ee0c3aca80f5e23d7911915a29115..09fdb8611fc7acbc8b6bcfe64d056b2068692dba 100644 (file)
@@ -1,7 +1,7 @@
-puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_31"
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_287"
 puts "=========="
 puts "0027814: Parallelize BRepCheck_Analyzer"
 puts "=========="
 puts ""
 
-CheckPerform [locate_data_file OCC396.brep]
\ No newline at end of file
+CheckPerform [locate_data_file OCC54.brep]
\ No newline at end of file
diff --git a/tests/heal/checkshape/bug32448_1 b/tests/heal/checkshape/bug32448_1
new file mode 100644 (file)
index 0000000..a6f8cd3
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_88"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file bug27814.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_10 b/tests/heal/checkshape/bug32448_10
new file mode 100644 (file)
index 0000000..0984113
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_6101"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file OCC54.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_2 b/tests/heal/checkshape/bug32448_2
new file mode 100644 (file)
index 0000000..6e59a84
--- /dev/null
@@ -0,0 +1,7 @@
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file 5000-12.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_3 b/tests/heal/checkshape/bug32448_3
new file mode 100644 (file)
index 0000000..713da3b
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_3675"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file BPLSEITLI.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_4 b/tests/heal/checkshape/bug32448_4
new file mode 100644 (file)
index 0000000..7308858
--- /dev/null
@@ -0,0 +1,7 @@
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file bug24525_License.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_5 b/tests/heal/checkshape/bug32448_5
new file mode 100644 (file)
index 0000000..dc6652c
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_8234"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file bug26278_E01754_000000_P00_01_0_VS3_1_20070102_sewed_fixed.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_6 b/tests/heal/checkshape/bug32448_6
new file mode 100644 (file)
index 0000000..a1599c0
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_7656"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file bug30360_GES-13500-000.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_7 b/tests/heal/checkshape/bug32448_7
new file mode 100644 (file)
index 0000000..954d6bd
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_1943"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file OCC187_from_bug_description.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_8 b/tests/heal/checkshape/bug32448_8
new file mode 100644 (file)
index 0000000..b5befa2
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_502"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file OCC394.brep] b
+checkshape b -exact -parallel
diff --git a/tests/heal/checkshape/bug32448_9 b/tests/heal/checkshape/bug32448_9
new file mode 100644 (file)
index 0000000..a3b978b
--- /dev/null
@@ -0,0 +1,8 @@
+puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_467"
+puts "=========="
+puts "0032448: Provide exact validating (as option) using GeomLib_CheckCurveOnSurface"
+puts "=========="
+puts ""
+
+restore [locate_data_file OCC396.brep] b
+checkshape b -exact -parallel