Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splines small classes doc #431

Merged
merged 5 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
28 changes: 21 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,22 @@
#include <stdexcept>

namespace ddc {

/// @brief An enum representing a spline boundary condition.
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
blegouix marked this conversation as resolved.
Show resolved Hide resolved
};

/**
* @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 +38,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)
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved
{
if (bc == ddc::BoundCond::PERIODIC) {
Expand Down