]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Partition.cpp
index 958bae8413b83aa9cd5c4204a1866583361c57da..6f689cf16c81091784972da80f3d7007b60c5a0a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "GeomAlgoAPI_Partition.h"
@@ -67,7 +66,8 @@ static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperat
 
   TopTools_MapOfShape anAlreadyThere; // to avoid duplications if it was produced by two arguments
 
-  bool aNotProduced = true;// flag to add to result also results that were not produced by any argument
+  // flag to add to result also results which were not produced by any argument
+  bool aNotProduced = true;
   TopTools_ListOfShape::Iterator anArgs(theOperation->Arguments());
   while(aNotProduced || anArgs.More()) {
     // collect shapes that were produced from the current argument
@@ -76,13 +76,15 @@ static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperat
       TopTools_ListOfShape allArgs;
       getHistorySupportedType(anArgs.Value(), allArgs);
       for (TopTools_ListOfShape::Iterator argsIter(allArgs); argsIter.More(); argsIter.Next()) {
-        aProducedByArg.Add(argsIter.Value()); // if argument was not modified, it is fully in the result
+        // if argument was not modified, it is fully in the result
+        aProducedByArg.Add(argsIter.Value());
         const TopTools_ListOfShape& aModified = theOperation->Modified(argsIter.Value());
         for (TopTools_ListOfShape::Iterator aModIter(aModified); aModIter.More(); aModIter.Next()) {
           aProducedByArg.Add(aModIter.Value());
         }
         const TopTools_ListOfShape& aGenerated = theOperation->Generated(argsIter.Value());
-        for (TopTools_ListOfShape::Iterator aGenIter(aGenerated); aGenIter.More(); aGenIter.Next()) {
+        for (TopTools_ListOfShape::Iterator aGenIter(aGenerated); aGenIter.More(); aGenIter.Next())
+        {
           aProducedByArg.Add(aGenIter.Value());
         }
       }
@@ -123,22 +125,12 @@ static void sortCompound(TopoDS_Shape& theCompound, GEOMAlgo_Splitter* theOperat
   theCompound = aResCompound;
 }
 
-//=================================================================================================
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Partition::make(const ListOfShape& theObjects,
-                                                           const ListOfShape& theTools)
-{
-  GeomAlgoAPI_Partition aPartitionAlgo(theObjects, theTools);
-  if(aPartitionAlgo.isDone() && !aPartitionAlgo.shape()->isNull() && aPartitionAlgo.isValid()) {
-    return aPartitionAlgo.shape();
-  }
-  return std::shared_ptr<GeomAPI_Shape>();
-}
-
 //=================================================================================================
 GeomAlgoAPI_Partition::GeomAlgoAPI_Partition(const ListOfShape& theObjects,
-                                             const ListOfShape& theTools)
+                                             const ListOfShape& theTools,
+                                             const double theFuzzy)
 {
-  build(theObjects, theTools);
+  build(theObjects, theTools, theFuzzy);
 }
 
 static void prepareShapes(const TopoDS_Shape&   theShape,
@@ -159,7 +151,8 @@ static void prepareShapes(const TopoDS_Shape&   theShape,
 
 //=================================================================================================
 void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects,
-                                  const ListOfShape& theTools)
+                                  const ListOfShape& theTools,
+                                  const double theFuzzy)
 {
   if (theObjects.empty()) {
     return;
@@ -205,6 +198,12 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects,
     }
   }
 
+  // Set parallel processing mode (default is false)
+  Standard_Boolean bRunParallel = Standard_True;
+  anOperation->SetRunParallel(bRunParallel);
+
+  if (theFuzzy > 0) anOperation->SetFuzzyValue(theFuzzy);
+
   // Building and getting result.
   anOperation->Perform();
   if (anOperation->HasErrors())