Skip to content

Commit

Permalink
Splines small classes doc (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegouix committed May 17, 2024
1 parent e20602c commit 3eb0fcb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
4 changes: 4 additions & 0 deletions include/ddc/kernels/splines/deriv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class Tag>
struct Deriv
{
Expand Down
6 changes: 6 additions & 0 deletions include/ddc/kernels/splines/ginkgo_executors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace ddc::detail {

/**
* @brief A helper returning a ginkgo executor associated to Kokkos::DefaultHostExecutionSpace().
*/
inline std::shared_ptr<gko::Executor> create_default_host_executor()
{
#ifdef KOKKOS_ENABLE_SERIAL
Expand All @@ -27,6 +30,9 @@ inline std::shared_ptr<gko::Executor> create_default_host_executor()
#endif
} // Comes from "Basic Kokkos Extension" Ginkgo MR

/**
* @brief A helper returning a ginkgo executor associated to Kokkos::DefaultExecutionSpace().
*/
template <typename ExecSpace>
std::shared_ptr<gko::Executor> create_gko_exec()
{
Expand Down
30 changes: 23 additions & 7 deletions include/ddc/kernels/splines/spline_boundary_conditions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@
#include <stdexcept>

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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 3eb0fcb

Please sign in to comment.