mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024137: math_FunctionSetRoot returns too rough solution
Test case and new draw command for issue CR24137 Modified test case de/iges_1/G9 according to new data Small correction of test cases for issue CR24137
This commit is contained in:
parent
91bb31f35e
commit
89d8607f13
@ -1234,6 +1234,69 @@ static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theN
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <Extrema_FuncExtPS.hxx>
|
||||
#include <math_FunctionSetRoot.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
|
||||
{
|
||||
Standard_Integer anArgIter = 1;
|
||||
if (theNArg < 5)
|
||||
{
|
||||
theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// get target shape
|
||||
Standard_CString aFaceName = theArgv[anArgIter++];
|
||||
Standard_CString aVertName = theArgv[anArgIter++];
|
||||
const TopoDS_Shape aShapeF = DBRep::Get (aFaceName);
|
||||
const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
|
||||
const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
|
||||
const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
|
||||
const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100;
|
||||
if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
|
||||
{
|
||||
std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if (aShapeV.IsNull() || aShapeV.ShapeType() != TopAbs_VERTEX)
|
||||
{
|
||||
std::cout << "Error: " << aVertName << " shape is null / not a vertex" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
const TopoDS_Face aFace = TopoDS::Face (aShapeF);
|
||||
const TopoDS_Vertex aVert = TopoDS::Vertex (aShapeV);
|
||||
GeomAdaptor_Surface aSurf (BRep_Tool::Surface (aFace));
|
||||
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
|
||||
|
||||
Extrema_FuncExtPS anExtFunc;
|
||||
math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
|
||||
|
||||
math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
|
||||
aTolUV (1) = Precision::Confusion(); aTolUV (2) = Precision::Confusion();
|
||||
aUVinf (1) = -Precision::Infinite(); aUVinf (2) = -Precision::Infinite();
|
||||
aUVsup (1) = Precision::Infinite(); aUVsup (2) = Precision::Infinite();
|
||||
aFromUV(1) = aUFrom; aFromUV(2) = aVFrom;
|
||||
|
||||
anExtFunc.Initialize (aSurf);
|
||||
anExtFunc.SetPoint (aPnt);
|
||||
aRoot.SetTolerance (aTolUV);
|
||||
aRoot.Perform (anExtFunc, aFromUV, aUVinf, aUVsup);
|
||||
if (!aRoot.IsDone())
|
||||
{
|
||||
std::cerr << "No results!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
theDI << aRoot.Root()(1) << " " << aRoot.Root()(2) << "\n";
|
||||
|
||||
aSurf.D0 (aRoot.Root()(1), aRoot.Root()(2), aRes);
|
||||
DBRep::Set ("result", BRepBuilderAPI_MakeVertex (aRes));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
const char *group = "QABugs";
|
||||
|
||||
@ -1254,5 +1317,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
|
||||
theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
|
||||
theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
|
||||
theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
|
||||
return;
|
||||
}
|
||||
|
@ -65,11 +65,11 @@
|
||||
|
||||
#define FSR_DEBUG(arg)
|
||||
// Uncomment the following code to have debug output to cout
|
||||
/*
|
||||
static Standard_Boolean mydebug = Standard_False;
|
||||
#undef FSR_DEBUG
|
||||
#define FSR_DEBUG(arg) {if (mydebug) { cout << arg << endl; }}
|
||||
*/
|
||||
//==========================================================
|
||||
//static Standard_Boolean mydebug = Standard_True;
|
||||
//#undef FSR_DEBUG
|
||||
//#define FSR_DEBUG(arg) {if (mydebug) { cout << arg << endl; }}
|
||||
//===========================================================
|
||||
|
||||
class MyDirFunction : public math_Function
|
||||
{
|
||||
@ -89,13 +89,13 @@ public :
|
||||
math_FunctionSetWithDerivatives& f) ;
|
||||
|
||||
void Initialize(const math_Vector& p0, const math_Vector& dir) const;
|
||||
//For hp :
|
||||
//For hp :
|
||||
Standard_Boolean Value(const math_Vector& Sol, math_Vector& FF,
|
||||
math_Matrix& DF, math_Vector& GH,
|
||||
Standard_Real& F2, Standard_Real& Gnr1);
|
||||
// Standard_Boolean MyDirFunction::Value(const math_Vector& Sol, math_Vector& FF,
|
||||
// math_Matrix& DF, math_Vector& GH,
|
||||
// Standard_Real& F2, Standard_Real& Gnr1);
|
||||
// Standard_Boolean MyDirFunction::Value(const math_Vector& Sol, math_Vector& FF,
|
||||
// math_Matrix& DF, math_Vector& GH,
|
||||
// Standard_Real& F2, Standard_Real& Gnr1);
|
||||
Standard_Boolean Value(const Standard_Real x, Standard_Real& fval) ;
|
||||
|
||||
};
|
||||
@ -137,8 +137,8 @@ Standard_Boolean MyDirFunction::Value(const Standard_Real x,
|
||||
aVal = FV->Value(i);
|
||||
if(aVal < 0.) {
|
||||
if(aVal <= -1.e+100) // Precision::HalfInfinite() later
|
||||
// if(Precision::IsInfinite(Abs(FV->Value(i)))) {
|
||||
// fval = Precision::Infinite();
|
||||
// if(Precision::IsInfinite(Abs(FV->Value(i)))) {
|
||||
// fval = Precision::Infinite();
|
||||
return Standard_False;
|
||||
}
|
||||
else if(aVal >= 1.e+100) // Precision::HalfInfinite() later
|
||||
@ -163,18 +163,18 @@ Standard_Boolean MyDirFunction::Value(const math_Vector& Sol,
|
||||
Standard_Real aVal = 0.;
|
||||
|
||||
for(Standard_Integer i = FF.Lower(); i <= FF.Upper(); i++) {
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:56:50 2005.BEGIN
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:56:50 2005.BEGIN
|
||||
aVal = FF.Value(i);
|
||||
if(aVal < 0.) {
|
||||
if(aVal <= -1.e+100) // Precision::HalfInfinite() later
|
||||
// if(Precision::IsInfinite(Abs(FF.Value(i)))) {
|
||||
// F2 = Precision::Infinite();
|
||||
// Gnr1 = Precision::Infinite();
|
||||
// if(Precision::IsInfinite(Abs(FF.Value(i)))) {
|
||||
// F2 = Precision::Infinite();
|
||||
// Gnr1 = Precision::Infinite();
|
||||
return Standard_False;
|
||||
}
|
||||
else if(aVal >= 1.e+100) // Precision::HalfInfinite() later
|
||||
return Standard_False;
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:57:05 2005.END
|
||||
// modified by NIZHNY-MKK Mon Oct 3 17:57:05 2005.END
|
||||
}
|
||||
|
||||
|
||||
@ -202,8 +202,8 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P0,
|
||||
math_Vector& Delta,
|
||||
const math_Vector& Tol,
|
||||
MyDirFunction& F)
|
||||
// Purpose : minimisation a partir de 3 points
|
||||
//-------------------------------------------------------
|
||||
// Purpose : minimisation a partir de 3 points
|
||||
//-------------------------------------------------------
|
||||
{
|
||||
// (1) Evaluation d'un tolerance parametrique 1D
|
||||
Standard_Real tol1d = 2.1 , invnorme, tsol;
|
||||
@ -217,11 +217,11 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P0,
|
||||
if (tol1d > 1.9) return Standard_False; //Pas la peine de se fatiguer
|
||||
tol1d /= 3;
|
||||
|
||||
//JR/Hp :
|
||||
//JR/Hp :
|
||||
math_Vector PP0 = P0 ;
|
||||
math_Vector PP1 = P1 ;
|
||||
Delta = PP1 - PP0;
|
||||
// Delta = P1 - P0;
|
||||
// Delta = P1 - P0;
|
||||
invnorme = Delta.Norm();
|
||||
if (invnorme <= Eps) return Standard_False;
|
||||
invnorme = ((Standard_Real) 1) / invnorme;
|
||||
@ -253,8 +253,8 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P,
|
||||
const math_Vector& DGradient,
|
||||
const math_Vector& Tol,
|
||||
MyDirFunction& F)
|
||||
// Purpose: minimisation a partir de 2 points et une derives
|
||||
//----------------------------------------------------------------------
|
||||
// Purpose: minimisation a partir de 2 points et une derives
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
{
|
||||
// (0) Evaluation d'un tolerance parametrique 1D
|
||||
@ -270,7 +270,7 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P,
|
||||
|
||||
// (1) On realise une premiere interpolation quadratique
|
||||
Standard_Real ax, bx, cx, df1, df2, Delta, tsol, fsol, tsolbis;
|
||||
FSR_DEBUG(" essai d interpolation")
|
||||
FSR_DEBUG(" essai d interpolation");
|
||||
|
||||
df1 = Gradient*Dir;
|
||||
df2 = DGradient*Dir;
|
||||
@ -312,7 +312,7 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P,
|
||||
if (fsol<PValue) {
|
||||
good = Standard_True;
|
||||
Result = fsol;
|
||||
FSR_DEBUG("t= "<<tsol<<" F = " << fsol << " OldF = "<<PValue)
|
||||
FSR_DEBUG("t= "<<tsol<<" F = " << fsol << " OldF = "<<PValue);
|
||||
}
|
||||
|
||||
// (2) Si l'on a pas assez progresser on realise une recherche
|
||||
@ -325,7 +325,7 @@ static Standard_Boolean MinimizeDirection(const math_Vector& P,
|
||||
else {
|
||||
ax = 0.0; bx = tsol; cx = 1.0;
|
||||
}
|
||||
FSR_DEBUG(" minimisation dans la direction")
|
||||
FSR_DEBUG(" minimisation dans la direction");
|
||||
math_BrentMinimum Sol(F, ax, bx, cx, tol1d, 100, tol1d);
|
||||
if(Sol.IsDone()) {
|
||||
if (Sol.Minimum() <= Result) {
|
||||
@ -362,7 +362,7 @@ static void SearchDirection(const math_Matrix& DF,
|
||||
math_Gauss Solut(DF, 1.e-9);
|
||||
if (Solut.IsDone()) Solut.Solve(Direction);
|
||||
else { // we have to "forget" singular directions.
|
||||
FSR_DEBUG(" Matrice singuliere : On prend SVD")
|
||||
FSR_DEBUG(" Matrice singuliere : On prend SVD");
|
||||
math_SVD SolvebySVD(DF);
|
||||
if (SolvebySVD.IsDone()) SolvebySVD.Solve(-1*FF, Direction);
|
||||
else ChangeDirection = Standard_True;
|
||||
@ -412,15 +412,15 @@ static void SearchDirection(const math_Matrix& DF,
|
||||
const math_Vector& GH,
|
||||
const math_Vector& FF,
|
||||
const math_IntegerVector& Constraints,
|
||||
// const math_Vector& X, // Le point d'init
|
||||
// const math_Vector& X, // Le point d'init
|
||||
const math_Vector& , // Le point d'init
|
||||
Standard_Boolean ChangeDirection,
|
||||
const math_Vector& InvLengthMax,
|
||||
math_Vector& Direction,
|
||||
Standard_Real& Dy)
|
||||
//Purpose : Recherche une direction (et un pas si Newton Fonctionne) le long
|
||||
// d'une frontiere
|
||||
//=====================================================================
|
||||
//Purpose : Recherche une direction (et un pas si Newton Fonctionne) le long
|
||||
// d'une frontiere
|
||||
//=====================================================================
|
||||
{
|
||||
Standard_Integer Ninc = DF.ColNumber(), Neq = DF.RowNumber();
|
||||
Standard_Integer i, j, k, Cons = 0;
|
||||
@ -491,13 +491,13 @@ Standard_Boolean Bounds(const math_Vector& InfBound,
|
||||
math_IntegerVector& Constraints,
|
||||
math_Vector& Delta,
|
||||
Standard_Boolean& theIsNewSol)
|
||||
//
|
||||
// Purpose: Trims an initial solution Sol to be within a domain defined by
|
||||
// InfBound and SupBound. Delta will contain a distance between final Sol and
|
||||
// SolSave.
|
||||
// IsNewSol returns False, if final Sol fully coincides with SolSave, i.e.
|
||||
// if SolSave already lied on a boundary and initial Sol was fully beyond it
|
||||
//======================================================
|
||||
//
|
||||
// Purpose: Trims an initial solution Sol to be within a domain defined by
|
||||
// InfBound and SupBound. Delta will contain a distance between final Sol and
|
||||
// SolSave.
|
||||
// IsNewSol returns False, if final Sol fully coincides with SolSave, i.e.
|
||||
// if SolSave already lied on a boundary and initial Sol was fully beyond it
|
||||
//======================================================
|
||||
{
|
||||
Standard_Boolean Out = Standard_False;
|
||||
Standard_Integer i, Ninc = Sol.Length();
|
||||
@ -559,9 +559,9 @@ Standard_Boolean Bounds(const math_Vector& InfBound,
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& Tolerance,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
@ -590,9 +590,9 @@ math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
|
||||
math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1, F.NbVariables()),
|
||||
|
||||
@ -625,9 +625,9 @@ math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& supBound,
|
||||
const Standard_Integer NbIterations,
|
||||
Standard_Boolean theStopOnDivergent) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, F.NbVariables()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
@ -661,9 +661,9 @@ math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
const math_Vector& StartingPoint,
|
||||
const math_Vector& Tolerance,
|
||||
const Standard_Integer NbIterations) :
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
Delta(1, F.NbVariables()),
|
||||
Sol(1, F.NbVariables()),
|
||||
DF(1, F.NbEquations(),
|
||||
1, StartingPoint.Length()),
|
||||
Tol(1,F.NbVariables()),
|
||||
|
||||
@ -683,7 +683,7 @@ math_FunctionSetRoot::math_FunctionSetRoot(math_FunctionSetWithDerivatives& F,
|
||||
Temp3(1, F.NbVariables()),
|
||||
Temp4(1, F.NbEquations())
|
||||
|
||||
{
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= Tol.Length(); i++) {
|
||||
Tol(i) = Tolerance(i);
|
||||
}
|
||||
@ -726,8 +726,8 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
math_Vector InvLengthMax(1, Ninc); // Pour bloquer les pas a 1/4 du domaine
|
||||
math_IntegerVector Constraints(1, Ninc); // Pour savoir sur quels bord on se trouve
|
||||
for (i = 1; i <= Ninc ; i++) {
|
||||
// modified by NIZHNY-MKK Mon Oct 3 18:03:50 2005
|
||||
// InvLengthMax(i) = 1. / Max(Abs(SupBound(i) - InfBound(i))/4, 1.e-9);
|
||||
// modified by NIZHNY-MKK Mon Oct 3 18:03:50 2005
|
||||
// InvLengthMax(i) = 1. / Max(Abs(SupBound(i) - InfBound(i))/4, 1.e-9);
|
||||
InvLengthMax(i) = 1. / Max((SupBound(i) - InfBound(i))/4, 1.e-9);
|
||||
}
|
||||
|
||||
@ -770,8 +770,8 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
// de faire une seconde iteration...
|
||||
Save(0) = Max (F2, EpsSqrt);
|
||||
Standard_Real aTol_Func = Epsilon(F2);
|
||||
FSR_DEBUG("=== Mode Debug de Function Set Root" << endl)
|
||||
FSR_DEBUG(" F2 Initial = " << F2)
|
||||
FSR_DEBUG("=== Mode Debug de Function Set Root" << endl);
|
||||
FSR_DEBUG(" F2 Initial = " << F2);
|
||||
|
||||
if ((F2 <= Eps) || (Gnr1 <= Eps2)) {
|
||||
Done = Standard_False;
|
||||
@ -830,7 +830,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
|
||||
DHSave = GH;
|
||||
if (isNewSol) {
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
@ -841,9 +841,9 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
}
|
||||
|
||||
FSR_DEBUG("Kount = " << Kount)
|
||||
FSR_DEBUG("Le premier F2 = " << F2)
|
||||
FSR_DEBUG("Direction = " << ChangeDirection)
|
||||
FSR_DEBUG("Kount = " << Kount);
|
||||
FSR_DEBUG("Le premier F2 = " << F2);
|
||||
FSR_DEBUG("Direction = " << ChangeDirection);
|
||||
|
||||
if ((F2 <= Eps) || (Gnr1 <= Eps2)) {
|
||||
Done = Standard_False;
|
||||
@ -873,7 +873,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
while((F2/PreviousMinimum > Progres) && !Stop) {
|
||||
if (F2 < OldF && (Dy < 0.0)) {
|
||||
// On essaye de progresser dans cette direction.
|
||||
FSR_DEBUG(" iteration de descente = " << DescenteIter)
|
||||
FSR_DEBUG(" iteration de descente = " << DescenteIter);
|
||||
DescenteIter++;
|
||||
SolSave = Sol;
|
||||
OldF = F2;
|
||||
@ -892,7 +892,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
//
|
||||
Stop = Bounds(InfBound, SupBound, Tol, Sol, SolSave,
|
||||
Constraints, Delta, isNewSol);
|
||||
FSR_DEBUG(" Augmentation de lambda")
|
||||
FSR_DEBUG(" Augmentation de lambda");
|
||||
Ambda *= 1.7;
|
||||
}
|
||||
else {
|
||||
@ -937,7 +937,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
DHSave = GH;
|
||||
if (isNewSol) {
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
@ -962,12 +962,12 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (DescenteIter >= 10) {
|
||||
if (DescenteIter >= 100) {
|
||||
Stop = Standard_True;
|
||||
}
|
||||
}
|
||||
FSR_DEBUG("--- Sortie du Traitement Standard")
|
||||
FSR_DEBUG(" DescenteIter = "<<DescenteIter << " F2 = " << F2)
|
||||
FSR_DEBUG("--- Sortie du Traitement Standard");
|
||||
FSR_DEBUG(" DescenteIter = "<<DescenteIter << " F2 = " << F2);
|
||||
}
|
||||
// ------------------------------------
|
||||
// on passe au traitement des bords
|
||||
@ -984,11 +984,11 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
OldF = F2;
|
||||
SearchDirection(DF, GH, FF, Constraints, Sol,
|
||||
ChangeDirection, InvLengthMax, DH, Dy);
|
||||
FSR_DEBUG(" Conditional Direction = " << ChangeDirection)
|
||||
FSR_DEBUG(" Conditional Direction = " << ChangeDirection);
|
||||
if (Dy<-Eps) { //Pour eviter des calculs inutiles et des /0...
|
||||
if (ChangeDirection) {
|
||||
|
||||
// Ambda = Ambda2 / Sqrt(Abs(Dy));
|
||||
// Ambda = Ambda2 / Sqrt(Abs(Dy));
|
||||
Ambda = Ambda2 / Sqrt(-Dy);
|
||||
if (Ambda > 1.0) Ambda = 1.0;
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
|
||||
DHSave = GH;
|
||||
if (isNewSol) {
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
@ -1026,8 +1026,8 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
}
|
||||
Ambda2 = Gnr1;
|
||||
FSR_DEBUG("--- Iteration au bords : " << DescenteIter)
|
||||
FSR_DEBUG("--- F2 = " << F2)
|
||||
FSR_DEBUG("--- Iteration au bords : " << DescenteIter);
|
||||
FSR_DEBUG("--- F2 = " << F2);
|
||||
}
|
||||
else {
|
||||
Stop = Standard_True;
|
||||
@ -1035,7 +1035,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
|
||||
while((F2/PreviousMinimum > Progres) && (F2<OldF) && (!Stop) ) {
|
||||
DescenteIter++;
|
||||
FSR_DEBUG("--- Iteration de descente conditionnel = " << DescenteIter)
|
||||
FSR_DEBUG("--- Iteration de descente conditionnel = " << DescenteIter);
|
||||
if (F2 < OldF && Dy < 0.0) {
|
||||
// On essaye de progresser dans cette direction.
|
||||
SolSave = Sol;
|
||||
@ -1058,7 +1058,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
DHSave = GH;
|
||||
if (isNewSol) {
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
@ -1099,7 +1099,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
Sort = Bounds(InfBound, SupBound, Tol, Sol, SolSave,
|
||||
Constraints, Delta, isNewSol);
|
||||
if (isNewSol) {
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
@ -1112,8 +1112,8 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
}
|
||||
Dy = GH*DH;
|
||||
}
|
||||
FSR_DEBUG("--- Sortie du Traitement des Bords")
|
||||
FSR_DEBUG("--- DescenteIter = "<<DescenteIter << " F2 = " << F2)
|
||||
FSR_DEBUG("--- Sortie du Traitement des Bords");
|
||||
FSR_DEBUG("--- DescenteIter = "<<DescenteIter << " F2 = " << F2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1208,7 +1208,7 @@ void math_FunctionSetRoot::Perform(math_FunctionSetWithDerivatives& F,
|
||||
if (!ChangeDirection) { // On passe au gradient
|
||||
ChangeDirection = Standard_True;
|
||||
Sol = PreviousSolution;
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
// F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1);
|
||||
if(!F_Dir.Value(Sol, FF, DF, GH, F2, Gnr1)) {
|
||||
Done = Standard_False;
|
||||
if (!theStopOnDivergent || !myIsDivergent)
|
||||
|
22
tests/bugs/fclasses/bug24137
Executable file
22
tests/bugs/fclasses/bug24137
Executable file
@ -0,0 +1,22 @@
|
||||
puts "================"
|
||||
puts "OCC24137"
|
||||
puts "================"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# math_FunctionSetRoot returns too rough solution
|
||||
#######################################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
vertex v 6.65634 -0.201746 2.51477
|
||||
restore [locate_data_file bug24137_face.brep] f
|
||||
|
||||
OCC24137 f v 508.326 77.6999
|
||||
distmini d v result
|
||||
|
||||
regexp {([-0-9.+eE]+)$} [dump d_val] full dist
|
||||
set good_dist 0
|
||||
set toler 2.0e-06
|
||||
if { [expr abs( ${dist} - ${good_dist} )] > ${toler} } {
|
||||
puts "Faulty : the distanse is ${dist}. It is bad value"
|
||||
}
|
@ -39,7 +39,8 @@ puts "CPU_user_time=${CPU_user_time}"
|
||||
set CPU_user_time [expr ${CPU_user_time} / ${NbTests}]
|
||||
puts "CPU_user_time=${CPU_user_time}"
|
||||
|
||||
set square 3.56087e+07
|
||||
#CR24137 set square 3.56087e+07
|
||||
set square 3.52471e+07
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
set nb_v_good 24
|
||||
@ -53,4 +54,3 @@ set nb_compound_good 1
|
||||
set nb_shape_good 102
|
||||
|
||||
set 2dviewer 0
|
||||
|
||||
|
@ -39,7 +39,8 @@ puts "CPU_user_time=${CPU_user_time}"
|
||||
set CPU_user_time [expr ${CPU_user_time} / ${NbTests}]
|
||||
puts "CPU_user_time=${CPU_user_time}"
|
||||
|
||||
set square 782201
|
||||
#CR24317 set square 782201
|
||||
set square 766474
|
||||
|
||||
# Analysis of "nbshapes res"
|
||||
set nb_v_good 53
|
||||
|
@ -6,11 +6,11 @@ set filename lh93wsddr3370z4.igs
|
||||
|
||||
set ref_data {
|
||||
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
|
||||
TPSTAT : Faulties = 0 ( 0 ) Warnings = 162 ( 4127 ) Summary = 162 ( 4127 )
|
||||
TPSTAT : Faulties = 0 ( 0 ) Warnings = 164 ( 4127 ) Summary = 164 ( 4127 )
|
||||
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
|
||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) Summary = 7237 ( 7237 )
|
||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 3192 ( 3192 )
|
||||
TOLERANCE : MaxTol = 0.08683083502 ( 0.04341528762 ) AvgTol = 0.000870172875 ( 0.0007502917279 )
|
||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) Summary = 7239 ( 7237 )
|
||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 448 ( 448 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 3193 ( 3192 )
|
||||
TOLERANCE : MaxTol = 0.08683083502 ( 0.04341528762 ) AvgTol = 0.0008697846249 ( 0.0007558849075 )
|
||||
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 0 ( 0 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user