|
|
|||
Warning, file /include/opencascade/math_BissecNewton.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Created on: 1991-03-14 0002 // Created by: Laurent PAINNOT 0003 // Copyright (c) 1991-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _math_BissecNewton_HeaderFile 0018 #define _math_BissecNewton_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <math_Status.hxx> 0025 #include <Standard_Real.hxx> 0026 #include <Standard_OStream.hxx> 0027 class math_FunctionWithDerivative; 0028 0029 //! This class implements a combination of Newton-Raphson and bissection 0030 //! methods to find the root of the function between two bounds. 0031 //! Knowledge of the derivative is required. 0032 class math_BissecNewton 0033 { 0034 public: 0035 DEFINE_STANDARD_ALLOC 0036 0037 //! Constructor. 0038 //! @param theXTolerance - algorithm tolerance. 0039 Standard_EXPORT math_BissecNewton(const double theXTolerance); 0040 0041 //! A combination of Newton-Raphson and bissection methods is done to find 0042 //! the root of the function F between the bounds Bound1 and Bound2 0043 //! on the function F. 0044 //! The tolerance required on the root is given by TolX. 0045 //! The solution is found when: 0046 //! abs(Xi - Xi-1) <= TolX and F(Xi) * F(Xi-1) <= 0 0047 //! The maximum number of iterations allowed is given by NbIterations. 0048 Standard_EXPORT void Perform(math_FunctionWithDerivative& F, 0049 const double Bound1, 0050 const double Bound2, 0051 const int NbIterations = 100); 0052 0053 //! This method is called at the end of each iteration to check if the 0054 //! solution has been found. 0055 //! It can be redefined in a sub-class to implement a specific test to 0056 //! stop the iterations. 0057 virtual bool IsSolutionReached(math_FunctionWithDerivative& theFunction); 0058 0059 //! Tests is the root has been successfully found. 0060 bool IsDone() const; 0061 0062 //! returns the value of the root. 0063 //! Exception NotDone is raised if the minimum was not found. 0064 double Root() const; 0065 0066 //! returns the value of the derivative at the root. 0067 //! Exception NotDone is raised if the minimum was not found. 0068 double Derivative() const; 0069 0070 //! returns the value of the function at the root. 0071 //! Exception NotDone is raised if the minimum was not found. 0072 double Value() const; 0073 0074 //! Prints on the stream o information on the current state 0075 //! of the object. 0076 //! Is used to redefine the operator <<. 0077 Standard_EXPORT void Dump(Standard_OStream& o) const; 0078 0079 //! Destructor 0080 Standard_EXPORT virtual ~math_BissecNewton(); 0081 0082 protected: 0083 math_Status TheStatus; 0084 double XTol; 0085 double x; 0086 double dx; 0087 double f; 0088 double df; 0089 0090 private: 0091 bool Done; 0092 }; 0093 0094 #include <math_BissecNewton.lxx> 0095 0096 #endif // _math_BissecNewton_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|