From 8535f523ed81a112a7c61c89946b609315234641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Govedi=C4=8D?= Date: Fri, 18 Oct 2024 23:49:39 -0400 Subject: [PATCH] Move files to `lib` (#14) Move files into `cpp/lib/`, which enables linting for them. Formatting will be done in the next PR for easier review. --- cpp/CMakeLists.txt | 6 +++--- cpp/bench/CMakeLists.txt | 2 +- cpp/bench/fftw/bench-fft-fusion.cpp | 2 +- cpp/bench/fftw/bench-fft-multi.cpp | 4 ++-- cpp/bench/fftw/bench-fft.cpp | 4 ++-- cpp/bench/naive.cpp | 2 +- cpp/bench/{timing.h => timing.hpp} | 0 cpp/{ => lib}/CliParams.hpp | 0 cpp/{ => lib}/HermiteRunner.cpp | 2 +- cpp/{HermiteRunner.h => lib/HermiteRunner.hpp} | 2 +- cpp/{ => lib}/Naive.cpp | 4 ++-- cpp/{Naive.h => lib/Naive.hpp} | 6 +++--- cpp/{cilk.h => lib/cilk.hpp} | 0 cpp/{constants.h => lib/constants.hpp} | 2 +- cpp/{ => lib}/driver.cpp | 6 +++--- cpp/{equillibrium.h => lib/equillibrium.hpp} | 4 ++-- cpp/{nonlinears.h => lib/nonlinears.hpp} | 2 +- cpp/lib/test-triangle.cpp | 4 ++-- cpp/{typedefs.h => lib/typedefs.hpp} | 0 cpp/test/NaiveTester.hpp | 2 +- cpp/test/naive-energies.cpp | 2 +- cpp/test/naive-moments.cpp | 2 +- 22 files changed, 29 insertions(+), 29 deletions(-) rename cpp/bench/{timing.h => timing.hpp} (100%) rename cpp/{ => lib}/CliParams.hpp (100%) rename cpp/{ => lib}/HermiteRunner.cpp (78%) rename cpp/{HermiteRunner.h => lib/HermiteRunner.hpp} (97%) rename cpp/{ => lib}/Naive.cpp (99%) rename cpp/{Naive.h => lib/Naive.hpp} (99%) rename cpp/{cilk.h => lib/cilk.hpp} (100%) rename cpp/{constants.h => lib/constants.hpp} (98%) rename cpp/{ => lib}/driver.cpp (87%) rename cpp/{equillibrium.h => lib/equillibrium.hpp} (97%) rename cpp/{nonlinears.h => lib/nonlinears.hpp} (99%) rename cpp/{typedefs.h => lib/typedefs.hpp} (100%) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 6292109..a7c74b9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -54,13 +54,13 @@ add_executable(adaptive_hermite_refinement lib/test-triangle.cpp) target_include_directories(adaptive_hermite_refinement PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(adaptive_hermite_refinement argparse mdspan) -add_library(src-lib OBJECT Naive.cpp Naive.h HermiteRunner.cpp HermiteRunner.h) -target_include_directories(src-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(src-lib OBJECT lib/Naive.cpp lib/Naive.hpp lib/HermiteRunner.cpp lib/HermiteRunner.hpp) +target_include_directories(src-lib PUBLIC lib/) target_link_libraries(src-lib mdspan fftw-cpp cnpy) add_subdirectory(bench) -add_executable(naive driver.cpp) +add_executable(naive lib/driver.cpp) target_link_libraries(naive argparse src-lib) option(AHR_TEST "Enable AHR tests" ON) diff --git a/cpp/bench/CMakeLists.txt b/cpp/bench/CMakeLists.txt index ac90039..749e394 100644 --- a/cpp/bench/CMakeLists.txt +++ b/cpp/bench/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../lib) add_executable(bench-fft fftw/bench-fft.cpp) target_link_libraries(bench-fft argparse fftw-cpp) diff --git a/cpp/bench/fftw/bench-fft-fusion.cpp b/cpp/bench/fftw/bench-fft-fusion.cpp index edd63d7..1969861 100644 --- a/cpp/bench/fftw/bench-fft-fusion.cpp +++ b/cpp/bench/fftw/bench-fft-fusion.cpp @@ -1,6 +1,6 @@ #include "fftw-cpp/fftw-cpp.h" -#include "timing.h" +#include "timing.hpp" #include #include diff --git a/cpp/bench/fftw/bench-fft-multi.cpp b/cpp/bench/fftw/bench-fft-multi.cpp index bee224d..60f71bb 100644 --- a/cpp/bench/fftw/bench-fft-multi.cpp +++ b/cpp/bench/fftw/bench-fft-multi.cpp @@ -1,7 +1,7 @@ #include "fftw-cpp/fftw-cpp.h" -#include "cilk.h" -#include "timing.h" +#include "cilk.hpp" +#include "timing.hpp" #include #include diff --git a/cpp/bench/fftw/bench-fft.cpp b/cpp/bench/fftw/bench-fft.cpp index 880b062..2c4571a 100644 --- a/cpp/bench/fftw/bench-fft.cpp +++ b/cpp/bench/fftw/bench-fft.cpp @@ -1,7 +1,7 @@ #include "fftw-cpp/fftw-cpp.h" -#include "cilk.h" -#include "timing.h" +#include "cilk.hpp" +#include "timing.hpp" #include #include diff --git a/cpp/bench/naive.cpp b/cpp/bench/naive.cpp index 490752b..90deb58 100644 --- a/cpp/bench/naive.cpp +++ b/cpp/bench/naive.cpp @@ -1,4 +1,4 @@ -#include "Naive.h" +#include "Naive.hpp" #include #include diff --git a/cpp/bench/timing.h b/cpp/bench/timing.hpp similarity index 100% rename from cpp/bench/timing.h rename to cpp/bench/timing.hpp diff --git a/cpp/CliParams.hpp b/cpp/lib/CliParams.hpp similarity index 100% rename from cpp/CliParams.hpp rename to cpp/lib/CliParams.hpp diff --git a/cpp/HermiteRunner.cpp b/cpp/lib/HermiteRunner.cpp similarity index 78% rename from cpp/HermiteRunner.cpp rename to cpp/lib/HermiteRunner.cpp index c99fb2e..5599439 100644 --- a/cpp/HermiteRunner.cpp +++ b/cpp/lib/HermiteRunner.cpp @@ -2,6 +2,6 @@ // Created by Luka on 4/28/2023. // -#include "HermiteRunner.h" +#include "HermiteRunner.hpp" ahr::HermiteRunner::HermiteRunner(std::ostream &out) : out(out) {} diff --git a/cpp/HermiteRunner.h b/cpp/lib/HermiteRunner.hpp similarity index 97% rename from cpp/HermiteRunner.h rename to cpp/lib/HermiteRunner.hpp index d91ea5a..b1b6465 100644 --- a/cpp/HermiteRunner.h +++ b/cpp/lib/HermiteRunner.hpp @@ -1,6 +1,6 @@ #pragma once -#include "typedefs.h" +#include "typedefs.hpp" #include #include #include diff --git a/cpp/Naive.cpp b/cpp/lib/Naive.cpp similarity index 99% rename from cpp/Naive.cpp rename to cpp/lib/Naive.cpp index 5085ecc..d4f4ddc 100644 --- a/cpp/Naive.cpp +++ b/cpp/lib/Naive.cpp @@ -1,5 +1,5 @@ -#include "Naive.h" -#include "equillibrium.h" +#include "Naive.hpp" +#include "equillibrium.hpp" #include #include diff --git a/cpp/Naive.h b/cpp/lib/Naive.hpp similarity index 99% rename from cpp/Naive.h rename to cpp/lib/Naive.hpp index 6e63ed5..8a624ef 100644 --- a/cpp/Naive.h +++ b/cpp/lib/Naive.hpp @@ -1,8 +1,8 @@ #pragma once -#include "HermiteRunner.h" -#include "constants.h" -#include "nonlinears.h" +#include "HermiteRunner.hpp" +#include "constants.hpp" +#include "nonlinears.hpp" #include #include diff --git a/cpp/cilk.h b/cpp/lib/cilk.hpp similarity index 100% rename from cpp/cilk.h rename to cpp/lib/cilk.hpp diff --git a/cpp/constants.h b/cpp/lib/constants.hpp similarity index 98% rename from cpp/constants.h rename to cpp/lib/constants.hpp index b3f89c8..1b2e486 100644 --- a/cpp/constants.h +++ b/cpp/lib/constants.hpp @@ -1,6 +1,6 @@ #pragma once -#include "typedefs.h" +#include "typedefs.hpp" namespace ahr { using std::numbers::pi; diff --git a/cpp/driver.cpp b/cpp/lib/driver.cpp similarity index 87% rename from cpp/driver.cpp rename to cpp/lib/driver.cpp index 060e2b4..2b9234b 100644 --- a/cpp/driver.cpp +++ b/cpp/lib/driver.cpp @@ -1,8 +1,8 @@ -#include "typedefs.h" +#include "typedefs.hpp" #include "CliParams.hpp" -#include "HermiteRunner.h" -#include "Naive.h" +#include "HermiteRunner.hpp" +#include "Naive.hpp" #include // TODO diff --git a/cpp/equillibrium.h b/cpp/lib/equillibrium.hpp similarity index 97% rename from cpp/equillibrium.h rename to cpp/lib/equillibrium.hpp index 76c907e..6fdd696 100644 --- a/cpp/equillibrium.h +++ b/cpp/lib/equillibrium.hpp @@ -1,7 +1,7 @@ #pragma once -#include "constants.h" -#include "Naive.h" +#include "constants.hpp" +#include "Naive.hpp" #include #include diff --git a/cpp/nonlinears.h b/cpp/lib/nonlinears.hpp similarity index 99% rename from cpp/nonlinears.h rename to cpp/lib/nonlinears.hpp index 5cb377a..d232e19 100644 --- a/cpp/nonlinears.h +++ b/cpp/lib/nonlinears.hpp @@ -1,6 +1,6 @@ #pragma once -#include "constants.h" +#include "constants.hpp" namespace ahr { [[nodiscard]] inline Real Gamma0(Real x) { diff --git a/cpp/lib/test-triangle.cpp b/cpp/lib/test-triangle.cpp index 3c7a64f..a5b0f9e 100644 --- a/cpp/lib/test-triangle.cpp +++ b/cpp/lib/test-triangle.cpp @@ -1,6 +1,6 @@ -#include "typedefs.h" +#include "typedefs.hpp" -#include "cilk.h" +#include "cilk.hpp" #include #include #include diff --git a/cpp/typedefs.h b/cpp/lib/typedefs.hpp similarity index 100% rename from cpp/typedefs.h rename to cpp/lib/typedefs.hpp diff --git a/cpp/test/NaiveTester.hpp b/cpp/test/NaiveTester.hpp index b90a092..749591b 100644 --- a/cpp/test/NaiveTester.hpp +++ b/cpp/test/NaiveTester.hpp @@ -1,5 +1,5 @@ #pragma once -#include "Naive.h" +#include "Naive.hpp" #include "util.hpp" #include diff --git a/cpp/test/naive-energies.cpp b/cpp/test/naive-energies.cpp index 7cd6af4..e57c3dd 100644 --- a/cpp/test/naive-energies.cpp +++ b/cpp/test/naive-energies.cpp @@ -1,4 +1,4 @@ -#include "Naive.h" +#include "Naive.hpp" #include "NaiveTester.hpp" #include "util.hpp" #include diff --git a/cpp/test/naive-moments.cpp b/cpp/test/naive-moments.cpp index 431c6f8..c7d1691 100644 --- a/cpp/test/naive-moments.cpp +++ b/cpp/test/naive-moments.cpp @@ -1,4 +1,4 @@ -#include "Naive.h" +#include "Naive.hpp" #include "NaiveTester.hpp" #include "util.hpp"