├── .clang-format ├── .github ├── requirements.txt └── workflows │ ├── linux-gcc.yml │ ├── mac-clang.yml │ └── windows-msvc.yml ├── .gitignore ├── .gitlab-ci.yml ├── .travis.yml ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── applications ├── CMakeLists.txt ├── conanfile.txt └── interp-cli.cpp ├── cmake └── Modules │ ├── macro-find_project_dependency.cmake │ └── macro-git_version.cmake ├── conanfile.txt ├── doc ├── CMakeLists.txt ├── Makefile ├── README.md.t ├── figures │ └── dalaunay-triangle-method │ │ ├── data.txt │ │ ├── example.gp │ │ ├── example.png │ │ ├── out.txt │ │ ├── preview.log │ │ └── xy.txt └── libInterp.doxygen ├── externals └── .gitignore ├── justfile ├── src ├── .gitignore └── libInterpolate │ ├── AnyInterpolator.hpp │ ├── Interpolate.hpp │ ├── Interpolators │ ├── _1D │ │ ├── AnyInterpolator.hpp │ │ ├── CubicSplineInterpolator.hpp │ │ ├── InterpolatorBase.hpp │ │ ├── LinearInterpolator.hpp │ │ └── MonotonicInterpolator.hpp │ └── _2D │ │ ├── AnyInterpolator.hpp │ │ ├── BicubicInterpolator.hpp │ │ ├── BilinearInterpolator.hpp │ │ ├── DelaunayTriangulationInterpolatorBase.hpp │ │ ├── InterpolatorBase.hpp │ │ ├── LinearDelaunayTriangleInterpolator.hpp │ │ ├── NearestNeighborInterpolator.hpp │ │ └── ThinPlateSplineInterpolator.hpp │ └── Utils │ ├── Concepts.hpp │ ├── Indexing.hpp │ ├── Meshing │ └── delaunator-cpp.hpp │ ├── PriorityTag.hpp │ └── ReadFunction.hpp └── testing ├── CMakeLists.txt ├── CatchTests ├── 1D │ ├── AnyInterpolator.cpp │ ├── Constructors.cpp │ ├── CubicSplineInterpolatorTests.cpp │ ├── InterpolatorBaseTests.cpp │ ├── LinearInterpolatorTests.cpp │ ├── MonotonicInterpolatorTests.cpp │ ├── Performance.cpp │ ├── RuntimePolymorphism.cpp │ └── Semantics.cpp ├── 2D │ ├── AnyInterpolator.cpp │ ├── BicubicInterpolatorTests.cpp │ ├── BilinearInterpolatorTests.cpp │ ├── Constructors.cpp │ ├── InterpolatorBaseTests.cpp │ ├── LinearDelaunayTriangleInterpolator.cpp │ ├── NearestNeighborInterpolatorTests.cpp │ ├── Performance.cpp │ ├── RuntimePolymorphism.cpp │ ├── Semantics.cpp │ ├── ThinPlateSplineInterpolatorTests.cpp │ └── TriangleInterpolatorBaseTests.cpp ├── Bugs │ └── MonotonicInterpolatorWithFloat.cpp ├── Devel.cpp ├── Examples.cpp └── UtilsTests.cpp ├── CramTests ├── build.t └── interp-cli.t ├── NoniusBenchmarks ├── 2D │ ├── BicubicInterpolatorBenchmarks.cpp │ ├── BicubicInterpolatorBenchmarks.cpp.t │ ├── BilinearInterpolatorBenchmarks.cpp │ ├── BilinearInterpolatorBenchmarks.cpp.t │ └── ThinPlateSplineInterpolatorBenchmarks.cpp └── Utils │ └── DataSet.hpp ├── client_project ├── CMakeLists.txt └── example.cpp ├── data └── README.md └── pre-tag-release.sh /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | IndentWidth: 4 4 | --- 5 | Language: Cpp 6 | DerivePointerAlignment: false 7 | PointerAlignment: Left 8 | --- 9 | -------------------------------------------------------------------------------- /.github/requirements.txt: -------------------------------------------------------------------------------- 1 | conan 2 | -------------------------------------------------------------------------------- /.github/workflows/linux-gcc.yml: -------------------------------------------------------------------------------- 1 | name: linux-gcc 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - 'doc/**' 9 | - '**/*.md' 10 | - .travis.yml 11 | - .gitlab-ci.yml 12 | workflow_dispatch: 13 | pull_request: 14 | paths-ignore: 15 | - 'doc/**' 16 | - '**/*.md' 17 | - .travis.yml 18 | - .gitlab-ci.yml 19 | 20 | jobs: 21 | build: 22 | name: ci-ubuntu-24.04-gcc-13 23 | runs-on: ubuntu-24.04 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v4 28 | 29 | - name: Cache Conan packages 30 | id: cache-conan 31 | uses: actions/cache@v4.0.2 32 | env: 33 | cache-name: cache-conan-packages 34 | with: 35 | path: ~/.conan2 36 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('conanfile.txt') }} 37 | restore-keys: | 38 | ${{ runner.os }}-build-${{ env.cache-name }}- 39 | ${{ runner.os }}-build- 40 | ${{ runner.os }}- 41 | 42 | - name: Configure python 43 | uses: actions/setup-python@v5 44 | with: 45 | python-version: '3.10' 46 | cache: 'pip' 47 | 48 | - name: Install Python dependencies 49 | run: pip install -r .github/requirements.txt 50 | 51 | - name: Configure Conan profile 52 | run: conan profile detect --force --name default 53 | 54 | - name: Install Conan dependencies 55 | run: conan install conanfile.txt -r conancenter --build=missing 56 | 57 | - name: Configure CMake 58 | run: | 59 | cmake -S . -B build \ 60 | -DCMAKE_BUILD_TYPE=Release \ 61 | -DBUILD_TESTS:BOOL=ON \ 62 | -DCMAKE_INSTALL_PREFIX=install \ 63 | -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake 64 | 65 | - name: Build 66 | run: cmake --build build 67 | 68 | - name: Test 69 | run: cmake --build build --target test 70 | 71 | - name: Install 72 | run: cmake --build build --target install 73 | -------------------------------------------------------------------------------- /.github/workflows/mac-clang.yml: -------------------------------------------------------------------------------- 1 | name: mac-clang 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - 'doc/**' 9 | - '**/*.md' 10 | - .travis.yml 11 | - .gitlab-ci.yml 12 | workflow_dispatch: 13 | pull_request: 14 | paths-ignore: 15 | - 'doc/**' 16 | - '**/*.md' 17 | - .travis.yml 18 | - .gitlab-ci.yml 19 | 20 | jobs: 21 | build: 22 | runs-on: macos-14 23 | name: ci-macos-14-apple-clang-18 24 | env: 25 | CLANG18_PATH: /opt/homebrew/opt/llvm@18/bin/clang 26 | 27 | steps: 28 | - name: Checkout 29 | uses: actions/checkout@v4 30 | 31 | - name: Install ccache 32 | uses: hendrikmuhs/ccache-action@v1.2 33 | 34 | - name: Install clang 35 | run: | 36 | brew install llvm@18 \ 37 | && echo 'export PATH="/opt/homebrew/opt/llvm@18/bin:$PATH"' >> /Users/runner/.bash_profile \ 38 | && source /Users/runner/.bash_profile \ 39 | && which clang++ 40 | 41 | - name: Cache Conan packages 42 | id: cache-conan 43 | uses: actions/cache@v4.0.2 44 | env: 45 | cache-name: cache-conan-packages 46 | with: 47 | path: ~/.conan2 48 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('conanfile.txt') }} 49 | restore-keys: | 50 | ${{ runner.os }}-build-${{ env.cache-name }}- 51 | ${{ runner.os }}-build- 52 | ${{ runner.os }}- 53 | 54 | - name: Configure python 55 | uses: actions/setup-python@v5 56 | with: 57 | python-version: '3.10' 58 | cache: 'pip' 59 | 60 | - name: Install Python dependencies 61 | run: pip install -r .github/requirements.txt 62 | 63 | - name: Configure Conan profile 64 | run: | 65 | CC=${{ env.CLANG18_PATH }} \ 66 | CXX=${{ env.CLANG18_PATH }}++ \ 67 | conan profile detect --force --name default 68 | 69 | - name: Install Conan dependencies 70 | run: | 71 | conan install conanfile.txt \ 72 | -r conancenter \ 73 | -s compiler.cppstd=17 \ 74 | -s build_type=Release \ 75 | -c:b tools.build:compiler_executables="{'c': '${{ env.CLANG18_PATH }}', 'cpp': '${{ env.CLANG18_PATH }}++'}" \ 76 | -c:h tools.build:compiler_executables="{'c': '${{ env.CLANG18_PATH }}', 'cpp': '${{ env.CLANG18_PATH }}++'}" \ 77 | --build=missing 78 | 79 | 80 | - name: Configure CMake 81 | run: | 82 | cmake -S . -B build \ 83 | -DCMAKE_BUILD_TYPE=Release \ 84 | -DBUILD_TESTS:BOOL=ON \ 85 | -DCMAKE_CXX_COMPILER=${{ env.CLANG18_PATH }}++ \ 86 | -DCMAKE_C_COMPILER=${{ env.CLANG18_PATH }} \ 87 | -DCMAKE_INSTALL_PREFIX=install \ 88 | -DCMAKE_TOOLCHAIN_FILE=build/Release/generators/conan_toolchain.cmake \ 89 | -DTEST_WITH_WERROR:BOOL=OFF 90 | 91 | - name: Build 92 | run: cmake --build build 93 | 94 | - name: Test 95 | run: cmake --build build --target test 96 | 97 | - name: Install 98 | run: cmake --build build --target install 99 | -------------------------------------------------------------------------------- /.github/workflows/windows-msvc.yml: -------------------------------------------------------------------------------- 1 | name: windows-msvc 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths-ignore: 8 | - 'doc/**' 9 | - '**/*.md' 10 | - .travis.yml 11 | - .gitlab-ci.yml 12 | workflow_dispatch: 13 | pull_request: 14 | paths-ignore: 15 | - 'doc/**' 16 | - '**/*.md' 17 | - .travis.yml 18 | - .gitlab-ci.yml 19 | 20 | jobs: 21 | build: 22 | name: ci-windows-msvc-17 23 | runs-on: windows-latest 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v4 28 | 29 | - name: Configure Visual Studio Environment 30 | uses: ilammy/msvc-dev-cmd@v1.13.0 31 | 32 | - name: Install Ninja 33 | uses: seanmiddleditch/gha-setup-ninja@v4 34 | 35 | - name: Cache Conan packages 36 | id: cache-conan 37 | uses: actions/cache@v4.0.2 38 | env: 39 | cache-name: cache-conan-packages 40 | with: 41 | path: ~/.conan2 42 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('conanfile.txt') }} 43 | restore-keys: | 44 | ${{ runner.os }}-build-${{ env.cache-name }}- 45 | ${{ runner.os }}-build- 46 | ${{ runner.os }}- 47 | 48 | - name: Configure python 49 | uses: actions/setup-python@v5 50 | with: 51 | python-version: '3.10' 52 | cache: 'pip' 53 | 54 | - name: Install Python dependencies 55 | run: python -m pip install -r .github/requirements.txt 56 | 57 | - name: Configure Conan profile 58 | run: conan profile detect --force --name default 59 | 60 | - name: Install Conan dependencies 61 | run: | 62 | conan install conanfile.txt -r conancenter -s compiler.cppstd=17 -c tools.cmake.cmaketoolchain:generator=Ninja --build=missing 63 | 64 | - name: Configure CMake 65 | run: | 66 | cmake -S . --preset conan-release -G Ninja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_INSTALL_PREFIX=install -DBUILD_TESTS:BOOL=ON 67 | 68 | - name: Build 69 | run: cmake --build --preset conan-release 70 | 71 | - name: Test 72 | run: cmake --build --preset conan-release --target test --output-on-failure 73 | 74 | - name: Install 75 | run: cmake --build --preset conan-release --target install 76 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | *.o 3 | int 4 | build* 5 | CMakeUserPresets.json 6 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | build_and_test_gcc: 2 | script: 3 | - mkdir build 4 | - cd build 5 | - cmake .. 6 | - make 7 | - make test 8 | build_and_test_clang: 9 | script: 10 | - mkdir build 11 | - cd build 12 | - CC=clang CXX=clang++ cmake .. 13 | - make 14 | - make test 15 | 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language : cpp 2 | matrix: 3 | include: 4 | - os : linux 5 | dist: xenial 6 | compiler: clang 7 | - os : linux 8 | dist: xenial 9 | compiler: g++ 10 | - os : linux 11 | dist: bionic 12 | compiler: g++ 13 | - os : linux 14 | dist: bionic 15 | compiler: clang 16 | 17 | 18 | install: 19 | - sudo apt-get install python3 python3-pip libboost-dev libeigen3-dev 20 | - sudo pip3 install pytest pexpect 21 | 22 | # download an install a newer version of cmake 23 | - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" 24 | - mkdir ${DEPS_DIR} 25 | - cd ${DEPS_DIR} 26 | - travis_retry wget --no-check-certificate https://cmake.org/files/v3.16/cmake-3.16.9-Linux-x86_64.tar.gz 27 | - tar -xf cmake-3.16.9-Linux-x86_64.tar.gz 28 | - mv cmake-3.16.9-Linux-x86_64 cmake-install 29 | - PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH 30 | 31 | # don't forget to switch back to the main build directory once you are done 32 | - cd ${TRAVIS_BUILD_DIR} 33 | 34 | before_install: 35 | - eval "${MATRIX_EVAL}" 36 | before_script: 37 | - mkdir build 38 | - cd build 39 | - cmake .. 40 | script: 41 | - make 42 | - make test 43 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(libInterpolate) 3 | 4 | include(CMakePackageConfigHelpers) 5 | include(GNUInstallDirs) 6 | include(CMakePrintHelpers) 7 | 8 | option(BUILD_TESTS "Build unit tests" ON) 9 | 10 | set(libInterpolate_VERSION 11 | "UNKNOWN" 12 | CACHE STRING "Library version number") 13 | set(libInterpolate_VERSION $CACHE{libInterpolate_VERSION}) 14 | 15 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 16 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") 17 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 18 | 19 | if("${libInterpolate_VERSION}" STREQUAL "UNKNOWN") 20 | message(STATUS "Detecting version number using git...") 21 | include(macro-git_version) 22 | git_version(libInterpolate) 23 | message(STATUS "Version: ${libInterpolate_VERSION}") 24 | message(STATUS "Version (Full): ${libInterpolate_VERSION_FULL}") 25 | endif() 26 | 27 | find_package(Boost REQUIRED) 28 | find_package(Eigen3 3.3.7 REQUIRED) # v3.3.7 adds support for cmake targets 29 | 30 | add_library(Interpolate INTERFACE) 31 | add_library(libInterpolate::Interpolate ALIAS Interpolate) 32 | target_include_directories( 33 | Interpolate 34 | INTERFACE 35 | $ 36 | $ 37 | $) 38 | target_compile_definitions(Interpolate 39 | INTERFACE $<$:_USE_MATH_DEFINES>) 40 | target_compile_features(Interpolate INTERFACE cxx_std_17) 41 | target_sources( 42 | Interpolate 43 | INTERFACE 44 | $ 45 | $ 46 | $ 47 | $ 48 | $ 49 | $ 50 | $ 51 | $ 52 | $ 53 | $ 54 | $ 55 | $ 56 | $ 57 | $ 58 | $ 59 | $ 60 | ) 61 | 62 | target_link_libraries(Interpolate INTERFACE Boost::boost Eigen3::Eigen) 63 | 64 | if(${BUILD_TESTS}) 65 | enable_testing() 66 | add_subdirectory(testing) 67 | endif() 68 | 69 | install( 70 | TARGETS Interpolate 71 | EXPORT libInterpolateTargets 72 | LIBRARY DESTINATION lib 73 | ARCHIVE DESTINATION lib 74 | RUNTIME DESTINATION bin 75 | INCLUDES 76 | DESTINATION include) 77 | install( 78 | DIRECTORY src/ 79 | DESTINATION include 80 | FILES_MATCHING 81 | PATTERN "*.hpp" 82 | PATTERN "*.h") 83 | install( 84 | DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ 85 | DESTINATION include 86 | FILES_MATCHING 87 | PATTERN "*.hpp" 88 | PATTERN "*.h") 89 | install( 90 | EXPORT libInterpolateTargets 91 | FILE libInterpolateTargets.cmake 92 | NAMESPACE libInterpolate:: 93 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libInterpolate) 94 | file( 95 | WRITE ${CMAKE_CURRENT_BINARY_DIR}/libInterpolateConfig.cmake 96 | "include(CMakeFindDependencyMacro) 97 | find_dependency(Boost) 98 | find_dependency(Eigen3 3.3.7 REQUIRED) 99 | include(\${CMAKE_CURRENT_LIST_DIR}/libInterpolateTargets.cmake) 100 | ") 101 | write_basic_package_version_file( 102 | ${CMAKE_CURRENT_BINARY_DIR}/libInterpolateConfigVersion.cmake 103 | VERSION ${libInterpolate_VERSION} 104 | COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) 105 | install( 106 | FILES ${CMAKE_CURRENT_BINARY_DIR}/libInterpolateConfig.cmake 107 | ${CMAKE_CURRENT_BINARY_DIR}/libInterpolateConfigVersion.cmake 108 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libInterpolate) 109 | 110 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY 111 | "A C++ library for numerical interpolation.") 112 | set(CPACK_PACKAGE_VENDOR "C.D. Clark III") 113 | set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") 114 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md") 115 | if(libInterpolate_VERSION_MAJOR) 116 | set(CPACK_PACKAGE_VERSION_MAJOR ${libInterpolate_VERSION_MAJOR}) 117 | endif() 118 | if(libInterpolate_VERSION_MINOR) 119 | set(CPACK_PACKAGE_VERSION_MINOR ${libInterpolate_VERSION_MINOR}) 120 | endif() 121 | if(libInterpolate_VERSION_PATCH) 122 | set(CPACK_PACKAGE_VERSION_PATCH ${libInterpolate_VERSION_PATCH}) 123 | endif() 124 | include(CPack) 125 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 C.D. Clark III 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /applications/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.1 ) 2 | 3 | project( libInterpolate-cli ) 4 | 5 | find_package( Boost REQUIRED COMPONENTS program_options ) 6 | 7 | add_executable( interp-cli interp-cli.cpp ) 8 | target_link_libraries( interp-cli Interpolate Boost::program_options ) 9 | set_property( TARGET interp-cli PROPERTY CXX_STANDARD 11 ) 10 | 11 | add_subdirectory( .. libInterpolate ) 12 | configure_file( ../testing/CramTests/interp-cli.t ${CMAKE_CURRENT_BINARY_DIR}/interp-cli.t COPYONLY ) 13 | -------------------------------------------------------------------------------- /applications/conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | boost/1.85.0 3 | eigen/3.4.0 4 | 5 | [generators] 6 | CMakeDeps 7 | CMakeToolchain 8 | 9 | [layout] 10 | cmake_layout 11 | -------------------------------------------------------------------------------- /applications/interp-cli.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | namespace po = boost::program_options; 15 | 16 | void print_usage(char prog_name[]) { 17 | cout << "usage: " << prog_name 18 | << " [OPTIONS] interpolation-data-file x-values-file output-file" 19 | << "\n"; 20 | } 21 | 22 | void print_documentation() { 23 | cout << "Reads x-y pairs from a file and interpolates to x values listed " 24 | "in another file.\n" 25 | << "\n" 26 | << "The interpoalted data (data that is interpolated from) is " 27 | "contained in a gnuplot-style text file,\n" 28 | << "with each x-y pair on a new line, separated by white space.\n" 29 | << "The x points to interpoalte to are contained in plain text file, " 30 | "with each value on a new line.\n" 31 | << "\n" 32 | << "Notes:\n" 33 | << "\tthe x values to be interpolated to can also be stored in a " 34 | "gnuplot-style text file. If the file\n" 35 | << "\tcontaines more than one column, only the first will be used.\n" 36 | << "\n"; 37 | } 38 | 39 | _1D::AnyInterpolator create(std::string type) { 40 | if (type == "linear") return _1D::LinearInterpolator(); 41 | 42 | if (type == "spline") return _1D::CubicSplineInterpolator(); 43 | 44 | if (type == "monotonic") return _1D::MonotonicInterpolator(); 45 | 46 | throw std::runtime_error("1D Interpolator type was not recognized: '" + 47 | type + "'"); 48 | } 49 | 50 | _2D::AnyInterpolator create2d(std::string type) { 51 | if (type == "linear") return _2D::BilinearInterpolator(); 52 | 53 | if (type == "spline") return _2D::BicubicInterpolator(); 54 | 55 | if (type == "linear-triangle") 56 | return _2D::LinearDelaunayTriangleInterpolator(); 57 | 58 | throw std::runtime_error("2D Interpolator type was not recognized: '" + 59 | type + "'"); 60 | } 61 | 62 | int main(int argc, char* argv[]) { 63 | po::options_description args("Arguments"); 64 | args.add_options()("interp-data", 65 | "file containing data to be interpolated from.")( 66 | "x-values", "file containing x values to interpolate to.")( 67 | "output-file", "file to write interpolated data to."); 68 | 69 | po::options_description opts("Options"); 70 | opts.add_options()("help,h", "print help message")( 71 | "batch,b", "output in 'batch' mode")( 72 | "method,m", po::value()->default_value("spline"), 73 | "interpolation method.")("dimensions,d", 74 | po::value()->default_value(1), 75 | "dimensions of interpolated data '1' or '2'.")( 76 | "list,l", "list available interpolation methods.")( 77 | "precision,p", po::value(), 78 | "precision to use when writing output."); 79 | 80 | po::options_description opts_and_args("All Options"); 81 | opts_and_args.add(opts).add(args); 82 | 83 | po::positional_options_description pos_args; 84 | pos_args.add("interp-data", 1); 85 | pos_args.add("x-values", 1); 86 | pos_args.add("output-file", 1); 87 | 88 | po::variables_map vm; 89 | po::parsed_options parsed = po::command_line_parser(argc, argv) 90 | .options(opts_and_args) 91 | .positional(pos_args) 92 | .allow_unregistered() 93 | .run(); 94 | po::store(parsed, vm); 95 | po::notify(vm); 96 | 97 | if (argc == 1 || vm.count("help")) { 98 | print_usage(argv[0]); 99 | cout << "\n"; 100 | cout << opts << "\n"; 101 | cout << "\n"; 102 | print_documentation(); 103 | cout << "\n"; 104 | return 1; 105 | } 106 | 107 | if (vm.count("list")) { 108 | cout << "\t1D Methods\n"; 109 | cout << "\t\tlinear\n"; 110 | cout << "\t\tspline\n"; 111 | cout << "\t\tmonotonic\n"; 112 | cout << "\t2D Methods\n"; 113 | cout << "\t\tlinear\n"; 114 | cout << "\t\tspline\n"; 115 | cout << "\t\tlinear-triangle\n"; 116 | return 1; 117 | } 118 | 119 | ifstream in; 120 | if (vm["dimensions"].as() == 1) { 121 | double *x, *y; 122 | int n; 123 | 124 | // load data 125 | in.open(vm["interp-data"].as().c_str()); 126 | Utils::ReadFunction(in, x, y, n); 127 | in.close(); 128 | 129 | _1D::AnyInterpolator interp = create(vm["method"].as()); 130 | interp.setData(n, x, y); 131 | delete[] x; 132 | delete[] y; 133 | 134 | // load x values 135 | in.open(vm["x-values"].as().c_str()); 136 | Utils::ReadFunction( 137 | in, x, y, n, 1, 138 | 0); // multiplicity 0, only 1 column with coordinates. 139 | // need to delete y 140 | // and reallocate to the size of x. 141 | // since the multplicity was zero, ReadFunction will have called new 142 | // with 0 143 | delete[] y; 144 | y = new double[n]; 145 | in.close(); 146 | 147 | for (int i = 0; i < n; i++) y[i] = interp(x[i]); 148 | 149 | // write interpolated data 150 | ofstream out; 151 | if (vm.count("precision")) { 152 | out.precision(vm["precision"].as()); 153 | } 154 | out.open(vm["output-file"].as().c_str()); 155 | for (int i = 0; i < n; i++) out << x[i] << " " << y[i] << "\n"; 156 | out.close(); 157 | 158 | delete[] x; 159 | delete[] y; 160 | } 161 | if (vm["dimensions"].as() == 2) { 162 | double *x, *y, *z; 163 | int n; 164 | int* nn; 165 | 166 | // load data 167 | in.open(vm["interp-data"].as().c_str()); 168 | Utils::ReadFunction(in, x, z, nn, 2, 1); 169 | in.close(); 170 | 171 | y = new double[2 * nn[0]]; 172 | 173 | boost::copy(boost::make_iterator_range(x, x + 2 * nn[0]) | 174 | boost::adaptors::strided(2), 175 | y); 176 | boost::copy(boost::make_iterator_range(x + 1, x + 2 * nn[0]) | 177 | boost::adaptors::strided(2), 178 | y + nn[0]); 179 | 180 | _2D::AnyInterpolator interp = 181 | create2d(vm["method"].as()); 182 | interp.setData(nn[0], y, y + nn[0], z); 183 | delete[] x; 184 | delete[] y; 185 | delete[] z; 186 | 187 | // load x values 188 | in.open(vm["x-values"].as().c_str()); 189 | Utils::ReadFunction(in, x, y, n); 190 | in.close(); 191 | 192 | z = new double[n]; 193 | 194 | for (int i = 0; i < n; i++) z[i] = interp(x[i], y[i]); 195 | 196 | // write interpolated data 197 | ofstream out; 198 | if (vm.count("precision")) { 199 | out.precision(vm["precision"].as()); 200 | } 201 | out.open(vm["output-file"].as().c_str()); 202 | for (int i = 0; i < n; i++) 203 | out << x[i] << " " << y[i] << " " << z[i] << "\n"; 204 | out.close(); 205 | 206 | delete[] x; 207 | delete[] y; 208 | delete[] z; 209 | } 210 | 211 | return 0; 212 | } 213 | -------------------------------------------------------------------------------- /cmake/Modules/macro-find_project_dependency.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Searches for a project dependency. 3 | # 4 | # This mocro tries to find an install or include directotry to satisfy a 5 | # project dependency. It uses find_package internally to detect installs. 6 | # 7 | # The locations that will be searched are determined my arguments to the macro 8 | # 9 | # - OVERRIDE_PATHS : list of directories that will be searched for sub-directories to include. these directories are searched first. if the 10 | # dependency is found here, it will be used. 11 | # - PATHS : list of directories that will be searched for installs, in addition to the normal system directories. the find_package command is used to detect the install. 12 | # - SUBDIRECTORY_PATHS : list of directories that will be searched for sub-directories to include if no override or installs are detected. 13 | # 14 | # Any additional arguments that are given to the macro will be passed directly to the find_package macro. 15 | # 16 | macro( find_project_dependency DEPENDENCY ) 17 | message(STATUS "Searching for dependency: ${DEPENDENCY}") 18 | 19 | # parse arguments 20 | # any extra arguments passed by the caller will be put in find_project_dependency_UNPARSED_ARGUMENTS 21 | # ALL unparsed arguments are passed on directly to find_package 22 | cmake_parse_arguments( find_project_dependency 23 | "REQUIRED" 24 | "" 25 | "PATHS;SUBDIRECTORY_PATHS;OVERRIDE_PATHS" 26 | ${ARGN} ) 27 | # assume the dependency was not found 28 | set( ${DEPENDENCY}_FOUND 0 ) 29 | 30 | # if the dependency wasn't found 31 | if( NOT ${${DEPENDENCY}_FOUND} ) 32 | if( find_project_dependency_OVERRIDE_PATHS ) 33 | message(STATUS "Checking for overrides for ${DEPENDENCY}.") 34 | find_and_add_subdirectory(${DEPENDENCY} "${find_project_dependency_OVERRIDE_PATHS}") 35 | endif() 36 | endif() 37 | 38 | # search for the dependency 39 | # look in the directories given by PATHS first, if they were given 40 | if( NOT ${${DEPENDENCY}_FOUND} ) 41 | if( find_project_dependency_PATHS ) 42 | find_package( ${DEPENDENCY} QUIET ${find_project_dependency_UNPARSED_ARGS} PATHS ${find_project_dependency_PATHS} ) 43 | endif() 44 | endif() 45 | 46 | # look in the system directories if dependency wasn't found 47 | if( NOT ${${DEPENDENCY}_FOUND} ) 48 | find_package( ${DEPENDENCY} QUIET ${find_project_dependency_UNPARSED_ARGS} ) 49 | endif() 50 | 51 | # if the dependency wasn't found 52 | if( NOT ${${DEPENDENCY}_FOUND} ) 53 | message(STATUS "Could not find install for ${DEPENDENCY}. Checking for directory to include.") 54 | # look for a subdirectory to include 55 | find_and_add_subdirectory(${DEPENDENCY} "${find_project_dependency_SUBDIRECTORY_PATHS}") 56 | endif() 57 | 58 | # if the dependency wasn't found 59 | if( NOT ${${DEPENDENCY}_FOUND} ) 60 | # and REQUIRED was given 61 | if( find_project_dependency_REQUIRED ) 62 | # throw an error 63 | message(FATAL_ERROR "Could not find required dependency: ${DEPENDENCY}") 64 | endif() 65 | endif() 66 | 67 | endmacro(find_project_dependency) 68 | 69 | macro(find_and_add_subdirectory DEPENDENCY SUBDIRECTORY_PATHS ) 70 | foreach(SUBDIR ${SUBDIRECTORY_PATHS}) 71 | if(EXISTS ${SUBDIR}/${DEPENDENCY}/CMakeLists.txt) 72 | message(STATUS "Found ${DEPENDENCY} in ${SUBDIR} directory to include.") 73 | add_subdirectory( ${SUBDIR}/${DEPENDENCY} ) 74 | set( ${DEPENDENCY}_FOUND 1 ) 75 | break() 76 | endif() 77 | endforeach() 78 | endmacro(find_and_add_subdirectory) 79 | -------------------------------------------------------------------------------- /cmake/Modules/macro-git_version.cmake: -------------------------------------------------------------------------------- 1 | # A function 2 | function( GIT_VERSION VAR_PREFIX) 3 | 4 | set( GIT_INFO ID AUTHOR DATE BRANCH DESC ) 5 | 6 | set( GIT_COMMIT_ID_DEFAULT "UNKNOWN" ) 7 | set( GIT_COMMIT_AUTHOR_DEFAULT "UNKNOWN" ) 8 | set( GIT_COMMIT_DATE_DEFAULT "UNKNOWN" ) 9 | set( GIT_COMMIT_BRANCH_DEFAULT "UNKNOWN" ) 10 | set( GIT_COMMIT_DESC_DEFAULT "None" ) 11 | 12 | # we need git of course... 13 | find_package( Git ) 14 | if( GIT_FOUND ) 15 | # make sure that this is actually a git repo 16 | execute_process( COMMAND ${GIT_EXECUTABLE} status 17 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 18 | RESULT_VARIABLE IsGitRepo 19 | OUTPUT_VARIABLE OutputTrash 20 | ERROR_VARIABLE ErrorTrash) 21 | else() 22 | message( FATAL_ERROR "Could not find `git` command, cannot determine version number. Please set the `${VAR_PREFIX}_VERSION` cache variable." ) 23 | endif() 24 | 25 | if( ${IsGitRepo} EQUAL 0 ) 26 | if( "${GIT_COMMIT_ID}" STREQUAL "" ) 27 | execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --sq HEAD 28 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 29 | OUTPUT_VARIABLE GIT_COMMIT_ID 30 | ERROR_VARIABLE Trash) 31 | endif() 32 | if( "${GIT_COMMIT_AUTHOR}" STREQUAL "" ) 33 | execute_process( COMMAND ${GIT_EXECUTABLE} log -n1 --pretty="%an" HEAD 34 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 35 | OUTPUT_VARIABLE GIT_COMMIT_AUTHOR 36 | ERROR_VARIABLE Trash) 37 | endif() 38 | if( "${GIT_COMMIT_DATE}" STREQUAL "" ) 39 | execute_process( COMMAND ${GIT_EXECUTABLE} log -n1 --pretty="%aD" HEAD 40 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 41 | OUTPUT_VARIABLE GIT_COMMIT_DATE 42 | ERROR_VARIABLE Trash) 43 | endif() 44 | if( "${GIT_COMMIT_BRANCH}" STREQUAL "" ) 45 | execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD 46 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 47 | OUTPUT_VARIABLE GIT_COMMIT_BRANCH 48 | ERROR_VARIABLE Trash) 49 | endif() 50 | if( "${GIT_COMMIT_DESC}" STREQUAL "" ) 51 | execute_process( COMMAND ${GIT_EXECUTABLE} describe --tags HEAD 52 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 53 | OUTPUT_VARIABLE GIT_COMMIT_DESC 54 | ERROR_VARIABLE Trash) 55 | endif() 56 | else() 57 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/version.txt") 58 | message( WARNING "Source directory is not a git repo, but 'version.txt' was found. Using version number there." ) 59 | if( "${GIT_COMMIT_ID}" STREQUAL "" ) 60 | set( GIT_COMMIT_ID "UNKNOWN" ) 61 | endif() 62 | if( "${GIT_COMMIT_AUTHOR}" STREQUAL "" ) 63 | set( GIT_COMMIT_AUTHOR "UNKNOWN" ) 64 | endif() 65 | if( "${GIT_COMMIT_DATE}" STREQUAL "" ) 66 | set( GIT_COMMIT_DATE "UNKNOWN" ) 67 | endif() 68 | if( "${GIT_COMMIT_BRANCH}" STREQUAL "" ) 69 | set( GIT_COMMIT_BRANCH "UNKNOWN" ) 70 | endif() 71 | if( "${GIT_COMMIT_DESC}" STREQUAL "" ) 72 | file( READ "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" GIT_COMMIT_DESC ) 73 | endif() 74 | else() 75 | message( FATAL_ERROR "Source directory is not a git repo." ) 76 | endif() 77 | endif() 78 | 79 | # set defaults for any items that were not found 80 | foreach( item ${GIT_INFO} ) 81 | if( "${GIT_COMMIT_${item}}" STREQUAL "" ) 82 | set( GIT_COMMIT_${item} ${GIT_COMMIT_${item}_DEFAULT} ) 83 | endif() 84 | endforeach( item ) 85 | 86 | # remove quotes, backslashes, and new lines 87 | # these cause problems when trying to embed version numbers into source files. 88 | foreach( item ${GIT_INFO} ) 89 | string( REPLACE "'" "" GIT_COMMIT_${item} ${GIT_COMMIT_${item}} ) 90 | string( REPLACE "\"" "" GIT_COMMIT_${item} ${GIT_COMMIT_${item}} ) 91 | string( REPLACE "\n" "" GIT_COMMIT_${item} ${GIT_COMMIT_${item}} ) 92 | endforeach( item ) 93 | 94 | # set full version string 95 | set(VERSION_FULL "${GIT_COMMIT_DESC}-${GIT_COMMIT_BRANCH}" ) 96 | 97 | # look for major, minor, and patch numbers in the version string 98 | # this is required if the developer uses CPack for example. 99 | # need to consider two possible formats: 100 | # Major.Minor.Patch 101 | # or 102 | # Major.Minor-PatchStr 103 | # the first format is the standard format used for version numbers, 104 | # but would have to be set by the developer as a tag name. 105 | # however, if the developer just sets a major and minor version with 106 | # a tag, then git will add the number of commits since the tag. for example 107 | # 0.1-10-devel 108 | # indicates that this is the 10th commit on the devel branch after 0.1 patch. 109 | 110 | set( TMP ${VERSION_FULL} ) 111 | 112 | # first number in version string will be the major version 113 | # major number may be followed by a . or - 114 | if( ${TMP} MATCHES "^v*([0-9]+)[\\.\\-]" ) 115 | set( VERSION_MAJOR ${CMAKE_MATCH_1} ) 116 | else() 117 | set( VERSION_MAJOR "X" ) 118 | endif() 119 | # strip off the major number 120 | string( REGEX REPLACE "^v*${VERSION_MAJOR}" "" TMP "${TMP}" ) 121 | 122 | # minor number will only be preceeded by a . 123 | # but may be followed by a . or - 124 | if( ${TMP} MATCHES "^[\\.]([0-9]+)[\\.\\-]" ) 125 | set( VERSION_MINOR ${CMAKE_MATCH_1} ) 126 | else() 127 | set( VERSION_MINOR "X" ) 128 | endif() 129 | # strip off the minor number 130 | string( REGEX REPLACE "^[\\.]${VERSION_MINOR}" "" TMP ${TMP} ) 131 | 132 | # patch may be preceeded by a . or -, but must be a number 133 | if( ${TMP} MATCHES "^[\\.\\-]([0-9]+)" ) 134 | set( VERSION_PATCH ${CMAKE_MATCH_1} ) 135 | else() 136 | set( VERSION_PATCH "X" ) 137 | endif() 138 | 139 | # build cmake-compatible version string 140 | set(VERSION "${VERSION_MAJOR}") 141 | if( NOT "${VERSION_MINOR}" STREQUAL "X" ) 142 | set(VERSION "${VERSION}.${VERSION_MINOR}") 143 | if( NOT "${VERSION_PATCH}" STREQUAL "X" ) 144 | set(VERSION "${VERSION}.${VERSION_PATCH}") 145 | endif() 146 | else() 147 | if( NOT "${VERSION_PATCH}" STREQUAL "X" ) 148 | set(VERSION "${VERSION}-${VERSION_PATCH}") 149 | endif() 150 | endif() 151 | 152 | # now set version information in the parent scope 153 | set( ${VAR_PREFIX}_VERSION_FULL ${VERSION_FULL} PARENT_SCOPE ) 154 | set( ${VAR_PREFIX}_VERSION ${VERSION} PARENT_SCOPE ) 155 | set( ${VAR_PREFIX}_VERSION_MAJOR ${VERSION_MAJOR} PARENT_SCOPE ) 156 | set( ${VAR_PREFIX}_VERSION_MINOR ${VERSION_MINOR} PARENT_SCOPE ) 157 | set( ${VAR_PREFIX}_VERSION_PATCH ${VERSION_PATCH} PARENT_SCOPE ) 158 | 159 | endfunction(GIT_VERSION) 160 | 161 | -------------------------------------------------------------------------------- /conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | boost/1.85.0 3 | eigen/3.4.0 4 | 5 | [test_requires] 6 | catch2/3.6.0 7 | gsl/2.7.1 8 | 9 | [generators] 10 | CMakeDeps 11 | CMakeToolchain 12 | 13 | [options] 14 | boost/*:header_only=True 15 | 16 | [layout] 17 | cmake_layout 18 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 2.8 ) 2 | 3 | # DOXYGEN 4 | find_package(Doxygen) 5 | 6 | # build the doxygen-based documentation 7 | if(DOXYGEN_FOUND) 8 | 9 | # look for doxygen config file 10 | file( GLOB_RECURSE DOXYGEN_CONFIG 11 | RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 12 | "*.doxygen" ) 13 | if( "${DOXYGEN_CONFIG}" STREQUAL "" ) 14 | set( DOXYGEN_CONFIG "${PROJECT_NAME}.doxygen" ) 15 | message(STATUS "Did not find Doxygen configuration file.") 16 | message(STATUS " Creating template named ${DOXYGEN_CONFIG}.template") 17 | message(STATUS " Please rename the template file to ${DOXYGEN_CONFIG} and edit it for your needs.") 18 | message(WARNING " ${DOXYGEN_CONFIG}.template will be OVERWRITTEN on the next run.") 19 | exec_program( ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} 20 | ARGS -g ${DOXYGEN_CONFIG} ) 21 | else() 22 | message(STATUS "Found Doxygen configuration file: ${DOXYGEN_CONFIG}") 23 | endif() 24 | 25 | 26 | add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${DOXYGEN_CONFIG} 27 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 28 | COMMENT "Generating API documentation with Doxygen" VERBATIM) 29 | endif() 30 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | ../README.md: README.md.t 2 | expand-macros.py $< $@ 3 | 4 | -------------------------------------------------------------------------------- /doc/figures/dalaunay-triangle-method/data.txt: -------------------------------------------------------------------------------- 1 | 0 0 0 2 | 0 1 0 3 | 1 0 0 4 | 1 1 0 5 | 0.5 0.5 1 6 | -------------------------------------------------------------------------------- /doc/figures/dalaunay-triangle-method/example.gp: -------------------------------------------------------------------------------- 1 | set xlabel "x" 2 | set ylabel "y" 3 | set zlabel "z" 4 | 5 | set term qt 6 | splot 'data.txt' title "Data" lw 6, 'out.txt' title "Interpolation" 7 | set term png 8 | set output "example.png" 9 | rep 10 | set term qt 11 | -------------------------------------------------------------------------------- /doc/figures/dalaunay-triangle-method/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CD3/libInterpolate/4305bd6c60a706bc4028673bf2cee3e967810ea8/doc/figures/dalaunay-triangle-method/example.png -------------------------------------------------------------------------------- /doc/figures/dalaunay-triangle-method/preview.log: -------------------------------------------------------------------------------- 1 | sexpect -sock preview-gnuplot.sock spawn gnuplot 2 | zenity --info --no-markup --text="Click 'OK' when you are done to close the preview." 3 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 4 | sexpect -sock preview-gnuplot.sock expect 5 | 6 | G N U P L O T 7 | Version 5.2 patchlevel 8 last modified 2019-12-01 8 | 9 | Copyright (C) 1986-1993, 1998, 2004, 2007-2019 10 | Thomas Williams, Colin Kelley and many others 11 | 12 | gnuplot home: http://www.gnuplot.info 13 | faq, bugs, etc: type "help FAQ" 14 | immediate help: type "help" (plot window: hit 'h') 15 | 16 | Terminal type is now 'qt' 17 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 18 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 19 | sexpect -sock preview-gnuplot.sock expect 20 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 21 | gnuplot> sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 22 | sexpect -sock preview-gnuplot.sock expect 23 | load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 24 | gnuplot> sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 25 | sexpect -sock preview-gnuplot.sock expect 26 | load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 27 | gnuplot> sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 28 | sexpect -sock preview-gnuplot.sock expect 29 | load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 30 | gnuplot> sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 31 | sexpect -sock preview-gnuplot.sock expect 32 | load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 33 | gnuplot> sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 34 | sexpect -sock preview-gnuplot.sock expect 35 | load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 36 | sexpect -sock preview-gnuplot.sock send 'exit' -cr 37 | sexpect -sock preview-gnuplot.sock wait 38 | gnuplot> 39 | gnuplot> 40 | gnuplot> exit 41 | sexpect -sock preview-gnuplot.sock spawn gnuplot 42 | zenity --info --no-markup --text="Click 'OK' when you are done to close the preview." 43 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 44 | sexpect -sock preview-gnuplot.sock expect 45 | 46 | G N U P L O T 47 | Version 5.2 patchlevel 8 last modified 2019-12-01 48 | 49 | Copyright (C) 1986-1993, 1998, 2004, 2007-2019 50 | Thomas Williams, Colin Kelley and many others 51 | 52 | gnuplot home: http://www.gnuplot.info 53 | faq, bugs, etc: type "help FAQ" 54 | immediate help: type "help" (plot window: hit 'h') 55 | 56 | Terminal type is now 'qt' 57 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 58 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 59 | sexpect -sock preview-gnuplot.sock expect 60 | gnuplot> 61 | gnuplot> 62 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 63 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 64 | sexpect -sock preview-gnuplot.sock expect 65 | gnuplot> Closing example.png 66 | 67 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 68 | sexpect -sock preview-gnuplot.sock send 'load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp"' -cr 69 | sexpect -sock preview-gnuplot.sock expect 70 | gnuplot> 71 | gnuplot> 72 | gnuplot> load "/home/cclark/Code/sync/projects/libInterpolate/doc/figures/dalaunay-triangle-method/example.gp" 73 | sexpect -sock preview-gnuplot.sock send 'exit' -cr 74 | sexpect -sock preview-gnuplot.sock wait 75 | gnuplot> 76 | gnuplot> 77 | gnuplot> exit 78 | -------------------------------------------------------------------------------- /externals/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | list: 2 | just --list 3 | 4 | install-deps: 5 | conan install . -s build_type=Debug --build missing 6 | conan install . -s build_type=Release --build missing 7 | 8 | configure: install-deps 9 | cmake --preset conan-default 10 | 11 | build: configure 12 | cmake --build build --config Debug 13 | cmake --build build --config Release 14 | 15 | test: build 16 | cd build && testing/Debug/libInterpolate_CatchTests 17 | cd build && testing/Release/libInterpolate_CatchTests 18 | 19 | install-deps-app: 20 | conan install applications -s build_type=Debug --build missing 21 | conan install applications -s build_type=Release --build missing 22 | 23 | configure-app: install-deps-app 24 | cmake applications --preset conan-default -DBUILD_TESTS=OFF 25 | 26 | build-app: configure-app 27 | cmake --build applications/build --config Release 28 | 29 | format: 30 | fd . src --type f --exec clang-format -i 31 | 32 | clean: 33 | rm -rf build CMakeUserPresets.json applications/build applications/CMakeUserPresets.json 34 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | version.h 2 | -------------------------------------------------------------------------------- /src/libInterpolate/AnyInterpolator.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef AnyInterpolator_hpp 3 | #define AnyInterpolator_hpp 4 | 5 | /** @file AnyInterpolator.hpp 6 | * @brief 7 | * @author C.D. Clark III 8 | * @date 01/18/19 9 | */ 10 | 11 | #include "./Interpolators/_1D/AnyInterpolator.hpp" 12 | #include "./Interpolators/_2D/AnyInterpolator.hpp" 13 | 14 | #endif // include protector 15 | -------------------------------------------------------------------------------- /src/libInterpolate/Interpolate.hpp: -------------------------------------------------------------------------------- 1 | #include "./Interpolators/_1D/CubicSplineInterpolator.hpp" 2 | #include "./Interpolators/_1D/LinearInterpolator.hpp" 3 | #include "./Interpolators/_1D/MonotonicInterpolator.hpp" 4 | #include "./Interpolators/_2D/BicubicInterpolator.hpp" 5 | #include "./Interpolators/_2D/BilinearInterpolator.hpp" 6 | #include "./Interpolators/_2D/LinearDelaunayTriangleInterpolator.hpp" 7 | #include "./Interpolators/_2D/NearestNeighborInterpolator.hpp" 8 | #include "./Interpolators/_2D/ThinPlateSplineInterpolator.hpp" 9 | -------------------------------------------------------------------------------- /src/libInterpolate/Interpolators/_1D/AnyInterpolator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef Interpolators__1D_AnyInterpolator_hpp 2 | #define Interpolators__1D_AnyInterpolator_hpp 3 | 4 | /** @file AnyInterpolator.hpp 5 | * @brief 6 | * @author C.D. Clark III 7 | * @date 01/17/19 8 | */ 9 | 10 | #include "../../Utils/Concepts.hpp" 11 | 12 | namespace _1D { 13 | 14 | template 15 | using AnyInterpolator = boost::type_erasure::any< 16 | boost::mpl::vector, 17 | is_interpolator, boost::type_erasure::relaxed>, 18 | boost::type_erasure::_self>; 19 | 20 | } 21 | 22 | #endif // include protector 23 | -------------------------------------------------------------------------------- /src/libInterpolate/Interpolators/_1D/InterpolatorBase.hpp: -------------------------------------------------------------------------------- 1 | #ifndef Interpolators__1D_InterpolatorBase_hpp 2 | #define Interpolators__1D_InterpolatorBase_hpp 3 | 4 | /** @file InterpolatorBase.hpp 5 | * @brief 6 | * @author C.D. Clark III 7 | * @date 12/24/16 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace _1D { 18 | 19 | /** @class 20 | * @brief A base class that provides some useful functions for interpolating 21 | * data. 22 | * @author C.D. Clark III 23 | * 24 | * This class provides eigen matrices to store the data that is interpolated, a 25 | * few setData methods to populate the data. 26 | */ 27 | 28 | template 29 | struct RealTypeOf {}; 30 | template