Functions¶
Function1D¶
-
class Function1D : public std::enable_shared_from_this<Function1D>¶
Interface to represent functions of a single variable.
Subclassed by pndl::Constant, pndl::Difference1D, pndl::Polynomial1D, pndl::Sum1D, pndl::Tabulated1D
Public Functions
-
virtual ~Function1D() = default¶
-
virtual double operator()(double x) const = 0¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
inline double evaluate(double x) const¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
virtual double integrate(double x_low, double x_hi) const = 0¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
virtual ~Function1D() = default¶
Constant¶
-
class Constant : public pndl::Function1D¶
Implements a function which is a constant value everywhere.
Public Functions
-
inline Constant(double value)¶
- Parameters
value – Value of the function.
-
~Constant() = default¶
-
inline virtual double operator()(double) const final override¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
inline virtual double integrate(double x_low, double x_hi) const final override¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
inline Constant(double value)¶
Polynomial1D¶
-
class Polynomial1D : public pndl::Function1D¶
A function of a single variable, represented by polynomial coefficients.
Public Functions
-
Polynomial1D(const std::vector<double> &coeffs)¶
- Parameters
coeffs – Vector containing all of the polynomial coefficients.
-
~Polynomial1D() = default¶
-
virtual double operator()(double x) const final override¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
virtual double integrate(double x_low, double x_hi) const final override¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
inline std::size_t order() const¶
Returns the order of the polynomial.
-
inline double coefficient(std::size_t i) const¶
Returns the coefficient for the ith order term.
- Parameters
i – Order of the term.
-
Polynomial1D(const std::vector<double> &coeffs)¶
Tabulated1D¶
-
class Tabulated1D : public pndl::Function1D¶
Interface to represent functions of a single variable which are represented by a tabulation (TAB1 in ENDF).
Public Functions
-
Tabulated1D(const std::vector<uint32_t> &NBT, const std::vector<Interpolation> &INT, const std::vector<double> &x, const std::vector<double> &y)¶
- Parameters
NBT – Vector of the breakpoint location.
INT – Vector of the interpolations for each segment.
x – Vector containing the x grid.
y – Vector contianing the y grid.
-
Tabulated1D(Interpolation interp, const std::vector<double> &x, const std::vector<double> &y)¶
- Parameters
interp – Interpolation method used for all points.
x – Vector of all x points.
y – Vector of all y points.
-
Tabulated1D(const Tabulated1D &other)¶
-
Tabulated1D &operator=(const Tabulated1D &other)¶
-
Tabulated1D(Tabulated1D&&) = default¶
-
Tabulated1D &operator=(Tabulated1D&&) = default¶
-
~Tabulated1D() = default¶
-
inline virtual double operator()(double x) const final override¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
inline virtual double integrate(double x_low, double x_hi) const final override¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
inline const std::vector<uint32_t> &breakpoints() const¶
Returns a vector of the locations in the grid where the interpolation method changes.
-
inline const std::vector<Interpolation> &interpolation() const¶
Returns a vector of the interpolation methods for each segment of the grid.
-
inline const std::vector<double> &x() const¶
Returns a vector of all x points.
-
inline const std::vector<double> &y() const¶
Returns a vector of all y points.
-
inline double min_x() const¶
Returns the lowest x value.
-
inline double max_x() const¶
Returns the highest x value.
-
void linearize(double tolerance = 0.001)¶
Linearizes the function to be linearly interpolable to within the given tolerance.
- Parameters
tolerance – Maximum relative absolute error for linear interpolation. The default tolerance is 0.001, or 0.1%.
-
Tabulated1D(const std::vector<uint32_t> &NBT, const std::vector<Interpolation> &INT, const std::vector<double> &x, const std::vector<double> &y)¶
Sum1D¶
-
class Sum1D : public pndl::Function1D¶
Class to represent a function which is a sum of two other functions.
Public Functions
- Parameters
term1 – Pointer to the function for the first term.
term2 – Pointer to the function for the second term.
-
inline virtual double operator()(double x) const final override¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
inline virtual double integrate(double x_low, double x_hi) const final override¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
inline const Function1D &term_1() const¶
Returns the first function in the sum.
-
inline const Function1D &term_2() const¶
Returns the second function in the sum.
Difference1D¶
-
class Difference1D : public pndl::Function1D¶
Class to represent a function which is the difference of two other functions.
Public Functions
Function will be evaluated as term1(x) - term2(x).
- Parameters
term1 – Pointer to the function for the first term.
term2 – Pointer to the function for the second term.
-
inline virtual double operator()(double x) const final override¶
Evaluates the function for a given value.
- Parameters
x – Value at which to evaluate the function.
-
inline virtual double integrate(double x_low, double x_hi) const final override¶
Computes the definite integral of the function between two values.
- Parameters
x_low – Lower bound of integration.
x_hi – Upper bound of integration.
-
inline const Function1D &term_1() const¶
Returns the first function in the difference.
-
inline const Function1D &term_2() const¶
Returns the second function in the difference.