DDC 0.10.0
Loading...
Searching...
No Matches
knots_as_interpolation_points.hpp
1// Copyright (C) The DDC development team, see COPYRIGHT.md file
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <tuple>
8#include <type_traits>
9#include <vector>
10
11#include <ddc/ddc.hpp>
12
13#include <Kokkos_Core.hpp>
14
15#include "bsplines_uniform.hpp"
16#include "knot_discrete_dimension_type.hpp"
17#include "spline_boundary_conditions.hpp"
18
19namespace ddc {
20
36template <class BSplines, ddc::BoundCond BcLower, ddc::BoundCond BcUpper>
38{
39 static_assert(BcLower != ddc::BoundCond::GREVILLE);
40 static_assert(BcUpper != ddc::BoundCond::GREVILLE);
41
42 using continuous_dimension_type = typename BSplines::continuous_dimension_type;
43
44public:
50 template <typename Sampling, typename U = BSplines>
51 static auto get_sampling()
52 {
53 if constexpr (U::is_uniform()) {
54 return std::get<0>(Sampling::
58 ddc::discrete_space<BSplines>().ncells() + 1)));
59 } else {
60 using SamplingImpl = typename Sampling::template Impl<Sampling, Kokkos::HostSpace>;
61 std::vector<double> knots(ddc::discrete_space<BSplines>().npoints());
63 ddc::discrete_space<BSplines>().break_point_domain());
65 break_point_domain,
67 knots[ik - break_point_domain.front()] = ddc::coordinate(ik);
68 });
69 return SamplingImpl(knots);
70 }
71 }
72
74 using interpolation_discrete_dimension_type = std::conditional_t<
78
84 template <typename Sampling>
86 {
87 int const npoints = ddc::discrete_space<BSplines>().ncells() + !BSplines::is_periodic();
91 }
92};
93
94} // namespace ddc
KOKKOS_FUNCTION constexpr discrete_element_type front() const noexcept
A DiscreteElement identifies an element of the discrete dimension.
A DiscreteVector is a vector in the discrete dimension.
Helper class for the initialisation of the mesh of interpolation points.
std::conditional_t< is_uniform_bsplines_v< BSplines >, ddc::UniformPointSampling< continuous_dimension_type >, ddc::NonUniformPointSampling< continuous_dimension_type > > interpolation_discrete_dimension_type
The DDC type of the sampling for the interpolation points.
static auto get_sampling()
Get the sampling of interpolation points.
static ddc::DiscreteDomain< Sampling > get_domain()
Get the domain which can be used to access the interpolation points in the sampling.
NonUniformPointSampling models a non-uniform discretization of the CDim segment .
UniformPointSampling models a uniform discretization of the provided continuous dimension.
The top-level namespace of DDC.
constexpr bool enable_chunk
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmax(DiscreteDomain< DDim > const &d)
@ GREVILLE
Use Greville points instead of conditions on derivative for B-Spline interpolation.
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type... > coordinate(DiscreteElement< DDim... > const &c)
void host_for_each(Support const &domain, Functor &&f) noexcept
iterates over a nD domain in serial
Definition for_each.hpp:73
typename KnotDiscreteDimension< DDim >::type knot_discrete_dimension_t
Helper type to easily access KnotDiscreteDimension<DDim>::type
KOKKOS_FUNCTION Coordinate< typename DDim::continuous_dimension_type > rmin(DiscreteDomain< DDim > const &d)