mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0022550: Fixing data races
This commit is contained in:
@@ -270,5 +270,7 @@ mysquares: Boolean from Standard;
|
||||
myitermax: Integer from Standard;
|
||||
myfirstC: Constraint from AppParCurves;
|
||||
mylastC: Constraint from AppParCurves;
|
||||
myMultiLineNb: Integer from Standard;
|
||||
myIsClear : Boolean from Standard;
|
||||
|
||||
end ComputeLine;
|
||||
|
@@ -23,9 +23,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static Standard_Boolean IsClear = Standard_False;
|
||||
static Standard_Integer nbML = 0;
|
||||
|
||||
#ifdef DEB
|
||||
static Standard_Boolean mydebug = Standard_False;
|
||||
|
||||
@@ -391,6 +388,8 @@ Approx_ComputeLine::Approx_ComputeLine
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Boolean cutting,
|
||||
const Standard_Boolean Squares)
|
||||
: myMultiLineNb (0),
|
||||
myIsClear (Standard_False)
|
||||
{
|
||||
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
|
||||
Parameters.Upper());
|
||||
@@ -422,6 +421,8 @@ Approx_ComputeLine::Approx_ComputeLine
|
||||
const Standard_Integer NbIterations,
|
||||
const Standard_Boolean cutting,
|
||||
const Standard_Boolean Squares)
|
||||
: myMultiLineNb (0),
|
||||
myIsClear (Standard_False)
|
||||
{
|
||||
myfirstParam = new TColStd_HArray1OfReal(Parameters.Lower(),
|
||||
Parameters.Upper());
|
||||
@@ -451,6 +452,8 @@ Approx_ComputeLine::Approx_ComputeLine
|
||||
const Standard_Boolean cutting,
|
||||
const Approx_ParametrizationType parametrization,
|
||||
const Standard_Boolean Squares)
|
||||
: myMultiLineNb (0),
|
||||
myIsClear (Standard_False)
|
||||
{
|
||||
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
|
||||
Par = parametrization;
|
||||
@@ -477,6 +480,8 @@ Approx_ComputeLine::Approx_ComputeLine
|
||||
const Standard_Boolean cutting,
|
||||
const Approx_ParametrizationType parametrization,
|
||||
const Standard_Boolean Squares)
|
||||
: myMultiLineNb (0),
|
||||
myIsClear (Standard_False)
|
||||
{
|
||||
myConstraints = new AppParCurves_HArray1OfConstraintCouple(1, 2);
|
||||
alldone = Standard_False;
|
||||
@@ -501,14 +506,15 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
|
||||
#ifdef DEB
|
||||
if (mydebug) DUMP(Line);
|
||||
#endif
|
||||
if (!IsClear) {
|
||||
if (!myIsClear)
|
||||
{
|
||||
myMultiCurves.Clear();
|
||||
myPar.Clear();
|
||||
Tolers3d.Clear();
|
||||
Tolers2d.Clear();
|
||||
nbML = 0;
|
||||
myMultiLineNb = 0;
|
||||
}
|
||||
else IsClear = Standard_False;
|
||||
else myIsClear = Standard_False;
|
||||
|
||||
Standard_Integer i, nbp, Thefirstpt, Thelastpt, oldlastpt;
|
||||
Standard_Boolean Finish = Standard_False,
|
||||
@@ -613,8 +619,8 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
|
||||
-LineTool::LastPoint(OtherLine);
|
||||
|
||||
//-- Si MakeML a echoue on retourne une ligne vide
|
||||
|
||||
if( (nbpdsotherligne == 0) || nbML >= 3) {
|
||||
if ((nbpdsotherligne == 0) || myMultiLineNb >= 3)
|
||||
{
|
||||
FailOnPointsAdded = Standard_True;
|
||||
//-- cout<<" ** ApproxComputeLine MakeML Echec ** LBR lbr "<<endl;
|
||||
if (myfirstpt == mylastpt) break; // Pour etre sur de ne pas
|
||||
@@ -676,12 +682,13 @@ void Approx_ComputeLine::Perform(const MultiLine& Line)
|
||||
mylastpt = Thelastpt;
|
||||
|
||||
}
|
||||
else {
|
||||
IsClear = Standard_True;
|
||||
nbML++;
|
||||
else
|
||||
{
|
||||
myIsClear = Standard_True;
|
||||
++myMultiLineNb;
|
||||
Perform(OtherLine);
|
||||
myfirstpt = mylastpt;
|
||||
mylastpt = Thelastpt;
|
||||
mylastpt = Thelastpt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <CPnts_AbscissaPoint.hxx>
|
||||
#include <Approx_CurvlinFunc.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
#include <OSD_Timer.hxx>
|
||||
static OSD_Chronometer chr_total, chr_init, chr_approx;
|
||||
|
||||
@@ -118,7 +118,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments)
|
||||
{
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
t_total = t_init = t_approx = t_uparam = 0;
|
||||
uparam_count = 0;
|
||||
InitChron(chr_total);
|
||||
@@ -131,11 +131,11 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
||||
ThreeDTol->Init(Tol);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_init);
|
||||
#endif
|
||||
Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C3D, Tol/10);
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_init, t_init);
|
||||
#endif
|
||||
|
||||
@@ -150,7 +150,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
|
||||
fonct->Intervals(CutPnts_C3,GeomAbs_C3);
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_approx);
|
||||
#endif
|
||||
|
||||
@@ -161,7 +161,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
|
||||
MaxDegree, MaxSegments,
|
||||
evC, CutTool);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_approx, t_approx);
|
||||
#endif
|
||||
|
||||
@@ -178,7 +178,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor3d_
|
||||
}
|
||||
myMaxError3d = aApprox.MaxError(3,1);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_total, t_total);
|
||||
|
||||
cout<<" total reparametrization time = "<<t_total<<endl;
|
||||
@@ -256,7 +256,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
const Standard_Integer MaxDegree,
|
||||
const Standard_Integer MaxSegments)
|
||||
{
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
t_total = t_init = t_approx = t_uparam = 0;
|
||||
uparam_count = 0;
|
||||
InitChron(chr_total);
|
||||
@@ -281,11 +281,11 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
||||
ThreeDTol->Init(Tol/2.);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_init);
|
||||
#endif
|
||||
Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D, Surf, Tol/20);
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_init, t_init);
|
||||
#endif
|
||||
|
||||
@@ -300,7 +300,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
fonct->Intervals(CutPnts_C3,GeomAbs_C3);
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_approx);
|
||||
#endif
|
||||
|
||||
@@ -311,7 +311,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
MaxDegree, MaxSegments,
|
||||
evCOnS, CutTool);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_approx, t_approx);
|
||||
#endif
|
||||
|
||||
@@ -339,7 +339,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
myMaxError2d1 = Max (aApprox.MaxError(1,1),aApprox.MaxError(1,2));
|
||||
myMaxError3d = aApprox.MaxError(3,1);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_total, t_total);
|
||||
|
||||
cout<<" total reparametrization time = "<<t_total<<endl;
|
||||
@@ -421,7 +421,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
{
|
||||
Standard_Integer i;
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
t_total = t_init = t_approx = t_uparam = 0;
|
||||
uparam_count = 0;
|
||||
InitChron(chr_total);
|
||||
@@ -446,11 +446,11 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
Handle(TColStd_HArray1OfReal) ThreeDTol = new TColStd_HArray1OfReal(1,Num3DSS);
|
||||
ThreeDTol->Init(Tol/2);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_init);
|
||||
#endif
|
||||
Handle(Approx_CurvlinFunc) fonct = new Approx_CurvlinFunc(C2D1, C2D2, Surf1, Surf2, Tol/20);
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_init, t_init);
|
||||
#endif
|
||||
|
||||
@@ -465,7 +465,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
fonct->Intervals(CutPnts_C3,GeomAbs_C3);
|
||||
AdvApprox_PrefAndRec CutTool(CutPnts_C2,CutPnts_C3);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_approx);
|
||||
#endif
|
||||
|
||||
@@ -476,7 +476,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
MaxDegree, MaxSegments,
|
||||
evCOn2S, CutTool);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_approx, t_approx);
|
||||
#endif
|
||||
|
||||
@@ -512,7 +512,7 @@ Approx_CurvilinearParameter::Approx_CurvilinearParameter(const Handle(Adaptor2d_
|
||||
myMaxError2d2 = Max (aApprox.MaxError(1,3),aApprox.MaxError(1,4));
|
||||
myMaxError3d = aApprox.MaxError(3,1);
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_total, t_total);
|
||||
|
||||
cout<<" total reparametrization time = "<<t_total<<endl;
|
||||
|
@@ -141,7 +141,9 @@ fields
|
||||
myLength1: Real from Standard;
|
||||
myLength2: Real from Standard;
|
||||
myTolLen : Real from Standard;
|
||||
|
||||
myPrevS : Real from Standard; -- should be mutable
|
||||
myPrevU : Real from Standard; -- should be mutable
|
||||
|
||||
myUi_1 : HArray1OfReal from TColStd;
|
||||
mySi_1 : HArray1OfReal from TColStd;
|
||||
myUi_2 : HArray1OfReal from TColStd;
|
||||
|
@@ -12,8 +12,7 @@
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
static Standard_Real myPrevS, myPrevU;
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
#include <OSD_Timer.hxx>
|
||||
static OSD_Chronometer chr_uparam;
|
||||
Standard_EXPORT Standard_Integer uparam_count;
|
||||
@@ -98,7 +97,9 @@ Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor3d_HCurve)& C, const
|
||||
myCase(1),
|
||||
myFirstS(0),
|
||||
myLastS(1),
|
||||
myTolLen(Tol)
|
||||
myTolLen(Tol),
|
||||
myPrevS (0.0),
|
||||
myPrevU (0.0)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -109,7 +110,9 @@ Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_HCurve2d)& C2D, co
|
||||
myCase(2),
|
||||
myFirstS(0),
|
||||
myLastS(1),
|
||||
myTolLen(Tol)
|
||||
myTolLen(Tol),
|
||||
myPrevS (0.0),
|
||||
myPrevU (0.0)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -122,7 +125,9 @@ Approx_CurvlinFunc::Approx_CurvlinFunc(const Handle(Adaptor2d_HCurve2d)& C2D1, c
|
||||
myCase(3),
|
||||
myFirstS(0),
|
||||
myLastS(1),
|
||||
myTolLen(Tol)
|
||||
myTolLen(Tol),
|
||||
myPrevS (0.0),
|
||||
myPrevU (0.0)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@@ -206,8 +211,9 @@ void Approx_CurvlinFunc::Init(Adaptor3d_Curve& C, Handle(TColStd_HArray1OfReal)&
|
||||
for(i = Si->Lower(); i<= Si->Upper(); i++)
|
||||
Si->ChangeValue(i) /= Len;
|
||||
|
||||
myPrevS = myFirstS;
|
||||
myPrevU = FirstU;
|
||||
// TODO - fields should be mutable
|
||||
const_cast<Approx_CurvlinFunc*>(this)->myPrevS = myFirstS;
|
||||
const_cast<Approx_CurvlinFunc*>(this)->myPrevU = FirstU;
|
||||
}
|
||||
|
||||
void Approx_CurvlinFunc::SetTol(const Standard_Real Tol)
|
||||
@@ -431,7 +437,7 @@ Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve& C,
|
||||
Standard_Real deltaS, base, U, Length;
|
||||
Standard_Integer NbInt, NInterval, i;
|
||||
Handle(TColStd_HArray1OfReal) InitUArray, InitSArray;
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
InitChron(chr_uparam);
|
||||
#endif
|
||||
if(S < 0 || S > 1) Standard_ConstructionError::Raise("Approx_CurvlinFunc::GetUParameter");
|
||||
@@ -477,10 +483,11 @@ Standard_Real Approx_CurvlinFunc::GetUParameter(Adaptor3d_Curve& C,
|
||||
|
||||
U = GCPnts_AbscissaPoint(C, deltaS, base, UGuess, myTolLen).Parameter();
|
||||
|
||||
myPrevS = S;
|
||||
myPrevU = U;
|
||||
// TODO - fields should be mutable
|
||||
const_cast<Approx_CurvlinFunc*>(this)->myPrevS = S;
|
||||
const_cast<Approx_CurvlinFunc*>(this)->myPrevU = U;
|
||||
|
||||
#ifdef DEB
|
||||
#ifdef __OCC_DEBUG_CHRONO
|
||||
ResultChron(chr_uparam, t_uparam);
|
||||
uparam_count++;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user