![]() |
Grid Interpolation
|
gridInterp is a header only c++ library that interpolates gridded formatted data.
If your data are organized in rows, columns and layers then gridInterp can be used to interpolate between the data.
IMPORTANT NOTE:
The library is designed to be used up to 3D.
There is really nothing to install.
All you need is to clone the repository
To use the library just add the following include in your code and you are good to go.
Feel free to copy the entire gridInterp.h file under your source of the project. However there is a better way to embed the library into the code using cmake.
Before the ADD_EXECUTABLE command add the following line into your CMakeLists.txt file
Then during configuration pass the variable GRID_INTERP as
All the methods and classes are defined into the GRID_INTERP namespace. The main class is the GRID_INTERP::interp
One can defined 1-2-3D interpolation objects as follows:
These are empty containers. You can populate the with data using the related methods.
In all dimensions the workflow is the same.
If the data are written into files then the method GRID_INTERP::interp::getDataFromFile can be used to populate the object with data.
To populate the data using code, first initialize the object
Then use either
for evenly spaced data or
for variably spaced data. Repeat the above code for each axis.
Next we can set data values using the method
Last we can set the interpolation method using
The object is ready to be used for interpolation using the
method e.g:
Under the main folder of the repository there is a folder Rgridinterp with an R script with examples on how to prepare the data using R. The script PrepateInputFiles.R creates the input files that are used in the tests.h file.
This examples generate the following test figures:
The library offers 2 interpolation modes and 2 interpolation methods
This interpolation type is implemented for 3D only. In groundwater modelling it is common to have layers with varying elevation.
Detail documentation can be found here
I hope the following link wont break soon. https://code.visualstudio.com/docs/cpp/config-linux
1.8.13