134 lines
5.2 KiB
C++
134 lines
5.2 KiB
C++
//
|
|
// ********************************************************************
|
|
// * DISCLAIMER *
|
|
// * *
|
|
// * The following disclaimer summarizes all the specific disclaimers *
|
|
// * of contributors to this software. The specific disclaimers,which *
|
|
// * govern, are listed with their locations in: *
|
|
// * http://cern.ch/geant4/license *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. *
|
|
// * *
|
|
// * This code implementation is the intellectual property of the *
|
|
// * GEANT4 collaboration. *
|
|
// * By copying, distributing or modifying the Program (or any work *
|
|
// * based on the Program) you indicate your acceptance of this *
|
|
// * statement, and all its terms. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// $Id: G4Integrator.hh,v 1.5 2001/07/11 10:00:39 gunter Exp $
|
|
// GEANT4 tag $Name: geant4-05-00 $
|
|
//
|
|
// Class description:
|
|
//
|
|
// Template class collecting integrator methods for generic funtions.
|
|
|
|
// History:
|
|
//
|
|
// 04.09.99 V.Grichine, first implementation based on G4SimpleIntegration class
|
|
// H.P.Wellisch, G.Cosmo, and E.Cherniaev advises
|
|
// 08.09.99 V.Grichine, methods involving orthogonal polynomials
|
|
//
|
|
|
|
|
|
#ifndef G4INTEGRATOR_HH
|
|
#define G4INTEGRATOR_HH 1
|
|
|
|
#include "globals.hh"
|
|
#include <math.h>
|
|
|
|
template <class T, class F>
|
|
class G4Integrator
|
|
{
|
|
public: // with description
|
|
|
|
G4Integrator(){;}
|
|
~G4Integrator(){;}
|
|
|
|
G4double Simpson( T& typeT, F f, G4double a, G4double b, G4int n ) ;
|
|
G4double Simpson( T* ptrT, F f, G4double a, G4double b, G4int n ) ;
|
|
G4double Simpson( G4double (*f)(G4double),
|
|
G4double a, G4double b, G4int n ) ;
|
|
// Simpson integration method
|
|
|
|
G4double AdaptiveGauss( T& typeT, F f, G4double a, G4double b, G4double e ) ;
|
|
G4double AdaptiveGauss( T* ptrT, F f, G4double a, G4double b, G4double e ) ;
|
|
G4double AdaptiveGauss( G4double (*f)(G4double),
|
|
G4double a, G4double b, G4double e ) ;
|
|
// Adaptive Gauss method
|
|
|
|
|
|
// Integration methods involving orthogohol polynomials
|
|
|
|
G4double Legendre( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
|
G4double Legendre( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
|
G4double Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
|
//
|
|
// Methods involving Legendre polynomials
|
|
|
|
G4double Legendre10( T& typeT, F f,G4double a, G4double b) ;
|
|
G4double Legendre10( T* ptrT, F f,G4double a, G4double b) ;
|
|
G4double Legendre10( G4double (*f)(G4double), G4double a, G4double b) ;
|
|
//
|
|
// Legendre10 is very fast and accurate enough
|
|
|
|
G4double Legendre96( T& typeT, F f,G4double a, G4double b) ;
|
|
G4double Legendre96( T* ptrT, F f,G4double a, G4double b) ;
|
|
G4double Legendre96( G4double (*f)(G4double), G4double a, G4double b) ;
|
|
//
|
|
// Legendre96 is very accurate and fast enough
|
|
|
|
G4double Chebyshev( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
|
G4double Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
|
G4double Chebyshev( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
|
//
|
|
// Methods involving Chebyshev polynomials
|
|
|
|
G4double Laguerre( T& typeT, F f, G4double alpha, G4int n) ;
|
|
G4double Laguerre( T* ptrT, F f, G4double alpha, G4int n) ;
|
|
G4double Laguerre( G4double (*f)(G4double), G4double alpha, G4int n) ;
|
|
//
|
|
// Method involving Laguerre polynomials
|
|
|
|
G4double Hermite( T& typeT, F f, G4int n) ;
|
|
G4double Hermite( T* ptrT, F f, G4int n) ;
|
|
G4double Hermite( G4double (*f)(G4double), G4int n) ;
|
|
//
|
|
// Method involving Hermite polynomials
|
|
|
|
G4double Jacobi( T& typeT, F f, G4double alpha, G4double beta, G4int n) ;
|
|
G4double Jacobi( T* ptrT, F f, G4double alpha, G4double beta, G4int n) ;
|
|
G4double Jacobi( G4double (*f)(G4double), G4double alpha,
|
|
G4double beta, G4int n) ;
|
|
// Method involving Jacobi polynomials
|
|
|
|
|
|
protected:
|
|
|
|
// Auxiliary function for adaptive Gauss method
|
|
|
|
G4double Gauss( T& typeT, F f, G4double a, G4double b ) ;
|
|
G4double Gauss( T* ptrT, F f, G4double a, G4double b ) ;
|
|
G4double Gauss( G4double (*f)(G4double), G4double a, G4double b) ;
|
|
|
|
void AdaptGauss( T& typeT, F f, G4double a, G4double b,
|
|
G4double e, G4double& sum, G4int& n) ;
|
|
void AdaptGauss( T* typeT, F f, G4double a, G4double b,
|
|
G4double e, G4double& sum, G4int& n ) ;
|
|
void AdaptGauss( G4double (*f)(G4double), G4double a, G4double b,
|
|
G4double e, G4double& sum, G4int& n ) ;
|
|
|
|
G4double GammaLogarithm(G4double xx) ;
|
|
|
|
|
|
} ;
|
|
|
|
#include "G4Integrator.icc"
|
|
|
|
#endif
|