//function :
//purpose :
//=======================================================================
- BOPAlgo_Builder::BOPAlgo_Builder()
+BOPAlgo_Builder::BOPAlgo_Builder()
:
BOPAlgo_BuilderShape(),
myArguments(myAllocator),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
- myOrigins(100, myAllocator)
+ myOrigins(100, myAllocator),
+ myRunParallel(Standard_False)
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
- BOPAlgo_Builder::BOPAlgo_Builder(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPAlgo_Builder::BOPAlgo_Builder
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_BuilderShape(theAllocator),
myArguments(myAllocator),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
mySplits(100, myAllocator),
- myOrigins(100, myAllocator)
+ myOrigins(100, myAllocator),
+ myRunParallel(Standard_False)
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
- BOPAlgo_Builder::~BOPAlgo_Builder()
+BOPAlgo_Builder::~BOPAlgo_Builder()
{
if (myEntryPoint==1) {
if (myPaveFiller) {
//function : Clear
//purpose :
//=======================================================================
- void BOPAlgo_Builder::Clear()
+void BOPAlgo_Builder::Clear()
{
myArguments.Clear();
myMapFence.Clear();
myOrigins.Clear();
}
//=======================================================================
+//function : SetRunParallel
+//purpose :
+//=======================================================================
+void BOPAlgo_Builder::SetRunParallel(const Standard_Boolean theFlag)
+{
+ myRunParallel=theFlag;
+}
+//=======================================================================
+//function : RunParallel
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_Builder::RunParallel()const
+{
+ return myRunParallel;
+}
+//=======================================================================
//function : AddArgument
//purpose :
//=======================================================================
- void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
+void BOPAlgo_Builder::AddArgument(const TopoDS_Shape& theShape)
{
if (myMapFence.Add(theShape)) {
myArguments.Append(theShape);
//function : Arguments
//purpose :
//=======================================================================
- const BOPCol_ListOfShape& BOPAlgo_Builder::Arguments()const
+const BOPCol_ListOfShape& BOPAlgo_Builder::Arguments()const
{
return myArguments;
}
//function : Images
//purpose :
//=======================================================================
- const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Images()const
+const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Images()const
{
return myImages;
}
//function : Origins
//purpose :
//=======================================================================
- const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::Origins()const
+const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::Origins()const
{
return myOrigins;
}
//function : ShapesSd
//purpose :
//=======================================================================
- const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::ShapesSD()const
+const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::ShapesSD()const
{
return myShapesSD;
}
//function : Splits
//purpose :
//=======================================================================
- const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Splits()const
+const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Splits()const
{
return mySplits;
}
//function : PPaveFiller
//purpose :
//=======================================================================
- BOPAlgo_PPaveFiller BOPAlgo_Builder::PPaveFiller()
+BOPAlgo_PPaveFiller BOPAlgo_Builder::PPaveFiller()
{
return myPaveFiller;
}
//function : PDS
//purpose :
//=======================================================================
- BOPDS_PDS BOPAlgo_Builder::PDS()
+BOPDS_PDS BOPAlgo_Builder::PDS()
{
return myDS;
}
// function: CheckData
// purpose:
//=======================================================================
- void BOPAlgo_Builder::CheckData()
+void BOPAlgo_Builder::CheckData()
{
Standard_Integer aNb;
//
//function : Prepare
//purpose :
//=======================================================================
- void BOPAlgo_Builder::Prepare()
+void BOPAlgo_Builder::Prepare()
{
myErrorStatus=0;
//
//function : Perform
//purpose :
//=======================================================================
- void BOPAlgo_Builder::Perform()
+void BOPAlgo_Builder::Perform()
{
myErrorStatus=0;
//
//function : PerformWithFiller
//purpose :
//=======================================================================
- void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
+void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
{
myEntryPoint=0;
PerformInternal(theFiller);
//function : PerformInternal
//purpose :
//=======================================================================
- void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
+void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
//
//function : PostTreat
//purpose :
//=======================================================================
- void BOPAlgo_Builder::PostTreat()
+void BOPAlgo_Builder::PostTreat()
{
//BRepLib::SameParameter(myShape, 1.e-7, Standard_True);
BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05);
aNbBF=aVBF.Extent();
//
//===================================================
- bRunParallel=Standard_True;
- BOPAlgo_BuilderFaceCnt::Perform(bRunParallel, aVBF);
+ BOPAlgo_BuilderFaceCnt::Perform(myRunParallel, aVBF);
//===================================================
//
for (k=0; k<(Standard_Integer)aNbBF; ++k) {
//
aIDMSS.Clear();
//
- Standard_Boolean bRunParallel, bFlagSD;
+ Standard_Boolean bFlagSD;
Standard_Integer aNbVPSB, aNbVVS, aNbF, aNbF1;
BOPAlgo_VectorOfPairOfShapeBoolean aVPSB;
//
}
}
//====================================================
- bRunParallel=Standard_True;
- BOPAlgo_BuilderSDFaceCnt::Perform(bRunParallel, aVPSB);
+ BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB);
//====================================================
aAllocator=new NCollection_IncAllocator();
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS(100, aAllocator);
#include <BOPTest.ixx>
#include <stdio.h>
+#include <string.h>
#include <NCollection_IncAllocator.hxx>
#include <BOPTest_Objects.hxx>
//
+#ifdef HAVE_TBB
+#include <BOPCol_TBB.hxx>
+//=======================================================================
+//class : BOPTime_Chronometer
+//purpose :
+//=======================================================================
+class BOPTime_Chronometer {
+ public:
+ BOPTime_Chronometer() {
+ }
+ //
+ ~BOPTime_Chronometer() {
+ }
+ //
+ void Start() {
+ myT0 = tick_count::now();
+ }
+ //
+ void Stop() {
+ myTime=(tick_count::now() - myT0).seconds();
+ }
+ //
+ double Time() const{
+ return myTime;
+ };
+ //
+ protected:
+ tick_count myT0;
+ double myTime;
+};
+////////////////////////////////////////////////////////////////////////
+#else
+#include <OSD_Chronometer.hxx>
+//=======================================================================
+//class : BOPTime_Chronometer
+//purpose :
+//=======================================================================
+class BOPTime_Chronometer {
+ public:
+ BOPTime_Chronometer() {
+ }
+ //
+ ~BOPTime_Chronometer() {
+ }
+ //
+ void Start() {
+ myChronometer.Reset();
+ myChronometer.Start();
+ }
+ //
+ void Stop() {
+ myChronometer.Stop();
+ myChronometer.Show(myTime);
+ }
+ //
+ double Time() const{
+ return myTime;
+ };
+ //
+ protected:
+ OSD_Chronometer myChronometer;
+ double myTime;
+};
+#endif
+
+
+
static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**);
const char* g = "Partition commands";
// Commands
theCommands.Add("bfillds" , "use bfillds" , __FILE__, bfillds , g);
- theCommands.Add("bbuild" , "use bbuild r" , __FILE__, bbuild, g);
+ theCommands.Add("bbuild" , " use bbuild r [-s -t]" , __FILE__, bbuild, g);
theCommands.Add("bbop" , "use bbop r op" , __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
}
//
return 0;
}
-
//=======================================================================
//function : bbuild
//purpose :
//=======================================================================
Standard_Integer bbuild(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
- if (n!=2) {
- di << " Use bbuild r\n";
+ if (n<2) {
+ di << " use bbuild r [-s -t]\n";
return 0;
}
//
return 0;
}
//
- char buf[32];
- Standard_Integer iErr;
+ char buf[128];
+ Standard_Boolean bRunParallel, bShowTime;
+ Standard_Integer i, iErr;
+
+ BOPTime_Chronometer aChrono;
BOPCol_ListIteratorOfListOfShape aIt;
+ //
+
//
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
//
aBuilder.AddArgument(aS);
}
//
- aBuilder.PerformWithFiller(aPF);
+ bShowTime=Standard_False;
+ bRunParallel=Standard_True;
+ for (i=2; i<n; ++i) {
+ if (!strcmp(a[i], "-s")) {
+ bRunParallel=Standard_False;
+ }
+ else if (!strcmp(a[i], "-t")) {
+ bShowTime=Standard_True;
+ }
+ }
+ aBuilder.SetRunParallel(bRunParallel);
+ //
+ //
+ aChrono.Start();
+ //
+ aBuilder.PerformWithFiller(aPF);
iErr=aBuilder.ErrorStatus();
if (iErr) {
Sprintf(buf, " error: %d\n", iErr);
return 0;
}
//
+ aChrono.Stop();
+ //
+ if (bShowTime) {
+ Standard_Real aTime;
+ //
+ aTime=aChrono.Time();
+ Sprintf(buf, " Tps: %7.2lf\n", aTime);
+ di << buf;
+ }
+ //
const TopoDS_Shape& aR=aBuilder.Shape();
if (aR.IsNull()) {
di << " null shape\n";