b311480e |
1 | // Created on: 1996-10-11 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <FairCurve_Newton.hxx> |
19 | #include <math_MultipleVarFunctionWithHessian.hxx> |
7fd59977 |
20 | |
859a47c3 |
21 | //======================================================================= |
22 | //function : FairCurve_Newton |
23 | //purpose : Constructor |
24 | //======================================================================= |
25 | FairCurve_Newton::FairCurve_Newton( |
26 | const math_MultipleVarFunctionWithHessian& theFunction, |
27 | const Standard_Real theSpatialTolerance, |
28 | const Standard_Real theCriteriumTolerance, |
29 | const Standard_Integer theNbIterations, |
30 | const Standard_Real theConvexity, |
31 | const Standard_Boolean theWithSingularity |
32 | ) |
33 | : math_NewtonMinimum(theFunction, |
34 | theCriteriumTolerance, |
35 | theNbIterations, |
36 | theConvexity, |
37 | theWithSingularity), |
38 | mySpTol(theSpatialTolerance) |
7fd59977 |
39 | { |
7fd59977 |
40 | } |
41 | |
859a47c3 |
42 | //======================================================================= |
43 | //function : IsConverged |
44 | //purpose : Convert if the steps are too small or if the criterion |
45 | // progresses little with a reasonable step, this last |
46 | // requirement allows detecting infinite slidings |
47 | // (case when the criterion varies troo slowly). |
48 | //======================================================================= |
7fd59977 |
49 | Standard_Boolean FairCurve_Newton::IsConverged() const |
7fd59977 |
50 | { |
859a47c3 |
51 | const Standard_Real N = TheStep.Norm(); |
52 | return ( N <= 0.01 * mySpTol ) || ( N <= mySpTol && |
53 | Abs(TheMinimum - PreviousMinimum) <= XTol * Abs(PreviousMinimum)); |
7fd59977 |
54 | } |