From 933fbf45032cb0233ed03e6c6bcb88a0ffdfee11 Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 24 Apr 2024 12:07:51 +0200 Subject: [PATCH] setup --- advection/src/CMakeLists.txt | 11 ++++++----- advection/src/UVGrid.h | 6 +++--- advection/src/Vel.h | 6 +++--- advection/src/interpolate.cpp | 6 +++--- advection/src/interpolate.h | 10 +++++----- advection/src/main.cpp | 2 +- advection/src/readdata.h | 6 +++--- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/advection/src/CMakeLists.txt b/advection/src/CMakeLists.txt index 9428e41..79e2a61 100644 --- a/advection/src/CMakeLists.txt +++ b/advection/src/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.28) -project (LinearInterpolate) +project (Advection) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -8,7 +8,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(netCDF REQUIRED) -add_executable(LinearInterpolate main.cpp +add_executable(Advection main.cpp readdata.cpp readdata.h interpolate.cpp @@ -16,7 +16,8 @@ add_executable(LinearInterpolate main.cpp UVGrid.cpp UVGrid.h Vel.h - Vel.cpp) + Vel.cpp +) execute_process( COMMAND nc-config --includedir @@ -30,7 +31,7 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) -target_include_directories(LinearInterpolate PUBLIC ${netCDF_INCLUDE_DIR}) +target_include_directories(Advection PUBLIC ${netCDF_INCLUDE_DIR}) find_library(NETCDF_LIB NAMES netcdf-cxx4 netcdf_c++4 PATHS ${NETCDFCXX_LIB_DIR} NO_DEFAULT_PATH) -target_link_libraries(LinearInterpolate ${NETCDF_LIB}) +target_link_libraries(Advection ${NETCDF_LIB}) diff --git a/advection/src/UVGrid.h b/advection/src/UVGrid.h index 6c3f8f6..229f5ca 100644 --- a/advection/src/UVGrid.h +++ b/advection/src/UVGrid.h @@ -1,5 +1,5 @@ -#ifndef LINEARINTERPOLATE_UVGRID_H -#define LINEARINTERPOLATE_UVGRID_H +#ifndef ADVECTION_UVGRID_H +#define ADVECTION_UVGRID_H #include #include "Vel.h" @@ -48,4 +48,4 @@ public: void streamSlice(std::ostream &os, size_t t); }; -#endif //LINEARINTERPOLATE_UVGRID_H +#endif //ADVECTION_UVGRID_H diff --git a/advection/src/Vel.h b/advection/src/Vel.h index ec7ce52..74d62cd 100644 --- a/advection/src/Vel.h +++ b/advection/src/Vel.h @@ -1,5 +1,5 @@ -#ifndef LINEARINTERPOLATE_VEL_H -#define LINEARINTERPOLATE_VEL_H +#ifndef ADVECTION_VEL_H +#define ADVECTION_VEL_H #include #include @@ -41,4 +41,4 @@ Vel operator*(Scalar scalar, const Vel& p) { return Vel(p.u * scalar, p.v * scalar); } -#endif //LINEARINTERPOLATE_VEL_H +#endif //ADVECTION_VEL_H diff --git a/advection/src/interpolate.cpp b/advection/src/interpolate.cpp index 98fe42d..92b8ac1 100644 --- a/advection/src/interpolate.cpp +++ b/advection/src/interpolate.cpp @@ -2,7 +2,7 @@ using namespace std; -Vel bilinearInterpolate(const UVGrid &uvGrid, int time, double lat, double lon) { +Vel biadvection(const UVGrid &uvGrid, int time, double lat, double lon) { double latStep = uvGrid.latStep(); double lonStep = uvGrid.lonStep(); int timeStep = uvGrid.timeStep(); @@ -36,11 +36,11 @@ Vel bilinearInterpolate(const UVGrid &uvGrid, int time, double lat, double lon) return point; } -vector bilinearInterpolate(const UVGrid &uvGrid, vector> points) { +vector biadvection(const UVGrid &uvGrid, vector> points) { vector result; result.reserve(points.size()); for (auto [time, lat, lon]: points) { - result.push_back(bilinearInterpolate(uvGrid, time, lat, lon)); + result.push_back(biadvection(uvGrid, time, lat, lon)); } return result; diff --git a/advection/src/interpolate.h b/advection/src/interpolate.h index 68b58f7..8cda2c3 100644 --- a/advection/src/interpolate.h +++ b/advection/src/interpolate.h @@ -1,5 +1,5 @@ -#ifndef LINEARINTERPOLATE_INTERPOLATE_H -#define LINEARINTERPOLATE_INTERPOLATE_H +#ifndef ADVECTION_INTERPOLATE_H +#define ADVECTION_INTERPOLATE_H #include @@ -15,7 +15,7 @@ * @param lon longitude of point * @return interpolated velocity */ -Vel bilinearInterpolate(const UVGrid &uvGrid, int time, double lat, double lon); +Vel biadvection(const UVGrid &uvGrid, int time, double lat, double lon); /** * Helper function for bilnearly interpolating a vector of points @@ -23,6 +23,6 @@ Vel bilinearInterpolate(const UVGrid &uvGrid, int time, double lat, double lon); * @param points vector of points * @return interpolated velocities */ -std::vector bilinearInterpolate(const UVGrid &uvGrid, std::vector> points); +std::vector biadvection(const UVGrid &uvGrid, std::vector> points); -#endif //LINEARINTERPOLATE_INTERPOLATE_H +#endif //ADVECTION_INTERPOLATE_H diff --git a/advection/src/main.cpp b/advection/src/main.cpp index 77f68ff..258f056 100644 --- a/advection/src/main.cpp +++ b/advection/src/main.cpp @@ -32,7 +32,7 @@ int main() { auto start = chrono::high_resolution_clock::now(); - auto x = bilinearInterpolate(uvGrid, points); + auto x = biadvection(uvGrid, points); auto stop = chrono::high_resolution_clock::now(); diff --git a/advection/src/readdata.h b/advection/src/readdata.h index 6e4c2c9..56a3fee 100644 --- a/advection/src/readdata.h +++ b/advection/src/readdata.h @@ -1,5 +1,5 @@ -#ifndef LINEARINTERPOLATE_READDATA_H -#define LINEARINTERPOLATE_READDATA_H +#ifndef ADVECTION_READDATA_H +#define ADVECTION_READDATA_H /** * reads the file hydrodynamic_U.h5 @@ -19,4 +19,4 @@ std::vector readHydrodynamicV(); */ std::tuple, std::vector, std::vector> readGrid(); -#endif //LINEARINTERPOLATE_READDATA_H +#endif //ADVECTION_READDATA_H