A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
integrate.h File Reference

Utility functions for numerical integration of 1D functions. More...

Go to the source code of this file.

Typedefs

typedef enum integrationSchemes integrationScheme
 Numerical integration methods.
 

Enumerations

enum  integrationSchemes {
  RIEMANN_LEFT, RIEMANN_RIGHT, RIEMANN_CENTER, TRAPEZOIDAL,
  SIMPSONS, SIMPSONS38, BOOLES
}
 Numerical integration methods. More...
 

Functions

template<typename T , typename U >
void cumulativeIntegral (T *x, T *y, U *cdf, int length, integrationScheme scheme)
 Performs a cumulative numerical integral over arrays of x and y values using the specificed integration method. More...
 
template<typename T >
double computeRiemannLeft (T *x, T *y, int length)
 Performs a numerical integral using the left-centered Riemann numerical integration method. More...
 
template<typename T >
double computeRiemannRight (T *x, T *y, int length)
 Performs a numerical integral using the right-centered Riemann numerical integration method. More...
 
template<typename T >
double computeRiemannCenter (T *x, T *y, int length)
 Performs a numerical integral using the midpoint-centered Riemann numerical integration method. More...
 
template<typename T >
double computeTrapezoidal (T *x, T *y, int length)
 Performs a numerical integral using the trapezoidal numerical integration method. More...
 
template<typename T >
double computeSimpsons (T *x, T *y, int length)
 Performs a numerical integral using the Simpson's numerical integration method. More...
 
template<typename T >
double computeSimpsons38 (T *x, T *y, int length)
 Performs a numerical integral using the Simpson's 3/8ths numerical integration method. More...
 
template<typename T >
double computeBooles (T *x, T *y, int length)
 Performs a numerical integral using the Boole's numerical integration method. More...
 
template<typename T >
double integrate (T *x, T *y, int length, integrationScheme scheme)
 Performs a 1D numerical integral over arrays of x and y values using the specified integration scheme. More...
 

Detailed Description

Utility functions for numerical integration of 1D functions.

This module provides a set of templated integration methods for both normal numerical integration and cumulative numerical integration. It implements the Riemann integration method with left-aligned, right-aligned and midpoint methods, the trapezoidal integration, and higher-order Simpsons, Simpson's 3/8ths and Boole's methods.

Author
William Boyd (wboyd.nosp@m.@mit.nosp@m..edu)
Date
February 9, 2012

Enumeration Type Documentation

Numerical integration methods.

Enumerator
RIEMANN_LEFT 

Left-aligned Riemann integration method

RIEMANN_RIGHT 

Right-aligned Riemann integration method

RIEMANN_CENTER 

Midpoint Riemann integration method

TRAPEZOIDAL 

Trapezoidal integration method

SIMPSONS 

Simpson's integration method

SIMPSONS38 

Simpson's 3/8ths integration method

BOOLES 

Boole's integration method

Function Documentation

template<typename T >
double computeBooles ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the Boole's numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeRiemannCenter ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the midpoint-centered Riemann numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeRiemannLeft ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the left-centered Riemann numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeRiemannRight ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the right-centered Riemann numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeSimpsons ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the Simpson's numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeSimpsons38 ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the Simpson's 3/8ths numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T >
double computeTrapezoidal ( T *  x,
T *  y,
int  length 
)

Performs a numerical integral using the trapezoidal numerical integration method.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
Returns
the integral value
template<typename T , typename U >
void cumulativeIntegral ( T *  x,
T *  y,
U *  cdf,
int  length,
integrationScheme  scheme 
)

Performs a cumulative numerical integral over arrays of x and y values using the specificed integration method.

Parameters
xthe the x values
ythe y values
cdfthe array of cdf values at each value of x and y
lengththe length of the x and y arrays
schemethe integration scheme
template<typename T >
double integrate ( T *  x,
T *  y,
int  length,
integrationScheme  scheme 
)

Performs a 1D numerical integral over arrays of x and y values using the specified integration scheme.

Parameters
xthe the x values
ythe y values
lengththe length of the x and y arrays
schemeintegration scheme
Returns
the integral value