The Message_ProgressIndicator handle is added as a parameter to the function LU_Decompose and the the member functions of math_Gauss, Plate_Plate and GeomPlate_BuildPlateSurface classes.
#include <TColgp_SequenceOfVec.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_SequenceOfInteger.hxx>
+#include <Message_ProgressIndicator.hxx>
#include <stdio.h>
// pour la verif G2
//fonction : Perform
// Calcul la surface de remplissage avec les contraintes chargees
//---------------------------------------------------------
-void GeomPlate_BuildPlateSurface::Perform()
+void GeomPlate_BuildPlateSurface::Perform(const Handle(Message_ProgressIndicator) & aProgress)
{
#ifdef OCCT_DEBUG
// Chronmetrage
// Surface Initiale
//======================================================================
if (!mySurfInitIsGive)
- ComputeSurfInit();
+ ComputeSurfInit(aProgress);
else {
if (NTLinCont>=2)
//====================================================================
//Resolution de la surface
//====================================================================
- myPlate.SolveTI(myDegree, ComputeAnisotropie());
+
+ myPlate.SolveTI(myDegree, ComputeAnisotropie(), aProgress);
+
+ if (!aProgress.IsNull() && aProgress->UserBreak())
+ {
+ return;
+ }
+
if (!myPlate.IsDone())
{
#ifdef OCCT_DEBUG
cout << "WARNING : GeomPlate : abort calcul of Plate." << endl;
#endif
-
return;
}
//====================================================================
//Resolution de la surface
//====================================================================
- myPlate.SolveTI(myDegree, ComputeAnisotropie());
+ myPlate.SolveTI(myDegree, ComputeAnisotropie(), aProgress);
+
+ if (!aProgress.IsNull() && aProgress->UserBreak())
+ {
+ return;
+ }
+
if (!myPlate.IsDone())
{
#ifdef OCCT_DEBUG
// il y a des contraintes ponctuelles
//-------------------------------------------------------------------------
-void GeomPlate_BuildPlateSurface::ComputeSurfInit()
+void GeomPlate_BuildPlateSurface::ComputeSurfInit(const Handle(Message_ProgressIndicator) & aProgress)
{
Standard_Integer nopt=2, popt=2, Np=1;
Standard_Boolean isHalfSpace = Standard_True;
//====================================================================
//Resolution de la surface
//====================================================================
- myPlate.SolveTI(2, ComputeAnisotropie());
+ myPlate.SolveTI(2, ComputeAnisotropie(), aProgress);
+ if (!aProgress.IsNull() && aProgress->UserBreak())
+ {
+ return;
+ }
+
if (!myPlate.IsDone())
{
#ifdef OCCT_DEBUG
class Geom2d_Curve;
class Adaptor3d_HCurve;
class Adaptor2d_HCurve2d;
+class Message_ProgressIndicator;
//! Exceptions
//! Standard_RangeError if the value of the constraint is
//! null or if plate is not done.
- Standard_EXPORT void Perform();
+ Standard_EXPORT void Perform(const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
//! returns the CurveConstraints of order order
Standard_EXPORT Handle(GeomPlate_CurveConstraint) CurveConstraint (const Standard_Integer order) const;
Standard_EXPORT Handle(Adaptor2d_HCurve2d) ProjectedCurve (Handle(Adaptor3d_HCurve)& Curv);
- Standard_EXPORT void ComputeSurfInit();
+ Standard_EXPORT void ComputeSurfInit(const Handle(Message_ProgressIndicator) & aProgress);
Standard_EXPORT void Intersect (Handle(GeomPlate_HArray1OfSequenceOfReal)& PntInter, Handle(GeomPlate_HArray1OfSequenceOfReal)& PntG1G1);
#include <Plate_Plate.hxx>
#include <Plate_SampledCurveConstraint.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <Message_ProgressIndicator.hxx>
//=======================================================================
//function : Plate_Plate
//=======================================================================
void Plate_Plate::SolveTI(const Standard_Integer ord,
- const Standard_Real anisotropie)
+ const Standard_Real anisotropie,
+ const Handle(Message_ProgressIndicator) & aProgress)
{
Standard_Integer IterationNumber=0;
OK = Standard_False;
ddv[0] = 1;
for(i=1;i<=9;i++) ddv[i] = ddv[i-1] / dv;
-
if(myLScalarConstraints.IsEmpty())
{
if(myLXYZConstraints.IsEmpty())
- SolveTI1(IterationNumber);
+ SolveTI1(IterationNumber, aProgress);
else
- SolveTI2(IterationNumber);
+ SolveTI2(IterationNumber, aProgress);
}
else
- SolveTI3(IterationNumber);
+ SolveTI3(IterationNumber, aProgress);
}
// only PinPointConstraints are loaded
//=======================================================================
-void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber)
+void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress)
{
// computation of square matrix members
Standard_Real pivot_max = 1.e-12;
OK = Standard_True;
- math_Gauss algo_gauss(mat,pivot_max);
+ math_Gauss algo_gauss(mat,pivot_max, aProgress);
+
+ if (!aProgress.IsNull() && aProgress->UserBreak())
+ {
+ OK = Standard_False;
+ return;
+ }
+
if(!algo_gauss.IsDone()) {
Standard_Integer nbm = order*(order+1)/2;
for(i=n_el;i<n_el+nbm;i++) {
mat(i,i) = 1.e-8;
}
pivot_max = 1.e-18;
- math_Gauss thealgo(mat,pivot_max);
+ math_Gauss thealgo(mat,pivot_max, aProgress);
algo_gauss = thealgo;
OK = algo_gauss.IsDone();
}
// LinearXYZ constraints are provided but no LinearScalar one
//=======================================================================
-void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber)
+void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress)
{
// computation of square matrix members
Standard_Real pivot_max = 1.e-12;
OK = Standard_True; // ************ JHH
- math_Gauss algo_gauss(mat,pivot_max);
+ math_Gauss algo_gauss(mat,pivot_max, aProgress);
+
+ if (!aProgress.IsNull() && aProgress->UserBreak ())
+ {
+ OK = Standard_False;
+ return;
+ }
+
if(!algo_gauss.IsDone()) {
for(i=nCC1+nCC2;i<n_dimat;i++) {
mat(i,i) = 1.e-8;
}
pivot_max = 1.e-18;
- math_Gauss thealgo1(mat,pivot_max);
+ math_Gauss thealgo1(mat,pivot_max, aProgress);
algo_gauss = thealgo1;
OK = algo_gauss.IsDone();
}
//purpose : to solve the set of constraints in the most general situation
//=======================================================================
-void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber)
+void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress)
{
// computation of square matrix members
Standard_Real pivot_max = 1.e-12;
OK = Standard_True; // ************ JHH
- math_Gauss algo_gauss(mat,pivot_max);
+ math_Gauss algo_gauss(mat,pivot_max, aProgress);
+
+ if (!aProgress.IsNull() && aProgress->UserBreak ())
+ {
+ OK = Standard_False;
+ return;
+ }
+
if(!algo_gauss.IsDone()) {
for(i=nCC1+nCC2;i<nCC1+nCC2+nbm;i++) {
mat(i,i) = 1.e-8;
mat(2*n_dimsousmat+i,2*n_dimsousmat+i) = 1.e-8;
}
pivot_max = 1.e-18;
- math_Gauss thealgo2(mat,pivot_max);
+ math_Gauss thealgo2(mat,pivot_max, aProgress);
algo_gauss = thealgo2;
OK = algo_gauss.IsDone();
}
#include <Standard_Real.hxx>
#include <TColgp_HArray2OfXYZ.hxx>
#include <TColgp_SequenceOfXY.hxx>
+
class Plate_PinpointConstraint;
class Plate_LinearXYZConstraint;
class Plate_LinearScalarConstraint;
class gp_XYZ;
class gp_XY;
class math_Matrix;
+class Message_ProgressIndicator;
//! This class implement a variationnal spline algorithm able
Standard_EXPORT void Load (const Plate_FreeGtoCConstraint& FGtoCConst);
- Standard_EXPORT void SolveTI (const Standard_Integer ord = 4, const Standard_Real anisotropie = 1.0);
+ Standard_EXPORT void SolveTI (const Standard_Integer ord = 4,
+ const Standard_Real anisotropie = 1.0,
+ const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
//! returns True if all has been correctly done.
Standard_EXPORT Standard_Boolean IsDone() const;
gp_XY& Points (const Standard_Integer index) const;
- Standard_EXPORT void SolveTI1 (const Standard_Integer IterationNumber);
+ Standard_EXPORT void SolveTI1 (const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress = NULL);
- Standard_EXPORT void SolveTI2 (const Standard_Integer IterationNumber);
+ Standard_EXPORT void SolveTI2 (const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress = NULL);
- Standard_EXPORT void SolveTI3 (const Standard_Integer IterationNumber);
+ Standard_EXPORT void SolveTI3 (const Standard_Integer IterationNumber, const Handle(Message_ProgressIndicator) & aProgress = NULL);
Standard_EXPORT void fillXYZmatrix (math_Matrix& mat, const Standard_Integer i0, const Standard_Integer j0, const Standard_Integer ncc1, const Standard_Integer ncc2) const;
#include <StdFail_NotDone.hxx>
math_Gauss::math_Gauss(const math_Matrix& A,
- const Standard_Real MinPivot)
+ const Standard_Real MinPivot,
+ const Handle(Message_ProgressIndicator) & aProgress)
: LU (1, A.RowNumber(), 1, A.ColNumber()),
Index(1, A.RowNumber()) {
Standard_Integer Error = LU_Decompose(LU,
Index,
D,
- MinPivot);
+ MinPivot,
+ aProgress);
if(!Error) {
Done = Standard_True;
}
#include <Standard_Real.hxx>
#include <math_Vector.hxx>
#include <Standard_OStream.hxx>
+
class math_NotSquare;
class Standard_DimensionError;
class StdFail_NotDone;
class math_Matrix;
+class Message_ProgressIndicator;
//! If the largest pivot found is less than MinPivot the matrix A is
//! considered as singular.
//! Exception NotSquare is raised if A is not a square matrix.
- Standard_EXPORT math_Gauss(const math_Matrix& A, const Standard_Real MinPivot = 1.0e-20);
+ Standard_EXPORT math_Gauss(const math_Matrix& A,
+ const Standard_Real MinPivot = 1.0e-20,
+ const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
//! Returns true if the computations are successful, otherwise returns false
Standard_Boolean IsDone() const;
#include <Standard_Failure.hxx>
#include <Standard_NotImplemented.hxx>
+#include <Message_ProgressSentry.hxx>
#include <math_Vector.hxx>
#include <math_IntegerVector.hxx>
math_IntegerVector& indx,
Standard_Real& d,
math_Vector& vv,
- Standard_Real TINY) {
+ Standard_Real TINY,
+ const Handle(Message_ProgressIndicator) & aProgress) {
Standard_Integer i, imax=0, j, k;
Standard_Real big, dum, sum, temp;
Standard_Integer n = a.RowNumber();
d = 1.0;
+ Message_ProgressSentry aPSentry(aProgress, "", 0, n, 1);
+
for(i = 1; i <= n; i++) {
big = 0.0;
for (j = 1; j <= n; j++)
}
vv(i) = 1.0 / big;
}
- for(j = 1; j <= n; j++) {
+
+ for(j = 1; j <= n && aPSentry.More(); j++, aPSentry.Next()) {
for(i = 1; i < j; i++) {
sum = a(i,j);
for(k = 1; k < i; k++)
a(i,j) *= dum;
}
}
+
+ if (j <= n)
+ {
+ return math_Status_UserAborted;
+ }
+
return math_Status_OK;
}
Standard_Integer LU_Decompose(math_Matrix& a,
math_IntegerVector& indx,
Standard_Real& d,
- Standard_Real TINY) {
+ Standard_Real TINY,
+ const Handle(Message_ProgressIndicator) & aProgress) {
math_Vector vv(1, a.RowNumber());
- return LU_Decompose(a, indx, d, vv, TINY);
+ return LU_Decompose(a, indx, d, vv, TINY, aProgress);
}
void LU_Solve(const math_Matrix& a,
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
+#include <Standard_Handle.hxx>
class math_IntegerVector;
class math_Vector;
class math_Matrix;
+class Message_ProgressIndicator;
-
+const Standard_Integer math_Status_UserAborted = -1;
const Standard_Integer math_Status_OK = 0;
const Standard_Integer math_Status_SingularMatrix = 1;
const Standard_Integer math_Status_ArgumentError = 2;
Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a,
math_IntegerVector& indx,
Standard_Real& d,
- Standard_Real TINY = 1.0e-20);
+ Standard_Real TINY = 1.0e-20,
+ const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
// Given a matrix a(1..n, 1..n), this routine computes its LU decomposition,
// The matrix a is replaced by this LU decomposition and the vector indx(1..n)
math_IntegerVector& indx,
Standard_Real& d,
math_Vector& vv,
- Standard_Real TINY = 1.0e-30);
+ Standard_Real TINY = 1.0e-30,
+ const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
// Idem to the previous LU_Decompose function. But the input Vector vv(1..n) is
// used internally as a scratch area.