From 3eb0fcb9fcdbfedf9937206921f605141c2e7a2d Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Fri, 17 May 2024 16:21:48 +0200 Subject: [PATCH] Splines small classes doc (#431) --- include/ddc/kernels/splines/deriv.hpp | 4 +++ .../ddc/kernels/splines/ginkgo_executors.hpp | 6 ++++ .../splines/spline_boundary_conditions.hpp | 30 ++++++++++++++----- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/include/ddc/kernels/splines/deriv.hpp b/include/ddc/kernels/splines/deriv.hpp index 70ebe619c..1562c9491 100644 --- a/include/ddc/kernels/splines/deriv.hpp +++ b/include/ddc/kernels/splines/deriv.hpp @@ -6,6 +6,10 @@ namespace ddc { +/** + * @brief A templated struct representing a discrete dimension storing + * the derivatives of a function along a continuous dimension Tag. + */ template struct Deriv { diff --git a/include/ddc/kernels/splines/ginkgo_executors.hpp b/include/ddc/kernels/splines/ginkgo_executors.hpp index f720a07f9..a5feedced 100644 --- a/include/ddc/kernels/splines/ginkgo_executors.hpp +++ b/include/ddc/kernels/splines/ginkgo_executors.hpp @@ -13,6 +13,9 @@ namespace ddc::detail { +/** + * @brief A helper returning a ginkgo executor associated to Kokkos::DefaultHostExecutionSpace(). + */ inline std::shared_ptr create_default_host_executor() { #ifdef KOKKOS_ENABLE_SERIAL @@ -27,6 +30,9 @@ inline std::shared_ptr create_default_host_executor() #endif } // Comes from "Basic Kokkos Extension" Ginkgo MR +/** + * @brief A helper returning a ginkgo executor associated to Kokkos::DefaultExecutionSpace(). + */ template std::shared_ptr create_gko_exec() { diff --git a/include/ddc/kernels/splines/spline_boundary_conditions.hpp b/include/ddc/kernels/splines/spline_boundary_conditions.hpp index 743f30ae8..85a49f0c7 100644 --- a/include/ddc/kernels/splines/spline_boundary_conditions.hpp +++ b/include/ddc/kernels/splines/spline_boundary_conditions.hpp @@ -8,16 +8,24 @@ #include namespace ddc { + +/** @brief An enum representing a spline boundary condition. Please refer to + * Emily Bourne's thesis (https://www.theses.fr/2022AIXM0412.pdf) + */ enum class BoundCond { - // Periodic boundary condition u(1)=u(n) - PERIODIC, - // Hermite boundary condition - HERMITE, - // Use Greville points instead of conditions on derivative for B-Spline - // interpolation - GREVILLE, + PERIODIC, ///< Periodic boundary condition u(1)=u(n) + HERMITE, ///< Hermite boundary condition + GREVILLE, ///< Use Greville points instead of conditions on derivative for B-Spline interpolation }; +/** + * @brief Prints a boundary condition in a std::ostream. + * + * @param out The stream in which the boundary condition is printed. + * @param degree The boundary condition. + * + * @return The stream in which the boundary condition is printed. + **/ static inline std::ostream& operator<<(std::ostream& out, ddc::BoundCond const bc) { switch (bc) { @@ -32,6 +40,14 @@ static inline std::ostream& operator<<(std::ostream& out, ddc::BoundCond const b } } +/** + * @brief Return the number of equations needed to describe a given boundary condition. + * + * @param bc The boundary condition. + * @param degree The degree of the spline. + * + * @return The number of equations. + **/ constexpr int n_boundary_equations(ddc::BoundCond const bc, std::size_t const degree) { if (bc == ddc::BoundCond::PERIODIC) {