mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-10 12:25:50 +03:00
0029719: Modeling Algorithms - GeomPlate_BuildPlateSurface has no progress information and is not abortable
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.
This commit is contained in:
parent
25c35042b6
commit
9f785738a1
@ -72,6 +72,7 @@
|
||||
#include <TColgp_SequenceOfVec.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
// pour la verif G2
|
||||
@ -455,7 +456,7 @@ void GeomPlate_BuildPlateSurface::
|
||||
//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
|
||||
@ -488,7 +489,7 @@ void GeomPlate_BuildPlateSurface::Perform()
|
||||
// Surface Initiale
|
||||
//======================================================================
|
||||
if (!mySurfInitIsGive)
|
||||
ComputeSurfInit();
|
||||
ComputeSurfInit(aProgress);
|
||||
|
||||
else {
|
||||
if (NTLinCont>=2)
|
||||
@ -658,13 +659,19 @@ void GeomPlate_BuildPlateSurface::Perform()
|
||||
//====================================================================
|
||||
//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;
|
||||
}
|
||||
|
||||
@ -692,7 +699,13 @@ void GeomPlate_BuildPlateSurface::Perform()
|
||||
//====================================================================
|
||||
//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
|
||||
@ -1354,7 +1367,7 @@ Standard_Boolean GeomPlate_BuildPlateSurface::
|
||||
// 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;
|
||||
@ -1719,7 +1732,12 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit()
|
||||
//====================================================================
|
||||
//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
|
||||
|
@ -46,6 +46,7 @@ class gp_Pnt;
|
||||
class Geom2d_Curve;
|
||||
class Adaptor3d_HCurve;
|
||||
class Adaptor2d_HCurve2d;
|
||||
class Message_ProgressIndicator;
|
||||
|
||||
|
||||
|
||||
@ -130,7 +131,7 @@ public:
|
||||
//! 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;
|
||||
@ -217,7 +218,7 @@ private:
|
||||
|
||||
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);
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <Plate_Plate.hxx>
|
||||
#include <Plate_SampledCurveConstraint.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Message_ProgressIndicator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Plate_Plate
|
||||
@ -249,7 +250,8 @@ void Plate_Plate::Load(const Plate_GlobalTranslationConstraint& GTConst)
|
||||
//=======================================================================
|
||||
|
||||
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;
|
||||
@ -277,16 +279,15 @@ void Plate_Plate::SolveTI(const Standard_Integer ord,
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@ -296,7 +297,7 @@ void Plate_Plate::SolveTI(const Standard_Integer ord,
|
||||
// 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
|
||||
|
||||
@ -349,14 +350,21 @@ void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber)
|
||||
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();
|
||||
}
|
||||
@ -400,7 +408,7 @@ void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber)
|
||||
// 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
|
||||
|
||||
@ -447,13 +455,20 @@ void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber)
|
||||
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();
|
||||
}
|
||||
@ -524,7 +539,7 @@ void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber)
|
||||
//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
|
||||
|
||||
@ -705,7 +720,14 @@ void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber)
|
||||
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;
|
||||
@ -713,7 +735,7 @@ void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber)
|
||||
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();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_HArray2OfXYZ.hxx>
|
||||
#include <TColgp_SequenceOfXY.hxx>
|
||||
|
||||
class Plate_PinpointConstraint;
|
||||
class Plate_LinearXYZConstraint;
|
||||
class Plate_LinearScalarConstraint;
|
||||
@ -42,6 +43,7 @@ class Plate_FreeGtoCConstraint;
|
||||
class gp_XYZ;
|
||||
class gp_XY;
|
||||
class math_Matrix;
|
||||
class Message_ProgressIndicator;
|
||||
|
||||
|
||||
//! This class implement a variationnal spline algorithm able
|
||||
@ -82,7 +84,9 @@ Plate_Plate& operator= (const Plate_Plate& Ref)
|
||||
|
||||
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;
|
||||
@ -135,11 +139,11 @@ private:
|
||||
|
||||
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;
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
#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()) {
|
||||
|
||||
@ -37,7 +38,8 @@ math_Gauss::math_Gauss(const math_Matrix& A,
|
||||
Standard_Integer Error = LU_Decompose(LU,
|
||||
Index,
|
||||
D,
|
||||
MinPivot);
|
||||
MinPivot,
|
||||
aProgress);
|
||||
if(!Error) {
|
||||
Done = Standard_True;
|
||||
}
|
||||
|
@ -27,10 +27,12 @@
|
||||
#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;
|
||||
|
||||
|
||||
|
||||
@ -55,7 +57,9 @@ public:
|
||||
//! 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;
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Message_ProgressSentry.hxx>
|
||||
|
||||
#include <math_Vector.hxx>
|
||||
#include <math_IntegerVector.hxx>
|
||||
@ -175,7 +176,8 @@ Standard_Integer LU_Decompose(math_Matrix& a,
|
||||
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;
|
||||
@ -183,6 +185,8 @@ Standard_Integer LU_Decompose(math_Matrix& a,
|
||||
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++)
|
||||
@ -192,7 +196,8 @@ Standard_Integer LU_Decompose(math_Matrix& a,
|
||||
}
|
||||
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++)
|
||||
@ -232,16 +237,23 @@ Standard_Integer LU_Decompose(math_Matrix& a,
|
||||
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,
|
||||
|
@ -18,12 +18,14 @@
|
||||
#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;
|
||||
@ -32,7 +34,8 @@ const Standard_Integer math_Status_NoConvergence = 3;
|
||||
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)
|
||||
@ -44,7 +47,8 @@ Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a,
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user