|
A monte carlo pin cell spectral code for nuclear engineering applications.
|
Utility functions for linear interpolation of 1D functions. More...
Go to the source code of this file.
Functions | |
| template<typename T , typename U > | |
| int | findUpperIndex (T *x, int upper_bound, int lower_bound, U pt) |
| This function finds the index of the first element in an array that is greater than the given parameter value. This is a recursive function and it uses the binary search algorithm to find the upper bound index. More... | |
| template<typename T , typename U , typename P > | |
| P | linearInterp (T *x, T *y, int length, U pt) |
| This function takes in the x and y values of a 1D function and returns the linearly interpolated y value at a particular x-coordinate (pt). It assumes that the values given in x are ordered from least to greatest. More... | |
Utility functions for linear interpolation of 1D functions.
| int findUpperIndex | ( | T * | x, |
| int | upper_bound, | ||
| int | lower_bound, | ||
| U | pt | ||
| ) |
This function finds the index of the first element in an array that is greater than the given parameter value. This is a recursive function and it uses the binary search algorithm to find the upper bound index.
| x | array of values to search |
| upper_bound | the current upper bound at this level of recursion |
| lower_bound | the current lower bound at this level of recursion |
| pt | the value to search for |
| P linearInterp | ( | T * | x, |
| T * | y, | ||
| int | length, | ||
| U | pt | ||
| ) |
This function takes in the x and y values of a 1D function and returns the linearly interpolated y value at a particular x-coordinate (pt). It assumes that the values given in x are ordered from least to greatest.
| x | vector of x values |
| y | vector of y values |
| length | the number of x and y |
| pt | x-coordinate we wish to interpolate |