Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:14

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 <TColStd_SequenceOfReal.hxx>
0026 #include <TColStd_SequenceOfInteger.hxx>
0027 #include <Standard_OStream.hxx>
0028 class math_FunctionWithDerivative;
0029 class math_FunctionSample;
0030 
0031 
0032 //! This algorithm uses a sample of the function to find
0033 //! all intervals on which the function is null, and afterwards
0034 //! uses the FunctionRoots algorithm to find the points
0035 //! where the function is null outside the "null intervals".
0036 //! Knowledge of the derivative is required.
0037 class math_FunctionAllRoots 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   
0044   //! The algorithm uses the sample to find intervals on which
0045   //! the function is null. An interval is found if, for at least
0046   //! two consecutive points of the sample, Ui and Ui+1, we get
0047   //! |F(Ui)|<=EpsNul and |F(Ui+1)|<=EpsNul. The real bounds of
0048   //! an interval are computed with the FunctionRoots.
0049   //! algorithm.
0050   //! Between two intervals, the roots of the function F are
0051   //! calculated using the FunctionRoots algorithm.
0052   Standard_EXPORT math_FunctionAllRoots(math_FunctionWithDerivative& F, const math_FunctionSample& S, const Standard_Real EpsX, const Standard_Real EpsF, const Standard_Real EpsNul);
0053   
0054   //! Returns True if the computation has been done successfully.
0055     Standard_Boolean IsDone() const;
0056   
0057   //! Returns the number of intervals on which the function
0058   //! is Null.
0059   //! An exception is raised if IsDone returns False.
0060     Standard_Integer NbIntervals() const;
0061   
0062   //! Returns the interval of parameter of range Index.
0063   //! An exception is raised if IsDone returns False;
0064   //! An exception is raised if Index<=0 or Index >Nbintervals.
0065     void GetInterval (const Standard_Integer Index, Standard_Real& A, Standard_Real& B) const;
0066   
0067   //! returns the State Number associated to the interval Index.
0068   //! An exception is raised if IsDone returns False;
0069   //! An exception is raised if Index<=0 or Index >Nbintervals.
0070     void GetIntervalState (const Standard_Integer Index, Standard_Integer& IFirst, Standard_Integer& ILast) const;
0071   
0072   //! returns the number of points where the function is Null.
0073   //! An exception is raised if IsDone returns False.
0074     Standard_Integer NbPoints() const;
0075   
0076   //! Returns the parameter of the point of range Index.
0077   //! An exception is raised if IsDone returns False;
0078   //! An exception is raised if Index<=0 or Index >NbPoints.
0079     Standard_Real GetPoint (const Standard_Integer Index) const;
0080   
0081   //! returns the State Number associated to the point Index.
0082   //! An exception is raised if IsDone returns False;
0083   //! An exception is raised if Index<=0 or Index >Nbintervals.
0084     Standard_Integer GetPointState (const Standard_Integer Index) const;
0085   
0086   //! Prints on the stream o information on the current state
0087   //! of the object.
0088   Standard_EXPORT void Dump (Standard_OStream& o) const;
0089 
0090 
0091 
0092 
0093 protected:
0094 
0095 
0096 
0097 
0098 
0099 private:
0100 
0101 
0102 
0103   Standard_Boolean done;
0104   TColStd_SequenceOfReal pdeb;
0105   TColStd_SequenceOfReal pfin;
0106   TColStd_SequenceOfReal piso;
0107   TColStd_SequenceOfInteger ideb;
0108   TColStd_SequenceOfInteger ifin;
0109   TColStd_SequenceOfInteger iiso;
0110 
0111 
0112 };
0113 
0114 
0115 #include <math_FunctionAllRoots.lxx>
0116 
0117 
0118 
0119 
0120 
0121 #endif // _math_FunctionAllRoots_HeaderFile