|
chombo-discharge
|
Class for interpolation of f = f(x) data in one independent variable x. More...
#include <CD_LookupTable1D.H>

Public Member Functions | |
| LookupTable1D () noexcept | |
| Default constructor. Creates a table without any entries. | |
| virtual | ~LookupTable1D () noexcept=default |
| Destructor (does nothing). | |
| void | reset () noexcept |
| Reset everything. | |
| template<size_t M, typename... Ts> | |
| LookupTable1D< T, M, I > | slice (const Ts &... a_columns) const noexcept |
| Slice this table, keeping only the user-specified columns. | |
| template<typename... Ts> | |
| void | addData (const Ts &... x) noexcept |
| Add entry. | |
| void | addData (const std::array< T, N+1 > &x) noexcept |
| Add entry. | |
| void | swap (const size_t a_columnOne, const size_t a_columnTwo) noexcept |
| Utility function for swapping columns. | |
| template<size_t K> | |
| void | scale (const T &a_scale) noexcept |
| Utility function which scales one of the columns (either dependent or independent variable) | |
| void | truncate (const T &a_min, const T &a_max, const size_t a_column) noexcept |
| Utility function for truncating raw data along one of the variables (either dependent or independent). | |
| void | setRangeStrategyLo (const LookupTable::OutOfRangeStrategy &a_strategy) noexcept |
| Set the out-of-range strategy on the low end. | |
| void | setRangeStrategyHi (const LookupTable::OutOfRangeStrategy &a_strategy) noexcept |
| Set the out-of-range strategy on the high end. | |
| void | prepareTable (const size_t &a_independentVariable, const size_t &a_numPoints, const LookupTable::Spacing &a_spacing) |
| Turn the raw data into uniform data for fast lookup. | |
| template<size_t K> | |
| T | interpolate (const T &a_x) const |
| Interpolation function for specific dependent variable K. | |
| std::array< T, N+1 > | interpolate (const T &x) const |
| Interpolate whole table. | |
| std::vector< std::array< T, N+1 > > & | getRawData () noexcept |
| Access function for raw data. | |
| std::vector< std::array< T, N+1 > > & | getStructuredData () noexcept |
| Access function for structured data. | |
| const std::vector< std::array< T, N+1 > > & | getRawData () const noexcept |
| Access function for raw data. | |
| const std::vector< std::array< T, N+1 > > & | getStructuredData () const noexcept |
| Access function for structured data. | |
| void | writeRawData (const std::string &a_file) const noexcept |
| Dump raw table data to file. | |
| void | writeStructuredData (const std::string &a_file) const noexcept |
| Dump structured table data to file. | |
| void | outputRawData (std::ostream &a_ostream=std::cout) const noexcept |
| Dump raw table data to output stream. | |
| void | outputStructuredData (std::ostream &a_ostream=std::cout) const noexcept |
| Dump structured table data to file. | |
Protected Member Functions | |
| void | outputData (std::ostream &a_ostream, const std::vector< std::array< T, N+1 > > &a_data) const noexcept |
| Utility function for outputting data. | |
| void | writeToFile (const std::string &a_file, const std::vector< std::array< T, N+1 > > &a_data) const noexcept |
| Utility function for outputting data to a file. | |
| size_t | getIndexLo (const T &a_x) const |
| Get the lower index that brackets the input variable between two data points in the structured grid. | |
Protected Attributes | |
| bool | m_isGood |
| Check if data can be interpolated. | |
| LookupTable::OutOfRangeStrategy | m_rangeStrategyLo |
| Out-of-range strategy on low end. | |
| LookupTable::OutOfRangeStrategy | m_rangeStrategyHi |
| Out-of-range strategy on high end. | |
| std::tuple< LookupTable::Spacing, size_t, T, T, T > | m_grid |
| Underlying 1D grid. This is populated when calling prepareTable. | |
| std::vector< std::array< T, N+1 > > | m_rawData |
| Raw data. | |
| std::vector< std::array< T, N+1 > > | m_structuredData |
| Structured data. This is populated when calling prepareTable. | |
Class for interpolation of f = f(x) data in one independent variable x.
N is the number of additional dependent variables. T must be a floating point type (e.g., float, double)
|
inlinenoexcept |
Add entry.
| [in] | x | Entry to add. |
Add entry.
| [in] | x | Entry to add. For example addData(1,1,1,1). Number of elements in x must be N+1 |
|
inlineprotected |
Get the lower index that brackets the input variable between two data points in the structured grid.
| [in] | a_x | Independent variable. |
|
inlinenoexcept |
Access function for raw data.
|
inlinenoexcept |
Access function for raw data.
|
inlinenoexcept |
Access function for structured data.
|
inlinenoexcept |
Access function for structured data.
|
inline |
Interpolation function for specific dependent variable K.
| [in] | a_x | Independent variable x |
|
inline |
Interpolate whole table.
| [in] | a_x | Independent variable x |
|
inlineprotectednoexcept |
Utility function for outputting data.
| [in] | a_ostream | Output stream |
| [in] | a_data | Data to be sent to output stream |
|
inlinenoexcept |
Dump raw table data to output stream.
| [in] | a_ostream | Output stream |
|
inlinenoexcept |
Dump structured table data to file.
| [in] | a_ostream | Output stream |
|
inline |
Turn the raw data into uniform data for fast lookup.
| [in] | a_independentVariable | The independent variable (i.e., column in the input data). |
| [in] | a_numPoints | Number of points in the input table. |
| [in] | a_spacing | Table spacing |
Utility function which scales one of the columns (either dependent or independent variable)
| [in] | a_scale | Scaling factor |
|
inlinenoexcept |
Set the out-of-range strategy on the high end.
| [in] | a_strategy | Out-of-range strategy on the high end |
|
inlinenoexcept |
Set the out-of-range strategy on the low end.
| [in] | a_strategy | Out-of-range strategy on low end |
|
noexcept |
Slice this table, keeping only the user-specified columns.
This returns a new table with a reduced number of columns.
| [in] |
|
inlinenoexcept |
Utility function for swapping columns.
This is done on the raw data – if the user wants to swap columns in the resampled/structured data then he needs to call this function first and then resample the table.
| [in] | a_columnOne | Column to swap. |
| [in] | a_columnTwo | Column to swap. |
|
inlinenoexcept |
Utility function for truncating raw data along one of the variables (either dependent or independent).
This will discard (from the raw data) all data that fall outside the input interval. This is done on the raw data – the user will need to call prepareTable if the result should propagate into the resampled/structured data.
| [in] | a_min | Minimum value represented. |
| [in] | a_max | Maximum value represented. |
|
inlinenoexcept |
Dump raw table data to file.
| [in] | a_file | File name |
|
inlinenoexcept |
Dump structured table data to file.
| [in] | a_file | File name |
|
inlineprotectednoexcept |
Utility function for outputting data to a file.
| [in] | a_file | File name |
| [in] | a_data | Data to be sent to output stream |