diff --git a/simulations/geometryRTheta/diocotron/diocotron.cpp b/simulations/geometryRTheta/diocotron/diocotron.cpp index 1e15e4cff..94dd927e0 100644 --- a/simulations/geometryRTheta/diocotron/diocotron.cpp +++ b/simulations/geometryRTheta/diocotron/diocotron.cpp @@ -26,7 +26,7 @@ #include "euler.hpp" #include "geometry.hpp" #include "input.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "output.hpp" #include "paraconfpp.hpp" #include "params.yaml.hpp" diff --git a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp index 9a0960939..2e3a2b9fb 100644 --- a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp +++ b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp @@ -26,7 +26,7 @@ #include "euler.hpp" #include "geometry.hpp" #include "input.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "paraconfpp.hpp" #include "params.yaml.hpp" #include "pdi_out.yml.hpp" diff --git a/simulations/geometryXY/guiding_center/guiding_center.cpp b/simulations/geometryXY/guiding_center/guiding_center.cpp index ad6cccad7..526d395d0 100644 --- a/simulations/geometryXY/guiding_center/guiding_center.cpp +++ b/simulations/geometryXY/guiding_center/guiding_center.cpp @@ -19,7 +19,7 @@ #include "geometry.hpp" #include "initialization_Kelvin_Helmholtz.hpp" #include "input.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "output.hpp" #include "paraconfpp.hpp" #include "params.yaml.hpp" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 031aaee03..37162b20f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,9 @@ # SPDX-License-Identifier: MIT +add_subdirectory(advection) +add_subdirectory(collisions) add_subdirectory(data_types) -add_subdirectory(utils) -add_subdirectory(speciesinfo) add_subdirectory(io) -add_subdirectory(paraconfpp) -add_subdirectory(quadrature) add_subdirectory(geometryXVx) add_subdirectory(geometryXY) add_subdirectory(geometryRTheta) @@ -13,9 +11,12 @@ add_subdirectory(geometryXYVxVy) add_subdirectory(geometryVparMu) add_subdirectory(interpolation) add_subdirectory(mapping) -add_subdirectory(multipatch) -add_subdirectory(advection) -add_subdirectory(timestepper) -add_subdirectory(collisions) +add_subdirectory(math_tools) add_subdirectory(mpi_parallelisation) +add_subdirectory(multipatch) +add_subdirectory(paraconfpp) add_subdirectory(pde_solvers) +add_subdirectory(quadrature) +add_subdirectory(speciesinfo) +add_subdirectory(timestepper) +add_subdirectory(utils) diff --git a/src/README.md b/src/README.md index e5754394e..f7bb2dcf3 100644 --- a/src/README.md +++ b/src/README.md @@ -13,6 +13,7 @@ The `src/` folder contains all the code necessary to build a gyrokinetic semi-La - [interpolation](./interpolation/README.md) - Code describing interpolation methods. - [io](./io/README.md) - Code describing tools for inputting and outputting data in a simulation. - [mapping](./mapping/README.md) - Code describing tools for handling different coordinate systems. +- [math_tools](./math_tools/README.md) - Code describing math tools functions. - [multipatch](./multipatch/README.md) - Code describing multipatch geometry. - [mpi\_parallelisation](./mpi_parallelisation/README.md) - Code describing the MPI parallelisation. diff --git a/src/geometryRTheta/advection/CMakeLists.txt b/src/geometryRTheta/advection/CMakeLists.txt index dd74c9137..650480247 100644 --- a/src/geometryRTheta/advection/CMakeLists.txt +++ b/src/geometryRTheta/advection/CMakeLists.txt @@ -14,6 +14,7 @@ target_link_libraries(advection_rp gslx::geometry_RTheta gslx::interpolation_2D_rp gslx::mapping + gslx::math_tools gslx::utils ) add_library(gslx::advection_rp ALIAS advection_rp) diff --git a/src/geometryRTheta/advection/advection_domain.hpp b/src/geometryRTheta/advection/advection_domain.hpp index be629c055..dbf82c9ff 100644 --- a/src/geometryRTheta/advection/advection_domain.hpp +++ b/src/geometryRTheta/advection/advection_domain.hpp @@ -13,7 +13,7 @@ #include "directional_tag.hpp" #include "geometry.hpp" #include "geometry_pseudo_cartesian.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "vector_field.hpp" #include "vector_field_mem.hpp" diff --git a/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp b/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp index 9cd40d865..6bf641b9d 100644 --- a/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp +++ b/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp @@ -7,7 +7,7 @@ #include "ddc_alias_inline_functions.hpp" #include "ddc_aliases.hpp" #include "geometry.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "poisson_like_rhs_function.hpp" #include "polarpoissonlikesolver.hpp" diff --git a/src/geometryRTheta/time_solver/bsl_predcorr.hpp b/src/geometryRTheta/time_solver/bsl_predcorr.hpp index f0e2aa416..53af9058d 100644 --- a/src/geometryRTheta/time_solver/bsl_predcorr.hpp +++ b/src/geometryRTheta/time_solver/bsl_predcorr.hpp @@ -17,7 +17,7 @@ #include "geometry.hpp" #include "ifoot_finder.hpp" #include "itimesolver.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "poisson_like_rhs_function.hpp" #include "polarpoissonlikesolver.hpp" #include "rk2.hpp" diff --git a/src/geometryXY/time_integration/predcorr_RK2.hpp b/src/geometryXY/time_integration/predcorr_RK2.hpp index 369eef436..9732f2595 100644 --- a/src/geometryXY/time_integration/predcorr_RK2.hpp +++ b/src/geometryXY/time_integration/predcorr_RK2.hpp @@ -13,7 +13,7 @@ #include "ddc_aliases.hpp" #include "directional_tag.hpp" #include "geometry.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "paraconfpp.hpp" #include "rk2.hpp" #include "vector_field.hpp" diff --git a/src/math_tools/CMakeLists.txt b/src/math_tools/CMakeLists.txt new file mode 100644 index 000000000..c6f68cddf --- /dev/null +++ b/src/math_tools/CMakeLists.txt @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: MIT + +add_library("math_tools" INTERFACE) + +target_include_directories("math_tools" + INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" +) + +target_link_libraries("math_tools" + INTERFACE + DDC::DDC + gslx::data_types +) + +add_library("gslx::math_tools" ALIAS "math_tools") + diff --git a/src/math_tools/README.md b/src/math_tools/README.md new file mode 100644 index 000000000..2d012cf67 --- /dev/null +++ b/src/math_tools/README.md @@ -0,0 +1,9 @@ +# Utility Functions + +This folder contains mathematical classes and functions. + +## Utility tools + +The l\_norm\_tools.hpp file contains functions computing the infinity norm. For now, it computes the infinity norm of +- a double: $`\Vert x \Vert_{\infty} = x`$; +- a coordinate: $`\Vert x \Vert_{\infty} = \max_{i} (|x_i|)`$. diff --git a/src/utils/math_tools.hpp b/src/math_tools/l_norm_tools.hpp similarity index 98% rename from src/utils/math_tools.hpp rename to src/math_tools/l_norm_tools.hpp index dde1f6c2d..fb33d0c78 100644 --- a/src/utils/math_tools.hpp +++ b/src/math_tools/l_norm_tools.hpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT /** - * @file math_tools.hpp - * File Describing useful mathematical functions. + * @file l_norm_tools.hpp + * File Describing useful mathematical functions to compute Lnorms */ #pragma once diff --git a/src/multipatch/README.md b/src/multipatch/README.md index c1f2cfff4..2fd8fdebc 100644 --- a/src/multipatch/README.md +++ b/src/multipatch/README.md @@ -6,8 +6,6 @@ The `multipatch` folder contains all the code describing methods and classes whi - [data\_types](./data_types/README.md) - Defines classes to handle objects on a multipatch domain more conveniently. -- [interface\_derivatives](./interface_derivatives/README.md) - Ongoing work only available on GitLab. - - [spline](./spline/README.md) - Defines structures and methods to deal with different splines on every patches. - [utils](./utils/README.md) - Defines utility functions to operate over multiple patches. diff --git a/src/multipatch/utils/multipatch_math_tools.hpp b/src/multipatch/utils/multipatch_math_tools.hpp index 513a945a9..10e6ace8e 100644 --- a/src/multipatch/utils/multipatch_math_tools.hpp +++ b/src/multipatch/utils/multipatch_math_tools.hpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT #pragma once -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "multipatch_field.hpp" /** diff --git a/src/timestepper/CMakeLists.txt b/src/timestepper/CMakeLists.txt index 1a81e435d..c664a762f 100644 --- a/src/timestepper/CMakeLists.txt +++ b/src/timestepper/CMakeLists.txt @@ -1,6 +1,4 @@ - - add_library(timestepper INTERFACE) target_include_directories(timestepper INTERFACE @@ -9,6 +7,7 @@ target_include_directories(timestepper target_link_libraries(timestepper INTERFACE DDC::core gslx::data_types + gslx::math_tools gslx::multipatch_data_types gslx::multipatch_utils gslx::utils diff --git a/src/timestepper/crank_nicolson.hpp b/src/timestepper/crank_nicolson.hpp index 3eb3e11ca..35b210e0e 100644 --- a/src/timestepper/crank_nicolson.hpp +++ b/src/timestepper/crank_nicolson.hpp @@ -5,7 +5,7 @@ #include "ddc_aliases.hpp" #include "ddc_helper.hpp" #include "itimestepper.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "multipatch_math_tools.hpp" #include "vector_field_common.hpp" diff --git a/src/utils/README.md b/src/utils/README.md index af7c7d14f..31b8ccd8c 100644 --- a/src/utils/README.md +++ b/src/utils/README.md @@ -5,9 +5,3 @@ This folder contains classes and functions which facilitate the writing of the r The class ddcHelper exists to provide functionalities which are currently missing from DDC. The class NDTag exists to provide a way to group directional tags together. This is notably useful in order to create a vector field. - -## Utility tools - -The utils\_tools.hpp file contains functions computing the infinity norm. For now, it computes the infinity norm of -- a double: $`\Vert x \Vert_{\infty} = x`$; -- a coordinate: $`\Vert x \Vert_{\infty} = \max_{i} (|x_i|)`$. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8006490d8..243039b91 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,6 +22,7 @@ add_subdirectory(geometryRTheta) add_subdirectory(geometryVparMu) add_subdirectory(multipatch) add_subdirectory(mpi_parallelisation) +add_subdirectory(math_tools) add_subdirectory(pde_solvers) add_subdirectory(quadrature) add_subdirectory(timestepper) diff --git a/tests/README.md b/tests/README.md index 85fd344a6..49524c429 100644 --- a/tests/README.md +++ b/tests/README.md @@ -10,6 +10,7 @@ It is broken up into the following sub-folders: - geometryVparMu - Tests in the vpar-mu geometry. - geometryXVx - Tests in the x-vx geometry. - geometryXYVxVy - Tests in the x,y-vx,vy geometry. + - math_tools - Test for mathematical functions. - MPI parallelism - Tests for the templated MPI operators. - [multipatch](./multipatch/README.md) - Tests for the classes that work over multipatch geometries. - PDE solvers - Tests for the templated Partial Differential Equation solvers. diff --git a/tests/geometryRTheta/advection_2d_rp/advection_simulation_utils.hpp b/tests/geometryRTheta/advection_2d_rp/advection_simulation_utils.hpp index 524c7cfdc..a12f037a5 100644 --- a/tests/geometryRTheta/advection_2d_rp/advection_simulation_utils.hpp +++ b/tests/geometryRTheta/advection_2d_rp/advection_simulation_utils.hpp @@ -16,7 +16,7 @@ #include "bsl_advection_rp.hpp" #include "directional_tag.hpp" #include "geometry.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "paraconfpp.hpp" #include "params.yaml.hpp" #include "quadrature.hpp" diff --git a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp index dd757785a..87a90bdd6 100644 --- a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp +++ b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp @@ -28,7 +28,7 @@ #include "crank_nicolson.hpp" #include "euler.hpp" #include "geometry.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "mesh_builder.hpp" #include "quadrature.hpp" #include "rk3.hpp" diff --git a/tests/geometryRTheta/quadrature/CMakeLists.txt b/tests/geometryRTheta/quadrature/CMakeLists.txt index 26a86cc71..fecd941e0 100644 --- a/tests/geometryRTheta/quadrature/CMakeLists.txt +++ b/tests/geometryRTheta/quadrature/CMakeLists.txt @@ -12,6 +12,7 @@ target_link_libraries(Li_norms_spline_quadrature_tests sll::SLL gslx::geometry_RTheta gslx::quadrature + gslx::math_tools gslx::utils ) diff --git a/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp b/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp index a950756af..bc16afac5 100644 --- a/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp +++ b/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp @@ -9,7 +9,7 @@ #include #include "geometry.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "mesh_builder.hpp" #include "quadrature.hpp" #include "spline_quadrature.hpp" diff --git a/tests/math_tools/CMakeLists.txt b/tests/math_tools/CMakeLists.txt new file mode 100644 index 000000000..64a3aaa57 --- /dev/null +++ b/tests/math_tools/CMakeLists.txt @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT + + +include(GoogleTest) + +add_executable(unit_tests_math_tools + test_lnorm_tools.cpp + ../main.cpp +) +target_link_libraries(unit_tests_math_tools + PUBLIC + DDC::pdi + GTest::gtest + GTest::gmock + paraconf::paraconf + gslx::math_tools + gslx::utils +) + +gtest_discover_tests(unit_tests_math_tools DISCOVERY_MODE PRE_TEST) diff --git a/tests/utils/test_math_tools.cpp b/tests/math_tools/test_lnorm_tools.cpp similarity index 99% rename from tests/utils/test_math_tools.cpp rename to tests/math_tools/test_lnorm_tools.cpp index 6395b81a1..c083bd224 100644 --- a/tests/utils/test_math_tools.cpp +++ b/tests/math_tools/test_lnorm_tools.cpp @@ -6,7 +6,7 @@ #include "ddc_alias_inline_functions.hpp" #include "ddc_aliases.hpp" #include "ddc_helper.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" namespace { diff --git a/tests/timestepper/CMakeLists.txt b/tests/timestepper/CMakeLists.txt index 201318925..ddb27a828 100644 --- a/tests/timestepper/CMakeLists.txt +++ b/tests/timestepper/CMakeLists.txt @@ -20,6 +20,7 @@ target_link_libraries(unit_tests_timestepper GTest::gtest GTest::gmock paraconf::paraconf + gslx::math_tools gslx::multipatch_data_types gslx::multipatch_geometries gslx::timestepper diff --git a/tests/timestepper/crank_nicolson_2d_mixed.cpp b/tests/timestepper/crank_nicolson_2d_mixed.cpp index c60b37234..902db456e 100644 --- a/tests/timestepper/crank_nicolson_2d_mixed.cpp +++ b/tests/timestepper/crank_nicolson_2d_mixed.cpp @@ -10,7 +10,7 @@ #include "crank_nicolson.hpp" #include "directional_tag.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "vector_field.hpp" #include "vector_field_mem.hpp" diff --git a/tests/timestepper/euler_2d_mixed.cpp b/tests/timestepper/euler_2d_mixed.cpp index c4e28c598..582e40e99 100644 --- a/tests/timestepper/euler_2d_mixed.cpp +++ b/tests/timestepper/euler_2d_mixed.cpp @@ -11,7 +11,7 @@ #include "crank_nicolson.hpp" #include "directional_tag.hpp" #include "euler.hpp" -#include "math_tools.hpp" +#include "l_norm_tools.hpp" #include "vector_field.hpp" #include "vector_field_mem.hpp" diff --git a/tests/utils/CMakeLists.txt b/tests/utils/CMakeLists.txt index 053e446a4..6fec4492e 100644 --- a/tests/utils/CMakeLists.txt +++ b/tests/utils/CMakeLists.txt @@ -5,7 +5,6 @@ include(GoogleTest) add_executable(unit_tests_utils test_ddcHelpers.cpp - test_math_tools.cpp transpose.cpp ../main.cpp )