Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,158 +23,81 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// G4ChebyshevApproximation
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class creating the Chebyshev approximation for a function pointed by fFunction
|
||||
// data member. The Chebyshev polinom approximation provides an efficient evaluation
|
||||
// of minimax polynomial, which (among all polynomials of the same degree) has the
|
||||
// smallest maximum deviation from the true function.
|
||||
// The methods based mainly on recommendations given in the book : An introduction to
|
||||
// NUMERICAL METHODS IN C++, B.H. Flowers, Claredon Press, Oxford, 1995
|
||||
//
|
||||
// ------------------------- MEMBER DATA ------------------------------------
|
||||
//
|
||||
// function fFunction - pointer to a function considered
|
||||
// G4int fNumber - number of Chebyshev coefficients
|
||||
// G4double* fChebyshevCof - array of Chebyshev coefficients
|
||||
// G4double fMean = (a+b)/2 - mean point of interval
|
||||
// G4double fDiff = (b-a)/2 - half of the interval value
|
||||
//
|
||||
// ------------------------ CONSTRUCTORS ----------------------------------
|
||||
//
|
||||
// Constructor for initialisation of the class data members. It creates the array
|
||||
// fChebyshevCof[0,...,fNumber-1], fNumber = n ; which consists of Chebyshev
|
||||
// coefficients describing the function pointed by pFunction. The values a and b
|
||||
// fixe the interval of validity of Chebyshev approximation.
|
||||
//
|
||||
// G4ChebyshevApproximation( function pFunction,
|
||||
// G4int n,
|
||||
// G4double a,
|
||||
// G4double b )
|
||||
//
|
||||
// Class creating the Chebyshev approximation for a function pointed by
|
||||
// fFunction data member. The Chebyshev polinom approximation provides an
|
||||
// efficient evaluation of minimax polynomial, which (among all polynomials of
|
||||
// the same degree) has the smallest maximum deviation from the true function.
|
||||
// The methods based mainly on recommendations given in the book : An
|
||||
// introduction to NUMERICAL METHODS IN C++, B.H. Flowers, Claredon Press,
|
||||
// Oxford, 1995
|
||||
|
||||
// Author: V.Grichine, 24.04.1997
|
||||
// --------------------------------------------------------------------
|
||||
//
|
||||
// Constructor for creation of Chebyshev coefficients for m-derivative
|
||||
// from pFunction. The value of m ! MUST BE ! < n , because the result
|
||||
// array of fChebyshevCof will be of (n-m) size. There is a definite dependence
|
||||
// between the proper selection of n, m, a and b values to get better accuracy
|
||||
// of the derivative value.
|
||||
//
|
||||
// G4ChebyshevApproximation( function pFunction,
|
||||
// G4int n,
|
||||
// G4int m,
|
||||
// G4double a,
|
||||
// G4double b )
|
||||
//
|
||||
// ------------------------------------------------------
|
||||
//
|
||||
// Constructor for creation of Chebyshev coefficients for integral
|
||||
// from pFunction.
|
||||
//
|
||||
// G4ChebyshevApproximation( function pFunction,
|
||||
// G4double a,
|
||||
// G4double b,
|
||||
// G4int n )
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// Destructor deletes the array of Chebyshev coefficients
|
||||
//
|
||||
// ~G4ChebyshevApproximation()
|
||||
//
|
||||
// ----------------------------- METHODS ----------------------------------
|
||||
//
|
||||
// Access function for Chebyshev coefficients
|
||||
//
|
||||
// G4double GetChebyshevCof(G4int number) const
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
// Evaluate the value of fFunction at the point x via the Chebyshev coefficients
|
||||
// fChebyshevCof[0,...,fNumber-1]
|
||||
//
|
||||
// G4double ChebyshevEvaluation(G4double x) const
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Returns the array derCof[0,...,fNumber-2], the Chebyshev coefficients of the
|
||||
// derivative of the function whose coefficients are fChebyshevCof
|
||||
//
|
||||
// void DerivativeChebyshevCof(G4double derCof[]) const
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// This function produces the array integralCof[0,...,fNumber-1] , the Chebyshev
|
||||
// coefficients of the integral of the function whose coefficients are
|
||||
// fChebyshevCof. The constant of integration is set so that the integral vanishes
|
||||
// at the point (fMean - fDiff)
|
||||
//
|
||||
// void IntegralChebyshevCof(G4double integralCof[]) const
|
||||
|
||||
// --------------------------- HISTORY --------------------------------------
|
||||
//
|
||||
// 24.04.97 V.Grichine ( Vladimir.Grichine@cern.ch )
|
||||
|
||||
#ifndef G4CHEBYSHEVAPPROXIMATION_HH
|
||||
#define G4CHEBYSHEVAPPROXIMATION_HH
|
||||
#define G4CHEBYSHEVAPPROXIMATION_HH 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
typedef G4double (*function)(G4double) ;
|
||||
typedef G4double (*function)(G4double);
|
||||
|
||||
class G4ChebyshevApproximation
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
G4ChebyshevApproximation(function pFunction, G4int n, G4double a, G4double b);
|
||||
// Constructor for creation of Chebyshev coefficients for m-derivative
|
||||
// from pFunction. The value of m ! MUST BE ! < n , because the result
|
||||
// array of fChebyshevCof will be of (n-m) size.
|
||||
// It creates the array fChebyshevCof[0,...,fNumber-1], fNumber = n ;
|
||||
// which consists of Chebyshev coefficients describing the function pointed
|
||||
// by pFunction. The values a and b fixe the interval of validity of
|
||||
// Chebyshev approximation.
|
||||
|
||||
G4ChebyshevApproximation( function pFunction,
|
||||
G4int n,
|
||||
G4double a,
|
||||
G4double b ) ;
|
||||
//
|
||||
// Constructor for creation of Chebyshev coefficients for m-derivative
|
||||
// from pFunction. The value of m ! MUST BE ! < n , because the result
|
||||
// array of fChebyshevCof will be of (n-m) size.
|
||||
G4ChebyshevApproximation(function pFunction, G4int n, G4int m, G4double a,
|
||||
G4double b);
|
||||
// Constructor for creation of Chebyshev coefficients for m-derivative
|
||||
// from pFunction. The value of m ! MUST BE ! < n , because the result
|
||||
// array of fChebyshevCof will be of (n-m) size. There is a definite
|
||||
// dependence between the proper selection of n, m, a and b values to get
|
||||
// better accuracy of the derivative value.
|
||||
|
||||
G4ChebyshevApproximation( function pFunction,
|
||||
G4int n,
|
||||
G4int m,
|
||||
G4double a,
|
||||
G4double b ) ;
|
||||
//
|
||||
// Constructor for creation of Chebyshev coefficients for integral
|
||||
// from pFunction.
|
||||
G4ChebyshevApproximation(function pFunction, G4double a, G4double b, G4int n);
|
||||
// Constructor for creation of Chebyshev coefficients for integral
|
||||
// from pFunction.
|
||||
|
||||
G4ChebyshevApproximation( function pFunction,
|
||||
G4double a,
|
||||
G4double b,
|
||||
G4int n ) ;
|
||||
~G4ChebyshevApproximation();
|
||||
// Destructor deletes the array of Chebyshev coefficients
|
||||
|
||||
~G4ChebyshevApproximation() ;
|
||||
|
||||
// Access functions
|
||||
|
||||
G4double GetChebyshevCof(G4int number) const ;
|
||||
|
||||
// Methods
|
||||
G4ChebyshevApproximation(const G4ChebyshevApproximation&) = delete;
|
||||
G4ChebyshevApproximation& operator=(const G4ChebyshevApproximation&) = delete;
|
||||
// Copy constructor and assignment operator not allowed.
|
||||
|
||||
G4double ChebyshevEvaluation(G4double x) const ;
|
||||
void DerivativeChebyshevCof(G4double derCof[]) const ;
|
||||
void IntegralChebyshevCof(G4double integralCof[]) const ;
|
||||
|
||||
private:
|
||||
G4double GetChebyshevCof(G4int number) const;
|
||||
// Access function for Chebyshev coefficients
|
||||
|
||||
G4ChebyshevApproximation(const G4ChebyshevApproximation&);
|
||||
G4ChebyshevApproximation& operator=(const G4ChebyshevApproximation&);
|
||||
G4double ChebyshevEvaluation(G4double x) const;
|
||||
// Evaluate the value of fFunction at the point x via the Chebyshev
|
||||
// coefficients fChebyshevCof[0,...,fNumber-1]
|
||||
|
||||
private:
|
||||
void DerivativeChebyshevCof(G4double derCof[]) const;
|
||||
// Returns the array derCof[0,...,fNumber-2], the Chebyshev coefficients
|
||||
// of the derivative of the function whose coefficients are fChebyshevCof
|
||||
|
||||
function fFunction ;
|
||||
G4int fNumber ;
|
||||
G4double* fChebyshevCof ;
|
||||
G4double fMean ;
|
||||
G4double fDiff ;
|
||||
void IntegralChebyshevCof(G4double integralCof[]) const;
|
||||
// This function produces the array integralCof[0,...,fNumber-1] , the
|
||||
// Chebyshev coefficients of the integral of the function whose coefficients
|
||||
// are fChebyshevCof. The constant of integration is set so that the integral
|
||||
// vanishes at the point (fMean - fDiff)
|
||||
|
||||
private:
|
||||
function fFunction; // pointer to a function considered
|
||||
G4int fNumber; // number of Chebyshev coefficients
|
||||
G4double* fChebyshevCof; // array of Chebyshev coefficients
|
||||
G4double fMean; // (a+b)/2 - mean point of interval
|
||||
G4double fDiff; // (b-a)/2 - half of the interval value
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user