|
|
|||
File indexing completed on 2026-09-26 09:03:54
0001 // Created on: 1991-07-17 0002 // Created by: Isabelle GRIGNON 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_FunctionAllRoots_HeaderFile 0018 #define _math_FunctionAllRoots_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Standard_Boolean.hxx> 0025 #include <NCollection_Sequence.hxx> 0026 #include <Standard_Integer.hxx> 0027 #include <Standard_OStream.hxx> 0028 class math_FunctionWithDerivative; 0029 class math_FunctionSample; 0030 0031 //! This algorithm uses a sample of the function to find 0032 //! all intervals on which the function is null, and afterwards 0033 //! uses the FunctionRoots algorithm to find the points 0034 //! where the function is null outside the "null intervals". 0035 //! Knowledge of the derivative is required. 0036 class math_FunctionAllRoots 0037 { 0038 public: 0039 DEFINE_STANDARD_ALLOC 0040 0041 //! The algorithm uses the sample to find intervals on which 0042 //! the function is null. An interval is found if, for at least 0043 //! two consecutive points of the sample, Ui and Ui+1, we get 0044 //! |F(Ui)|<=EpsNul and |F(Ui+1)|<=EpsNul. The real bounds of 0045 //! an interval are computed with the FunctionRoots. 0046 //! algorithm. 0047 //! Between two intervals, the roots of the function F are 0048 //! calculated using the FunctionRoots algorithm. 0049 Standard_EXPORT math_FunctionAllRoots(math_FunctionWithDerivative& F, 0050 const math_FunctionSample& S, 0051 const double EpsX, 0052 const double EpsF, 0053 const double EpsNul); 0054 0055 //! Returns True if the computation has been done successfully. 0056 bool IsDone() const; 0057 0058 //! Returns the number of intervals on which the function 0059 //! is Null. 0060 //! An exception is raised if IsDone returns False. 0061 int NbIntervals() const; 0062 0063 //! Returns the interval of parameter of range Index. 0064 //! An exception is raised if IsDone returns False; 0065 //! An exception is raised if Index<=0 or Index >Nbintervals. 0066 void GetInterval(const int Index, double& A, double& B) const; 0067 0068 //! returns the State Number associated to the interval Index. 0069 //! An exception is raised if IsDone returns False; 0070 //! An exception is raised if Index<=0 or Index >Nbintervals. 0071 void GetIntervalState(const int Index, int& IFirst, int& ILast) const; 0072 0073 //! returns the number of points where the function is Null. 0074 //! An exception is raised if IsDone returns False. 0075 int NbPoints() const; 0076 0077 //! Returns the parameter of the point of range Index. 0078 //! An exception is raised if IsDone returns False; 0079 //! An exception is raised if Index<=0 or Index >NbPoints. 0080 double GetPoint(const int Index) const; 0081 0082 //! returns the State Number associated to the point Index. 0083 //! An exception is raised if IsDone returns False; 0084 //! An exception is raised if Index<=0 or Index >Nbintervals. 0085 int GetPointState(const int Index) const; 0086 0087 //! Prints on the stream o information on the current state 0088 //! of the object. 0089 Standard_EXPORT void Dump(Standard_OStream& o) const; 0090 0091 private: 0092 bool done; 0093 NCollection_Sequence<double> pdeb; 0094 NCollection_Sequence<double> pfin; 0095 NCollection_Sequence<double> piso; 0096 NCollection_Sequence<int> ideb; 0097 NCollection_Sequence<int> ifin; 0098 NCollection_Sequence<int> iiso; 0099 }; 0100 0101 #include <math_FunctionAllRoots.lxx> 0102 0103 #endif // _math_FunctionAllRoots_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|