Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2005-12-08
0002 // Created by: Sergey KHROMOV
0003 // Copyright (c) 2005-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _math_KronrodSingleIntegration_HeaderFile
0017 #define _math_KronrodSingleIntegration_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <math_Vector.hxx>
0024 class math_Function;
0025 
0026 
0027 //! This class implements the Gauss-Kronrod method of
0028 //! integral computation.
0029 class math_KronrodSingleIntegration 
0030 {
0031 public:
0032 
0033   DEFINE_STANDARD_ALLOC
0034 
0035   
0036   //! An empty constructor.
0037   Standard_EXPORT math_KronrodSingleIntegration();
0038   
0039   //! Constructor. Takes the function, the lower and upper bound
0040   //! values, the initial number of Kronrod points
0041   Standard_EXPORT math_KronrodSingleIntegration(math_Function& theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts);
0042   
0043   //! Constructor. Takes the function, the lower and upper bound
0044   //! values, the initial number of Kronrod points, the
0045   //! tolerance value and the maximal number of iterations as
0046   //! parameters.
0047   Standard_EXPORT math_KronrodSingleIntegration(math_Function& theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts, const Standard_Real theTolerance, const Standard_Integer theMaxNbIter);
0048   
0049   //! Computation of the integral. Takes the function,
0050   //! the lower and upper bound values, the initial number
0051   //! of Kronrod points, the relative tolerance value and the
0052   //! maximal number of iterations as parameters.
0053   //! theNbPnts should be odd and greater then or equal to 3.
0054   Standard_EXPORT void Perform (math_Function& theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts);
0055   
0056   //! Computation of the integral. Takes the function,
0057   //! the lower and upper bound values, the initial number
0058   //! of Kronrod points, the relative tolerance value and the
0059   //! maximal number of iterations as parameters.
0060   //! theNbPnts should be odd and greater then or equal to 3.
0061   //! Note that theTolerance is relative, i.e. the criterion of
0062   //! solution reaching is:
0063   //! Abs(Kronrod - Gauss)/Abs(Kronrod) < theTolerance.
0064   //! theTolerance should be positive.
0065   Standard_EXPORT void Perform (math_Function& theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts, const Standard_Real theTolerance, const Standard_Integer theMaxNbIter);
0066   
0067   //! Returns Standard_True if computation is performed
0068   //! successfully.
0069     Standard_Boolean IsDone() const;
0070   
0071   //! Returns the value of the integral.
0072     Standard_Real Value() const;
0073   
0074   //! Returns the value of the relative error reached.
0075     Standard_Real ErrorReached() const;
0076   
0077   //! Returns the value of the relative error reached.
0078     Standard_Real AbsolutError() const;
0079   
0080   //! Returns the number of Kronrod points
0081   //! for which the result is computed.
0082     Standard_Integer OrderReached() const;
0083   
0084   //! Returns the number of iterations
0085   //! that were made to compute result.
0086     Standard_Integer NbIterReached() const;
0087   
0088   Standard_EXPORT static Standard_Boolean GKRule (math_Function& theFunction, const Standard_Real theLower, const Standard_Real theUpper, const math_Vector& theGaussP, const math_Vector& theGaussW, const math_Vector& theKronrodP, const math_Vector& theKronrodW, Standard_Real& theValue, Standard_Real& theError);
0089 
0090 
0091 
0092 
0093 protected:
0094 
0095 
0096 
0097 
0098 
0099 private:
0100 
0101 
0102 
0103   Standard_Boolean myIsDone;
0104   Standard_Real myValue;
0105   Standard_Real myErrorReached;
0106   Standard_Real myAbsolutError;
0107   Standard_Integer myNbPntsReached;
0108   Standard_Integer myNbIterReached;
0109 
0110 
0111 };
0112 
0113 
0114 #include <math_KronrodSingleIntegration.lxx>
0115 
0116 
0117 
0118 
0119 
0120 #endif // _math_KronrodSingleIntegration_HeaderFile