1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
19 #include <BOPAlgo_Algo.hxx>
20 #include <Message_ProgressIndicator.hxx>
21 #include <NCollection_BaseAllocator.hxx>
22 #include <Precision.hxx>
23 #include <Standard_NotImplemented.hxx>
24 #include <Standard_ProgramError.hxx>
28 Standard_Boolean myGlobalRunParallel = Standard_False;
31 //=======================================================================
34 //=======================================================================
35 void BOPAlgo_Algo::SetParallelMode(Standard_Boolean theNewMode)
37 myGlobalRunParallel = theNewMode;
40 //=======================================================================
43 //=======================================================================
44 Standard_Boolean BOPAlgo_Algo::GetParallelMode()
46 return myGlobalRunParallel;
50 //=======================================================================
53 //=======================================================================
54 BOPAlgo_Algo::BOPAlgo_Algo()
56 myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
59 myRunParallel(myGlobalRunParallel),
60 myFuzzyValue(Precision::Confusion())
62 //=======================================================================
65 //=======================================================================
66 BOPAlgo_Algo::BOPAlgo_Algo
67 (const Handle(NCollection_BaseAllocator)& theAllocator)
69 myAllocator(theAllocator),
72 myRunParallel(myGlobalRunParallel),
73 myFuzzyValue(Precision::Confusion())
76 //=======================================================================
79 //=======================================================================
80 BOPAlgo_Algo::~BOPAlgo_Algo()
83 //=======================================================================
84 //function : Allocator
86 //=======================================================================
87 const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
91 //=======================================================================
92 // function: CheckData
94 //=======================================================================
95 void BOPAlgo_Algo::CheckData()
99 //=======================================================================
100 // function: CheckResult
102 //=======================================================================
103 void BOPAlgo_Algo::CheckResult()
107 //=======================================================================
108 // function: ErrorStatus
110 //=======================================================================
111 Standard_Integer BOPAlgo_Algo::ErrorStatus()const
113 return myErrorStatus;
115 //=======================================================================
116 // function: WarningStatus
118 //=======================================================================
119 Standard_Integer BOPAlgo_Algo::WarningStatus()const
121 return myWarningStatus;
123 //=======================================================================
124 //function : SetRunParallel
126 //=======================================================================
127 void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag)
129 myRunParallel=theFlag;
131 //=======================================================================
132 //function : RunParallel
134 //=======================================================================
135 Standard_Boolean BOPAlgo_Algo::RunParallel()const
137 return myRunParallel;
139 //=======================================================================
140 //function : SetFuzzyValue
142 //=======================================================================
143 void BOPAlgo_Algo::SetFuzzyValue(const Standard_Real theFuzz)
145 myFuzzyValue = Max(theFuzz, Precision::Confusion());
147 //=======================================================================
148 //function : FuzzyValue
150 //=======================================================================
151 Standard_Real BOPAlgo_Algo::FuzzyValue() const
155 //=======================================================================
156 //function : SetProgressIndicator
158 //=======================================================================
159 void BOPAlgo_Algo::SetProgressIndicator
160 (const Handle(Message_ProgressIndicator)& theObj)
162 if (!theObj.IsNull()) {
163 myProgressIndicator=theObj;
166 //=======================================================================
167 //function : UserBreak
169 //=======================================================================
170 void BOPAlgo_Algo::UserBreak() const
172 if (myProgressIndicator.IsNull()) {
175 if (myProgressIndicator->UserBreak()) {
176 Standard_NotImplemented::Raise("");
181 // 1 - object is just initialized