|
||||
File indexing completed on 2025-01-18 10:04:14
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 <TColStd_SequenceOfReal.hxx> 0024 #include <TColStd_SequenceOfInteger.hxx> 0025 #include <Standard_Integer.hxx> 0026 #include <Standard_OStream.hxx> 0027 class math_FunctionWithDerivative; 0028 0029 0030 0031 //! This class implements an algorithm which finds all the real roots of 0032 //! a function with derivative within a given range. 0033 //! Knowledge of the derivative is required. 0034 class math_FunctionRoots 0035 { 0036 public: 0037 0038 DEFINE_STANDARD_ALLOC 0039 0040 0041 //! Calculates all the real roots of a function F-K within the range 0042 //! A..B. without conditions on A and B 0043 //! A solution X is found when 0044 //! abs(Xi - Xi-1) <= Epsx and abs(F(Xi)-K) <= EpsF. 0045 //! The function is considered as null between A and B if 0046 //! abs(F-K) <= EpsNull within this range. 0047 Standard_EXPORT math_FunctionRoots(math_FunctionWithDerivative& F, const Standard_Real A, const Standard_Real B, const Standard_Integer NbSample, const Standard_Real EpsX = 0.0, const Standard_Real EpsF = 0.0, const Standard_Real EpsNull = 0.0, const Standard_Real K = 0.0); 0048 0049 //! Returns true if the computations are successful, otherwise returns false. 0050 Standard_Boolean IsDone() const; 0051 0052 0053 //! returns true if the function is considered as null between A and B. 0054 //! Exceptions 0055 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0056 Standard_Boolean IsAllNull() const; 0057 0058 //! Returns the number of solutions found. 0059 //! Exceptions 0060 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0061 Standard_Integer NbSolutions() const; 0062 0063 //! Returns the Nth value of the root of function F. 0064 //! Exceptions 0065 //! StdFail_NotDone if the algorithm fails (and IsDone returns false). 0066 Standard_Real Value (const Standard_Integer Nieme) const; 0067 0068 0069 //! returns the StateNumber of the Nieme root. 0070 //! Exception RangeError is raised if Nieme is < 1 0071 //! or Nieme > NbSolutions. 0072 Standard_Integer StateNumber (const Standard_Integer 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 0079 0080 0081 protected: 0082 0083 0084 0085 0086 0087 private: 0088 0089 0090 0091 Standard_Boolean Done; 0092 Standard_Boolean AllNull; 0093 TColStd_SequenceOfReal Sol; 0094 TColStd_SequenceOfInteger NbStateSol; 0095 0096 0097 }; 0098 0099 0100 #include <math_FunctionRoots.lxx> 0101 0102 0103 0104 0105 0106 #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 |