10#include <Kokkos_Core.hpp>
12namespace ddc::detail {
15KOKKOS_INLINE_FUNCTION T sum(T* array,
int size)
18 for (
int i(0); i < size; ++i) {
24template <
class ElementType,
class LayoutPolicy,
class AccessorPolicy, std::size_t Ext>
25KOKKOS_INLINE_FUNCTION ElementType
28 Kokkos::extents<std::size_t, Ext>,
30 AccessorPolicy>
const& array)
33 for (std::size_t i(0); i < array.extent(0); ++i) {
39template <
class ElementType,
class LayoutPolicy,
class AccessorPolicy, std::size_t Ext>
40KOKKOS_INLINE_FUNCTION ElementType
43 Kokkos::extents<std::size_t, Ext>,
45 AccessorPolicy>
const& array,
50 for (
int i(start); i < end; ++i) {
57KOKKOS_INLINE_FUNCTION T modulo(T x, T y)
59 return x - y * Kokkos::floor(
double(x) / y);
62KOKKOS_INLINE_FUNCTION
double ipow(
double a, std::size_t i)
65 for (std::size_t j(0); j < i; ++j) {
71KOKKOS_INLINE_FUNCTION
double ipow(
double a,
int i)
75 for (
int j(0); j < i; ++j) {
79 for (
int j(0); j < -i; ++j) {
87KOKKOS_INLINE_FUNCTION std::size_t factorial(std::size_t f)
90 for (std::size_t i(2); i < f + 1; ++i) {
96template <
class T, std::size_t D>
97KOKKOS_INLINE_FUNCTION T dot_product(std::array<T, D>
const& a, std::array<T, D>
const& b)
100 for (std::size_t i(0); i < D; ++i) {
101 result += a[i] * b[i];
107KOKKOS_INLINE_FUNCTION T min(T x, T y)
109 return x < y ? x : y;
113KOKKOS_INLINE_FUNCTION T max(T x, T y)
115 return x > y ? x : y;
friend class DiscreteDomain
KOKKOS_FUNCTION constexpr bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
A class which provides helper functions to initialise the Greville points from a B-Spline definition.
static ddc::DiscreteDomain< Sampling > get_domain()
Get the domain which gives us access to all of the Greville points.
static auto get_sampling()
Get the UniformPointSampling defining the Greville points.
The top-level namespace of DDC.
constexpr int n_boundary_equations(ddc::BoundCond const bc, std::size_t const degree)
Return the number of equations needed to describe a given boundary condition.
constexpr bool is_uniform_bsplines_v
Indicates if a tag corresponds to uniform B-splines or not.
BoundCond
An enum representing a spline boundary condition.
@ GREVILLE
Use Greville points instead of conditions on derivative for B-Spline interpolation.
@ HERMITE
Hermite boundary condition.
@ PERIODIC
Periodic boundary condition u(1)=u(n)
ddc::ChunkSpan< double, ddc::DiscreteDomain< DDim >, Layout, MemorySpace > integrals(ExecSpace const &execution_space, ddc::ChunkSpan< double, ddc::DiscreteDomain< DDim >, Layout, MemorySpace > int_vals)
Compute the integrals of the B-splines.
constexpr bool is_non_uniform_bsplines_v
Indicates if a tag corresponds to non-uniform B-splines or not.
A templated struct representing a discrete dimension storing the derivatives of a function along a co...