12#include <Kokkos_Core.hpp>
14namespace ddc::detail {
17KOKKOS_INLINE_FUNCTION T sum(T* array,
int size)
20 for (
int i(0); i < size; ++i) {
26template <
class ElementType,
class LayoutPolicy,
class AccessorPolicy, std::size_t Ext>
27KOKKOS_INLINE_FUNCTION ElementType
30 Kokkos::extents<std::size_t, Ext>,
32 AccessorPolicy>
const& array)
35 for (std::size_t i(0); i < array.extent(0); ++i) {
41template <
class ElementType,
class LayoutPolicy,
class AccessorPolicy, std::size_t Ext>
42KOKKOS_INLINE_FUNCTION ElementType
45 Kokkos::extents<std::size_t, Ext>,
47 AccessorPolicy>
const& array,
52 for (
int i(start); i < end; ++i) {
59KOKKOS_INLINE_FUNCTION T modulo(T x, T y)
61 return x - y * Kokkos::floor(Real(x) / y);
64KOKKOS_INLINE_FUNCTION Real ipow(Real a, std::size_t i)
67 for (std::size_t j(0); j < i; ++j) {
73KOKKOS_INLINE_FUNCTION Real ipow(Real a,
int i)
77 for (
int j(0); j < i; ++j) {
81 for (
int j(0); j < -i; ++j) {
89KOKKOS_INLINE_FUNCTION std::size_t factorial(std::size_t f)
92 for (std::size_t i(2); i < f + 1; ++i) {
98template <
class T, std::size_t D>
99KOKKOS_INLINE_FUNCTION T dot_product(std::array<T, D>
const& a, std::array<T, D>
const& b)
102 for (std::size_t i(0); i < D; ++i) {
103 result += a[i] * b[i];
109KOKKOS_INLINE_FUNCTION T min(T x, T y)
111 return x < y ? x : y;
115KOKKOS_INLINE_FUNCTION T max(T x, T y)
117 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.
The top-level namespace of DDC.
constexpr bool is_uniform_bsplines_v
Indicates if a tag corresponds to uniform B-splines or not.
constexpr int n_boundary_equations(ddc::SplineBuilderClosure const sbc, std::size_t const degree)
Return the number of equations needed to describe a given closure relation.
ddc::ChunkSpan< Real, ddc::DiscreteDomain< DDim >, Layout, MemorySpace > integrals(ExecSpace const &execution_space, ddc::ChunkSpan< Real, 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.
SplineBuilderClosure
An enum representing a spline closure relation.
@ HOMOGENEOUS_HERMITE
Homogeneous Hermite closure relation (derivatives are 0)
@ GREVILLE
Use Greville points instead of conditions on derivative for B-Spline interpolation.
@ HERMITE
Hermite closure relation.
@ PERIODIC
Periodic closure relation u(1)=u(n)
A compile-time sequence of types.
A templated struct representing a discrete dimension storing the derivatives of a function along a co...