00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // Class description: 00030 // 00031 // Base Class for realisation of numerical methodes for integration of functions 00032 // with signature double f(double) by Gaussian quadrature methods 00033 // Roots of ortogonal polynoms and corresponding weights are calculated based on 00034 // iteration method (by bisection Newton algorithm). Constant values for initial 00035 // approximations were derived from the book: M. Abramowitz, I. Stegun, Handbook 00036 // of mathematical functions, DOVER Publications INC, New York 1965 ; chapters 9, 00037 // 10, and 22 . 00038 // 00039 // ---------------------------- Member data: ---------------------------------- 00040 // 00041 // fFunction - pointer to the function to be integrated 00042 // fNumber - the number of points in fAbscissa and fWeight arrays 00043 // fAbscissa - array of abscissas, where function will be evaluated 00044 // fWeight - array of corresponding weights 00045 // 00046 // 00047 // ---------------------------------------------------------------------- 00048 // 00049 // Auxiliary function which returns the value of std::log(gamma-function(x)) 00050 // 00051 // G4double 00052 // GammaLogarithm(G4double xx) 00053 00054 // ------------------------------------------------------------------------------ 00055 // 00056 // History: 00057 // 18.04.97 V.Grichine ( Vladimir.Grichine@cern.ch ) 00058 00059 #ifndef G4VGAUSSIANQUADRATURE_HH 00060 #define G4VGAUSSIANQUADRATURE_HH 00061 00062 #include "globals.hh" 00063 00064 typedef G4double (*function)(G4double) ; 00065 00066 class G4VGaussianQuadrature 00067 { 00068 public: 00069 00070 explicit G4VGaussianQuadrature( function pFunction ) ; 00071 // Base constructor 00072 00073 virtual ~G4VGaussianQuadrature() ; 00074 // Virtual destructor 00075 00076 G4double GetAbscissa(G4int index) const ; 00077 G4double GetWeight(G4int index) const ; 00078 G4int GetNumber() const; 00079 // Access functions 00080 00081 protected: 00082 00083 G4double GammaLogarithm(G4double xx) ; 00084 00085 // Data members common for GaussianQuadrature family 00086 // 00087 function fFunction ; 00088 G4double* fAbscissa ; 00089 G4double* fWeight ; 00090 G4int fNumber ; 00091 00092 private: 00093 00094 G4VGaussianQuadrature(const G4VGaussianQuadrature&); 00095 G4VGaussianQuadrature& operator=(const G4VGaussianQuadrature&); 00096 }; 00097 00098 #endif