CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule Class Reference
+ Inheritance diagram for Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule:

Public Member Functions

 XtMidpointQuadratureRule ()
 
 ~XtMidpointQuadratureRule ()
 
virtual double integrate (const AbsFunction &function, double a, double b, unsigned int j) const
 
virtual unsigned int stepMultiplier () const
 
virtual unsigned int numFunctionCalls () const
 
- Public Member Functions inherited from Genfun::DefiniteIntegral::Clockwork::QuadratureRule
 QuadratureRule ()
 
virtual ~QuadratureRule ()
 
virtual double integrate (const AbsFunction &function, double a, double b, unsigned int j) const =0
 
virtual unsigned int stepMultiplier () const =0
 
virtual unsigned int numFunctionCalls () const =0
 

Detailed Description

Definition at line 77 of file DefiniteIntegral.cc.

Constructor & Destructor Documentation

◆ XtMidpointQuadratureRule()

Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule::XtMidpointQuadratureRule ( )
inline

Definition at line 82 of file DefiniteIntegral.cc.

82:retVal(0),nFunctionCalls(0) {};

◆ ~XtMidpointQuadratureRule()

Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule::~XtMidpointQuadratureRule ( )
inline

Definition at line 85 of file DefiniteIntegral.cc.

85{};

Member Function Documentation

◆ integrate()

double Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule::integrate ( const AbsFunction function,
double  a,
double  b,
unsigned int  j 
) const
virtual

Implements Genfun::DefiniteIntegral::Clockwork::QuadratureRule.

Definition at line 246 of file DefiniteIntegral.cc.

246 {
247 unsigned int it, j;
248 if (n==1) {
249 retVal = (bb-aa)*(function((aa+bb)/2.0));
250 nFunctionCalls+=1;
251 }
252 else {
253 for (it=1,j=1;j<n-1;j++) it *=3;
254 double tnm=it;
255 double del = (bb-aa)/(3.0*tnm);
256 double ddel = del+del;
257 double x=aa+0.5*del;
258 double sum=0;
259 for (j=1;j<=it;j++) {
260 sum +=function(x);
261 x+=ddel;
262 sum +=function(x);
263 x+=del;
264 nFunctionCalls+=2;
265 }
266 retVal = (retVal+(bb-aa)*sum/tnm)/3.0;
267 }
268 return retVal;
269 }

◆ numFunctionCalls()

virtual unsigned int Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule::numFunctionCalls ( ) const
inlinevirtual

Implements Genfun::DefiniteIntegral::Clockwork::QuadratureRule.

Definition at line 97 of file DefiniteIntegral.cc.

97{return nFunctionCalls;};

◆ stepMultiplier()

virtual unsigned int Genfun::DefiniteIntegral::Clockwork::XtMidpointQuadratureRule::stepMultiplier ( ) const
inlinevirtual

Implements Genfun::DefiniteIntegral::Clockwork::QuadratureRule.

Definition at line 94 of file DefiniteIntegral.cc.

94{return 3;}

The documentation for this class was generated from the following file: