|
|
|||
File indexing completed on 2026-10-06 09:21:17
0001 // Created on: 1991-05-13 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_FunctionRoots_HeaderFile 0018 #define _math_FunctionRoots_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 0023 #include <NCollection_Sequence.hxx> 0024 #include <Standard_Integer.hxx> 0025 #include <Standard_OStream.hxx> 0026 class math_FunctionWithDerivative; 0027 0028 //! This class implements an algorithm which finds all the real roots of 0029 //! a function with derivative within a given range. 0030 //! Knowledge of the derivative is required. 0031 class math_FunctionRoots 0032 { 0033 public: 0034 DEFINE_STANDARD_ALLOC 0035 0036 //! Calculates all the real roots of a function F-K within the range 0037 //! A..B. without conditions on A and B 0038 //! A solution X is found when 0039 //! abs(Xi - Xi-1) <= Epsx and abs(F(Xi)-K) <= EpsF. 0040 //! The function is considered as null between A and B if 0041 //! abs(F-K) <= EpsNull within this range. 0042 Standard_EXPORT math_FunctionRoots(math_FunctionWithDerivative& F, 0043 const double A, 0044 const double B, 0045 const int NbSample, 0046 const double EpsX = 0.0, 0047 const double EpsF = 0.0, 0048 const double EpsNull = 0.0, 0049 const double K = 0.0); 0050 0051 //! Returns true if the computations are successful, otherwise returns false. 0052 bool IsDone() const; 0053 0054 //! returns true if the function is considered as null between A and B. 0055 //! Exceptions 0056 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0057 bool IsAllNull() const; 0058 0059 //! Returns the number of solutions found. 0060 //! Exceptions 0061 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0062 int NbSolutions() const; 0063 0064 //! Returns the Nth value of the root of function F. 0065 //! Exceptions 0066 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0067 double Value(const int Nieme) const; 0068 0069 //! returns the StateNumber of the Nieme root. 0070 //! Exception RangeError is raised if Nieme is < 1 0071 //! or Nieme > NbSolutions. 0072 int StateNumber(const int Nieme) const; 0073 0074 //! Prints on the stream o information on the current state 0075 //! of the object. 0076 Standard_EXPORT void Dump(Standard_OStream& o) const; 0077 0078 private: 0079 bool Done; 0080 bool AllNull; 0081 NCollection_Sequence<double> Sol; 0082 NCollection_Sequence<int> NbStateSol; 0083 }; 0084 0085 #include <math_FunctionRoots.lxx> 0086 0087 #endif // _math_FunctionRoots_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|