13#include <Kokkos_Core.hpp>
22
23
24
25
26
27
28
29
30
31
32
38 class ExtrapolationRule>
39class SplineEvaluatorND;
45 class... EvaluationDDim,
46 class... ExtrapolationRule>
47class SplineEvaluatorND<
55 static constexpr std::size_t dimension =
sizeof...(BSplines);
57 using bsplines_ts =
TypeSeq<BSplines...>;
59 template <
class BSpline>
60 static constexpr std::size_t s_idx = ddc::type_seq_rank_v<BSpline, bsplines_ts>;
62 using evaluation_ddim_ts =
TypeSeq<EvaluationDDim...>;
63 using lower_extrap_rule_ts =
TypeSeq<
64 ddc::type_seq_element_t<2 * s_idx<BSplines>,
TypeSeq<ExtrapolationRule...>>...>;
65 using upper_extrap_rule_ts =
TypeSeq<
66 ddc::type_seq_element_t<2 * s_idx<BSplines> + 1,
TypeSeq<ExtrapolationRule...>>...>;
71 template <std::size_t I>
72 using continuous_dimension_type
73 =
ddc::type_seq_element_t<I, bsplines_ts>::continuous_dimension_type;
76 using exec_space = ExecSpace;
79 using memory_space = MemorySpace;
82 template <std::size_t I>
83 using evaluation_discrete_dimension_type =
ddc::type_seq_element_t<I, evaluation_ddim_ts>;
86 template <std::size_t I>
87 using bsplines_type =
ddc::type_seq_element_t<I, bsplines_ts>;
90
91
92
93
94 template <std::size_t... Dims>
95 using evaluation_domain_type =
ddc::
DiscreteDomain<evaluation_discrete_dimension_type<Dims>...>;
98
99
100
101
102 template <concepts::discrete_domain BatchedInterpolationDDom>
103 using batched_evaluation_domain_type = BatchedInterpolationDDom;
106
107
108
109
110 template <std::size_t... Dims>
114
115
116
117
118
119 template <concepts::discrete_domain BatchedInterpolationDDom>
120 using batch_domain_type
121 =
ddc::detail::convert_type_seq_to_discrete_domain_t<
ddc::type_seq_remove_t<
122 ddc::to_type_seq_t<BatchedInterpolationDDom>,
123 evaluation_ddim_ts>>;
126
127
128
129
130
131 template <concepts::discrete_domain BatchedInterpolationDDom>
132 using batched_spline_domain_type
133 =
ddc::detail::convert_type_seq_to_discrete_domain_t<
ddc::type_seq_replace_t<
134 ddc::to_type_seq_t<BatchedInterpolationDDom>,
139 template <std::size_t I>
140 using lower_extrapolation_rule_type =
ddc::type_seq_element_t<I, lower_extrap_rule_ts>;
143 template <std::size_t I>
144 using upper_extrapolation_rule_type =
ddc::type_seq_element_t<I, upper_extrap_rule_ts>;
147 cexa::tuple<
ddc::type_seq_element_t<s_idx<BSplines>, lower_extrap_rule_ts>...>
148 m_lower_extrap_rules;
149 cexa::tuple<
ddc::type_seq_element_t<s_idx<BSplines>, upper_extrap_rule_ts>...>
150 m_upper_extrap_rules;
153
154
155
156
157 explicit SplineEvaluatorND(cexa::tuple<ExtrapolationRule...>
const& extrap_rules)
158 : m_lower_extrap_rules(cexa::get<2 * s_idx<BSplines>>(extrap_rules)...)
159 , m_upper_extrap_rules(cexa::get<2 * s_idx<BSplines> + 1>(extrap_rules)...)
165 sizeof...(BSplines) == dimension,
166 "Number of BSpline dims should be equal to the dimension");
168 sizeof...(EvaluationDDim) == dimension,
169 "Number of evaluation dims should be equal to the dimensions");
171 ddc::type_seq_size_v<lower_extrap_rule_ts> == dimension,
172 "Number of lower extrapolation rules should be equal to the dimension");
174 ddc::type_seq_size_v<upper_extrap_rule_ts> == dimension,
175 "Number of upper extrapolation rules should be equal to the dimension");
179 ddc::type_seq_element_t<s_idx<BSplines>, lower_extrap_rule_ts>,
181 == BSplines::is_periodic()
183 ddc::type_seq_element_t<s_idx<BSplines>, upper_extrap_rule_ts>,
185 typename BSplines::continuous_dimension_type>>
186 == BSplines::is_periodic())
188 "PeriodicExtrapolationRule has to be used if and only if dimension is periodic");
190 (std::is_invocable_r_v<
192 ddc::type_seq_element_t<s_idx<BSplines>, lower_extrap_rule_ts>,
193 ddc::Coordinate<
typename BSplines::continuous_dimension_type...>,
197 Kokkos::layout_right,
200 "LowerExtrapolationRule::operator() has to be callable "
201 "with usual arguments.");
203 (std::is_invocable_r_v<
205 ddc::type_seq_element_t<s_idx<BSplines>, upper_extrap_rule_ts>,
206 ddc::Coordinate<
typename BSplines::continuous_dimension_type...>,
210 Kokkos::layout_right,
213 "UpperExtrapolationRule::operator() has to be callable "
214 "with usual arguments.");
217
218
219
220
221
222
224 : SplineEvaluatorND(cexa::make_tuple(extrap_rules...))
229
230
231
232
236
237
238
239
246
247
248
249
250
251 SplineEvaluatorND&
operator=(SplineEvaluatorND
const& x) =
default;
254
255
256
257
258
259 SplineEvaluatorND&
operator=(SplineEvaluatorND&& x) =
default;
262
263
264
265
266
267
268
269
270 template <std::size_t I>
273 return cexa::get<I>(m_lower_extrap_rules);
277
278
279
280
281
282
283
284
285 template <std::size_t I>
288 return cexa::get<I>(m_upper_extrap_rules);
292
293
294
295
296
297
298
299
300
301
302
303 template <
class Layout,
class... CoordsDims>
305 ddc::Coordinate<CoordsDims...>
const& coord_eval,
309 return eval(coord_eval, spline_coef);
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
336 class BatchedInterpolationDDom,
339 ddc::
ChunkSpan<Real, BatchedInterpolationDDom, Layout1, memory_space>
const spline_eval,
341 ddc::Coordinate<CoordsDims...>
const,
342 BatchedInterpolationDDom,
344 memory_space>
const coords_eval,
347 batched_spline_domain_type<BatchedInterpolationDDom>,
349 memory_space>
const spline_coef)
const
352 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
354 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(coords_eval.domain());
356 ddc::parallel_for_each(
357 "ddc_splines_evaluate_Nd",
361 batch_domain_type<BatchedInterpolationDDom>::discrete_element_type
const
363 auto const spline_eval_ND = spline_eval[j];
364 auto const coords_eval_ND = coords_eval[j];
365 auto const spline_coef_ND = spline_coef[j];
366 ddc::device_for_each(
368 [&](evaluation_domain_type::discrete_element_type
const i) {
369 spline_eval_ND(i) = eval(coords_eval_ND(i), spline_coef_ND);
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389 template <
class Layout1,
class Layout2,
class BatchedInterpolationDDom>
391 ddc::
ChunkSpan<Real, BatchedInterpolationDDom, Layout1, memory_space>
const spline_eval,
394 batched_spline_domain_type<BatchedInterpolationDDom>,
396 memory_space>
const spline_coef)
const
399 evaluation_domain_type evaluation_domain(spline_eval.domain());
401 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
403 ddc::parallel_for_each(
404 "ddc_splines_evaluate_Nd",
408 batch_domain_type<BatchedInterpolationDDom>::discrete_element_type
const
410 auto const spline_eval_ND = spline_eval[j];
411 auto const spline_coef_ND = spline_coef[j];
413 ddc::device_for_each(
415 [&](evaluation_domain_type::discrete_element_type
const i) {
416 ddc::Coordinate<
typename BSplines::continuous_dimension_type...>
417 coord_eval_ND(
ddc::coordinate(i));
418 spline_eval_ND(i) = eval(coord_eval_ND, spline_coef_ND);
424
425
426
427
428
429
430
431
432
433
434
435
436 template <
class DElem,
class Layout,
class... CoordsDims>
438 deriv(DElem
const& deriv_order,
439 ddc::Coordinate<CoordsDims...>
const& coord_eval,
443 static_assert(
ddc::is_discrete_element_v<DElem>);
445 return eval_no_bc(deriv_order, coord_eval, spline_coef);
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
474 class BatchedInterpolationDDom,
477 DElem
const& deriv_order,
478 ddc::
ChunkSpan<Real, BatchedInterpolationDDom, Layout1, memory_space>
const spline_eval,
480 ddc::Coordinate<CoordsDims...>
const,
481 BatchedInterpolationDDom,
483 memory_space>
const coords_eval,
486 batched_spline_domain_type<BatchedInterpolationDDom>,
488 memory_space>
const spline_coef)
const
490 static_assert(
ddc::is_discrete_element_v<DElem>);
493 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
495 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
497 ddc::parallel_for_each(
498 "ddc_splines_cross_differentiate_Nd",
502 batch_domain_type<BatchedInterpolationDDom>::discrete_element_type
const
504 auto const spline_eval_ND = spline_eval[j];
505 auto const coords_eval_ND = coords_eval[j];
506 auto const spline_coef_ND = spline_coef[j];
507 ddc::device_for_each(
509 [&](evaluation_domain_type::discrete_element_type
const i) {
510 spline_eval_ND(i) = eval_no_bc(
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533 template <
class DElem,
class Layout1,
class Layout2,
class BatchedInterpolationDDom>
535 DElem
const& deriv_order,
536 ddc::
ChunkSpan<Real, BatchedInterpolationDDom, Layout1, memory_space>
const spline_eval,
539 batched_spline_domain_type<BatchedInterpolationDDom>,
541 memory_space>
const spline_coef)
const
543 static_assert(is_discrete_element_v<DElem>);
546 evaluation_domain_type evaluation_domain(spline_eval.domain());
548 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
550 ddc::parallel_for_each(
551 "ddc_splines_cross_differentiate_Nd",
555 batch_domain_type<BatchedInterpolationDDom>::discrete_element_type
const
557 auto const spline_eval_ND = spline_eval[j];
558 auto const spline_coef_ND = spline_coef[j];
559 ddc::device_for_each(
561 [&](evaluation_domain_type::discrete_element_type
const i) {
562 ddc::Coordinate<
typename BSplines::continuous_dimension_type...>
563 coord_eval_ND(
ddc::coordinate(i));
565 = eval_no_bc(deriv_order, coord_eval_ND, spline_coef_ND);
571
572
573
574
575
576
577
578
579
580
581
582
583 template <
class Layout1,
class Layout2,
class BatchedDDom,
class BatchedSplineDDom>
585 ddc::
ChunkSpan<Real, BatchedDDom, Layout1, memory_space>
const integrals,
586 ddc::
ChunkSpan<Real
const, BatchedSplineDDom, Layout2, memory_space>
const spline_coef)
590 ddc::type_seq_contains_v<bsplines_ts, to_type_seq_t<BatchedSplineDDom>>,
591 "The spline coefficients domain must contain the bsplines dimensions");
593 std::is_same_v<batch_domain_type<BatchedDDom>, BatchedDDom>,
594 "The integrals domain must only contain the batch dimensions");
597 bsplines_domain_type
const bsplines_domain(spline_coef.domain());
599 batch_domain_type<BatchedDDom>
const batch_domain(integrals.domain());
600 auto values_alloc = cexa::make_tuple(
604 auto values = cexa::make_tuple(cexa::get<s_idx<BSplines>>(values_alloc).span_view()...);
605 (
ddc::integrals(exec_space(), cexa::get<s_idx<BSplines>>(values)), ...);
607 ddc::parallel_for_each(
608 "ddc_splines_integrate_bsplines",
611 KOKKOS_LAMBDA(batch_domain_type<BatchedDDom>::discrete_element_type
const j) {
613 ddc::device_for_each(
615 [&](bsplines_domain_type::discrete_element_type
const i) {
616 integrals(j) += spline_coef(i, j)
617 * (cexa::get<s_idx<BSplines>>(values)(
618 ddc::DiscreteElement<BSplines>(i))
625 template <std::size_t I,
class... CoordsDims>
626 KOKKOS_INLINE_FUNCTION
static void update_coord_eval(
ddc::Coordinate<CoordsDims...>& coord_eval)
628 using Dim = continuous_dimension_type<I>;
629 using bsplines_t = bsplines_type<I>;
631 if constexpr (bsplines_t::is_periodic()) {
632 if (
ddc::get<Dim>(coord_eval) <
ddc::discrete_space<bsplines_t>().rmin()
633 ||
ddc::get<Dim>(coord_eval) >
ddc::discrete_space<bsplines_t>().rmax()) {
634 ddc::get<Dim>(coord_eval) -= Kokkos::floor(
635 (
ddc::get<Dim>(coord_eval)
636 -
ddc::discrete_space<bsplines_t>().rmin())
637 /
ddc::discrete_space<bsplines_t>().length())
638 *
ddc::discrete_space<bsplines_t>().length();
643 template <std::size_t I,
class Layout,
class... CoordsDims>
644 KOKKOS_INLINE_FUNCTION
bool check_needs_extrapolation(
645 ddc::Coordinate<CoordsDims...> coord_eval,
650 if constexpr (!bsplines_type<I>::is_periodic()) {
651 if (
ddc::get<continuous_dimension_type<I>>(coord_eval)
652 <
ddc::discrete_space<bsplines_type<I>>().rmin()) {
653 res = cexa::get<I>(m_lower_extrap_rules)(coord_eval, spline_coef);
656 if (
ddc::get<continuous_dimension_type<I>>(coord_eval)
657 >
ddc::discrete_space<bsplines_type<I>>().rmax()) {
658 res = cexa::get<I>(m_upper_extrap_rules)(coord_eval, spline_coef);
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680 template <
class Layout,
class... CoordsDims>
681 KOKKOS_INLINE_FUNCTION Real
682 eval(
ddc::Coordinate<CoordsDims...> coord_eval,
686 (update_coord_eval<s_idx<BSplines>>(coord_eval), ...);
690 bool const needs_extrapolation
691 = (... || check_needs_extrapolation<s_idx<BSplines>>(coord_eval, spline_coef, res));
693 if (needs_extrapolation) {
699 ddc::Coordinate<
typename BSplines::continuous_dimension_type...>(
700 ddc::get<
typename BSplines::continuous_dimension_type>(coord_eval)...),
704 template <
class BSplinesType,
class... DerivDims,
class CoordDim>
705 KOKKOS_INLINE_FUNCTION
static ddc::DiscreteElement<BSplinesType> get_jmin(
706 ddc::DiscreteElement<DerivDims...>
const& deriv_order,
707 Kokkos::mdspan<Real, Kokkos::extents<std::size_t, BSplinesType::degree() + 1>> vals,
708 ddc::Coordinate<CoordDim>
const& coord_eval)
710 using deriv_dim =
Deriv<
typename BSplinesType::continuous_dimension_type>;
711 using deriv_dims =
TypeSeq<DerivDims...>;
712 if constexpr (!in_tags_v<deriv_dim, deriv_dims>) {
713 return ddc::discrete_space<BSplinesType>().eval_basis(vals, coord_eval);
715 auto const order = deriv_order.
template uid<deriv_dim>();
716 KOKKOS_ASSERT(order > 0 && order <= BSplinesType::degree())
718 std::array<Real, (BSplinesType::degree() + 1) * (BSplinesType::degree() + 1)>
724 BSplinesType::degree() + 1,
725 Kokkos::dynamic_extent>>
const derivs(derivs_ptr.data(), order + 1);
727 auto jmin =
ddc::discrete_space<BSplinesType>()
728 .eval_basis_and_n_derivs(derivs, coord_eval, order);
730 for (std::size_t i = 0; i < BSplinesType::degree() + 1; ++i) {
731 vals[i] = DDC_MDSPAN_ACCESS_OP(derivs, i, order);
738 template <std::size_t N,
class Functor,
class... Is>
739 KOKKOS_INLINE_FUNCTION
static void for_each(
740 std::array<std::size_t, N>
const& bounds,
744 static constexpr std::size_t I =
sizeof...(Is);
745 if constexpr (I == N) {
746 f(std::array<std::size_t, N> {is...});
748 for (std::size_t i = 0; i < bounds[I]; ++i) {
749 for_each(bounds, f, is..., i);
755
756
757
758
759
760
761
762 template <
class... DerivDims,
class Layout,
class... CoordsDims>
763 KOKKOS_INLINE_FUNCTION Real eval_no_bc(
764 ddc::DiscreteElement<DerivDims...>
const& deriv_order,
765 ddc::Coordinate<CoordsDims...>
const& coord_eval,
775 "The only valid dimensions for deriv_order are Deriv<Dim1>, Deriv<Dim2>, ..., "
778 auto vals_ptr = cexa::make_tuple(std::array<Real, BSplines::degree() + 1> {}...);
779 auto const vals = cexa::make_tuple(
780 Kokkos::mdspan<Real, Kokkos::extents<std::size_t, BSplines::degree() + 1>>(
781 cexa::get<s_idx<BSplines>>(vals_ptr).data())...);
783 auto const jmin = cexa::make_tuple(
786 cexa::get<s_idx<BSplines>>(vals),
787 ddc::Coordinate<
typename BSplines::continuous_dimension_type>(
792 std::array<std::size_t, dimension> {(BSplines::degree() + 1)...},
793 [&](std::array<std::size_t, dimension> idx) {
795 ddc::DiscreteElement<BSplines...>(
796 (cexa::get<s_idx<BSplines>>(jmin)
797 + idx[s_idx<BSplines>])...))
798 * (cexa::get<s_idx<BSplines>>(vals)[idx[s_idx<BSplines>]] * ...);
friend class DiscreteDomain
KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteElement()=default
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.
Helper class for the initialisation of the mesh of 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.
A class for creating a 2D spline approximation of a function.
SplineBuilder2D(BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder2D acting on the interpolation domain contained in batched_interpolation_domain.
void operator()(ddc::ChunkSpan< Real, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< Real const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min1=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max1=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2=std::nullopt) const
Compute a 2D spline approximation of a function.
SplineBuilder2D & operator=(SplineBuilder2D const &x)=delete
Copy-assignment is deleted.
SplineBuilder2D(std::string const &label, BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder2D acting on the interpolation domain contained in batched_interpolation_domain.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 2D interpolation mesh used by this class.
SplineBuilder2D(SplineBuilder2D &&x)=default
Move-constructs.
batched_spline_domain_type< BatchedInterpolationDDom > batched_spline_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which spline coefficients are defined.
SplineBuilder2D(interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder2D acting on interpolation_domain.
~SplineBuilder2D()=default
Destructs.
SplineBuilder2D(std::string const &label, interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder2D acting on interpolation_domain.
ddc::DiscreteDomain< bsplines_type1, bsplines_type2 > spline_domain() const noexcept
Get the 2D domain on which spline coefficients are defined.
SplineBuilder2D(SplineBuilder2D const &x)=delete
Copy-constructor is deleted.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
SplineBuilder2D & operator=(SplineBuilder2D &&x)=default
Move-assigns.
A class for creating a 3D spline approximation of a function.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
SplineBuilder3D(interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder3D acting on interpolation_domain.
SplineBuilder3D(std::string label, BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder3D acting on the interpolation domain contained in batched_interpolation_domain.
SplineBuilder3D & operator=(SplineBuilder3D &&x)=default
Move-assigns.
batched_spline_domain_type< BatchedInterpolationDDom > batched_spline_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which spline coefficients are defined.
ddc::DiscreteDomain< bsplines_type1, bsplines_type2, bsplines_type3 > spline_domain() const noexcept
Get the 3D domain on which spline coefficients are defined.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 3D interpolation mesh used by this class.
~SplineBuilder3D()=default
Destructs.
SplineBuilder3D & operator=(SplineBuilder3D const &x)=delete
Copy-assignment is deleted.
SplineBuilder3D(BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder3D acting on the interpolation domain contained in batched_interpolation_domain.
void operator()(ddc::ChunkSpan< Real, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< Real const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min1=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max1=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type3< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type3< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max2_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2_max3=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2_max3=std::nullopt) const
Compute a 3D spline approximation of a function.
SplineBuilder3D(std::string label, interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder3D acting on interpolation_domain.
SplineBuilder3D(SplineBuilder3D const &x)=delete
Copy-constructor is deleted.
SplineBuilder3D(SplineBuilder3D &&x)=default
Move-constructs.
A class for creating a spline approximation of a function.
std::tuple< ddc::Chunk< Real, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< Real, OutMemorySpace > >, ddc::Chunk< Real, ddc::DiscreteDomain< InterpolationDDim >, ddc::KokkosAllocator< Real, OutMemorySpace > >, ddc::Chunk< Real, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< Real, OutMemorySpace > > > quadrature_coefficients() const
Compute the quadrature coefficients associated to the b-splines used by this SplineBuilder.
ddc::DiscreteDomain< bsplines_type > spline_domain() const noexcept
Get the 1D domain on which spline coefficients are defined.
SplineBuilder(BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on the interpolation domain contained by batched_interpolation_domain.
SplineBuilder(SplineBuilder const &x)=delete
Copy-constructor is deleted.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 1D interpolation mesh used by this class.
batched_derivs_domain_type< BatchedInterpolationDDom > batched_derivs_xmax_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which derivatives on upper boundary are defined.
static constexpr int s_nbe_xmin
The number of equations defining the closure relation at the lower bound.
static constexpr ddc::SplineBuilderClosure s_sbc_xmin
The closure relation implemented at the lower bound.
SplineBuilder(std::string label, BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on the interpolation domain contained by batched_interpolation_domain.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
SplineBuilder & operator=(SplineBuilder &&x)=default
Move-assigns.
static constexpr int s_nbe_xmax
The number of equations defining the closure relation at the upper bound.
static constexpr SplineSolver s_spline_solver
The SplineSolver giving the backend used to perform the spline approximation.
static constexpr ddc::SplineBuilderClosure s_sbc_xmax
The closure relation implemented at the upper bound.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
batched_spline_domain_type< BatchedInterpolationDDom > batched_spline_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which spline coefficients are defined.
SplineBuilder(interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on interpolation_domain.
static constexpr bool s_odd
Indicates if the degree of the splines is odd or even.
void operator()(ddc::ChunkSpan< Real, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< Real const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > derivs_xmin=std::nullopt, std::optional< ddc::ChunkSpan< Real const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > derivs_xmax=std::nullopt) const
Compute a spline approximation of a function.
batched_derivs_domain_type< BatchedInterpolationDDom > batched_derivs_xmin_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which derivatives on lower boundary are defined.
SplineBuilder(std::string label, interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on interpolation_domain.
SplineBuilder(SplineBuilder &&x)=default
Move-constructs.
static constexpr int s_nbv_xmax
The number of input values defining the closure relation at the upper bound.
~SplineBuilder()=default
Destructs.
static constexpr int s_nbv_xmin
The number of input values defining the closure relation at the lower bound.
SplineBuilder & operator=(SplineBuilder const &x)=delete
Copy-assignment is deleted.
A class to evaluate, differentiate or integrate a 2D spline function.
SplineEvaluator2D(SplineEvaluator2D &&x)=default
Move-constructs.
lower_extrapolation_rule_1_type lower_extrapolation_rule_dim_1() const
Get the lower extrapolation rule along the first dimension.
void integrate(ddc::ChunkSpan< Real, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< Real const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
Perform batched 2D integrations of a spline function (described by its spline coefficients) along the...
SplineEvaluator2D & operator=(SplineEvaluator2D const &x)=default
Copy-assigns.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Differentiate 2D spline function (described by its spline coefficients) on a mesh along the dimension...
SplineEvaluator2D(SplineEvaluator2D const &x)=default
Copy-constructs.
~SplineEvaluator2D()=default
Destructs.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Evaluate 2D spline function (described by its spline coefficients) on a mesh.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Evaluate 2D spline function (described by its spline coefficients) on a mesh.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Differentiate 2D spline function (described by its spline coefficients) on a mesh along the dimension...
KOKKOS_FUNCTION Real deriv(DElem const &deriv_order, ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Differentiate 2D spline function (described by its spline coefficients) at a given coordinate along t...
upper_extrapolation_rule_2_type upper_extrapolation_rule_dim_2() const
Get the upper extrapolation rule along the second dimension.
KOKKOS_FUNCTION Real operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Evaluate 2D spline function (described by its spline coefficients) at a given coordinate.
upper_extrapolation_rule_1_type upper_extrapolation_rule_dim_1() const
Get the upper extrapolation rule along the first dimension.
lower_extrapolation_rule_2_type lower_extrapolation_rule_dim_2() const
Get the lower extrapolation rule along the second dimension.
SplineEvaluator2D & operator=(SplineEvaluator2D &&x)=default
Move-assigns.
SplineEvaluator2D(LowerExtrapolationRule1 const &lower_extrap_rule1, UpperExtrapolationRule1 const &upper_extrap_rule1, LowerExtrapolationRule2 const &lower_extrap_rule2, UpperExtrapolationRule2 const &upper_extrap_rule2)
Build a SplineEvaluator2D acting on batched_spline_domain.
A class to evaluate, differentiate or integrate a 3D spline function.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Evaluate 3D spline function (described by its spline coefficients) on a mesh.
KOKKOS_FUNCTION Real deriv(DElem const &deriv_order, ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Differentiate 3D spline function (described by its spline coefficients) at a given coordinate along t...
upper_extrapolation_rule_1_type upper_extrapolation_rule_dim_1() const
Get the upper extrapolation rule along the first dimension.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Differentiate 3D spline function (described by its spline coefficients) on a mesh along the dimension...
KOKKOS_FUNCTION Real operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Evaluate 3D spline function (described by its spline coefficients) at a given coordinate.
SplineEvaluator3D & operator=(SplineEvaluator3D &&x)=default
Move-assigns.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Differentiate 3D spline function (described by its spline coefficients) on a mesh along the dimension...
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Evaluate 3D spline function (described by its spline coefficients) on a mesh.
upper_extrapolation_rule_3_type upper_extrapolation_rule_dim_3() const
Get the upper extrapolation rule along the third dimension.
SplineEvaluator3D(LowerExtrapolationRule1 const &lower_extrap_rule1, UpperExtrapolationRule1 const &upper_extrap_rule1, LowerExtrapolationRule2 const &lower_extrap_rule2, UpperExtrapolationRule2 const &upper_extrap_rule2, LowerExtrapolationRule3 const &lower_extrap_rule3, UpperExtrapolationRule3 const &upper_extrap_rule3)
Build a SplineEvaluator3D acting on batched_spline_domain.
~SplineEvaluator3D()=default
Destructs.
lower_extrapolation_rule_1_type lower_extrapolation_rule_dim_1() const
Get the lower extrapolation rule along the first dimension.
upper_extrapolation_rule_2_type upper_extrapolation_rule_dim_2() const
Get the upper extrapolation rule along the second dimension.
SplineEvaluator3D(SplineEvaluator3D const &x)=default
Copy-constructs.
lower_extrapolation_rule_3_type lower_extrapolation_rule_dim_3() const
Get the lower extrapolation rule along the third dimension.
SplineEvaluator3D(SplineEvaluator3D &&x)=default
Move-constructs.
lower_extrapolation_rule_2_type lower_extrapolation_rule_dim_2() const
Get the lower extrapolation rule along the second dimension.
SplineEvaluator3D & operator=(SplineEvaluator3D const &x)=default
Copy-assigns.
void integrate(ddc::ChunkSpan< Real, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< Real const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
Perform batched 3D integrations of a spline function (described by its spline coefficients) along the...
KOKKOS_FUNCTION Real deriv(DElem const &deriv_order, ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, ddc::DiscreteDomain< BSplines... >, Layout, memory_space > const spline_coef) const
Differentiate ND spline function (described by its spline coefficients) at a given coordinate along s...
~SplineEvaluatorND()=default
Destructs.
SplineEvaluatorND(ExtrapolationRule const &... extrap_rules)
Build a SplineEvaluatorND acting on batched_spline_domain.
SplineEvaluatorND & operator=(SplineEvaluatorND const &x)=default
Copy-assigns.
auto upper_extrapolation_rule() const
Get the upper extrapolation rule along the Ith dimension.
SplineEvaluatorND & operator=(SplineEvaluatorND &&x)=default
Move-assigns.
KOKKOS_FUNCTION Real operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, ddc::DiscreteDomain< BSplines... >, Layout, memory_space > const spline_coef) const
Evaluate ND spline function (described by its spline coefficients) at a given coordinate.
auto lower_extrapolation_rule() const
Get the lower extrapolation rule along the Ith dimension.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Differentiate spline function (described by its spline coefficients) on a mesh along specified dimens...
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Evaluate ND spline function (described by its spline coefficients) on a mesh.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Evaluate ND spline function (described by its spline coefficients) on a mesh.
SplineEvaluatorND(SplineEvaluatorND const &x)=default
Copy-constructs.
void integrate(ddc::ChunkSpan< Real, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< Real const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
Perform batched ND integrations of a spline function (described by its spline coefficients) along the...
SplineEvaluatorND(SplineEvaluatorND &&x)=default
Move-constructs.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Differentiate spline function (described by its spline coefficients) on a mesh along specified dimens...
A class to evaluate, differentiate or integrate a spline function.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Differentiate 1D spline function (described by its spline coefficients) on a mesh.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Evaluate a spline function (described by its spline coefficients) on a mesh.
upper_extrapolation_rule_type upper_extrapolation_rule() const
Get the upper extrapolation rule.
SplineEvaluator & operator=(SplineEvaluator const &x)=default
Copy-assigns.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
Differentiate 1D spline function (described by its spline coefficients) on a mesh.
SplineEvaluator & operator=(SplineEvaluator &&x)=default
Move-assigns.
void operator()(ddc::ChunkSpan< Real, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< Real const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Evaluate spline function (described by its spline coefficients) on a mesh.
KOKKOS_FUNCTION Real operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.
SplineEvaluator(LowerExtrapolationRule const &lower_extrap_rule, UpperExtrapolationRule const &upper_extrap_rule)
Build a SplineEvaluator acting on batched_spline_domain.
lower_extrapolation_rule_type lower_extrapolation_rule() const
Get the lower extrapolation rule.
SplineEvaluator(SplineEvaluator const &x)=default
Copy-constructs.
SplineEvaluator(SplineEvaluator &&x)=default
Move-constructs.
KOKKOS_FUNCTION Real deriv(DElem const &deriv_order, ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< Real const, spline_domain_type, Layout, memory_space > const spline_coef) const
Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.
void integrate(ddc::ChunkSpan< Real, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< Real const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
Perform batched 1D integrations of a spline function (described by its spline coefficients) along the...
~SplineEvaluator()=default
Destructs.
The top-level namespace of DDC.
constexpr bool is_uniform_bsplines_v
Indicates if a tag corresponds to uniform B-splines or not.
SplineSolver
An enum determining the backend solver of a SplineBuilder or SplineBuilder2d.
@ LAPACK
Enum member to identify the LAPACK-based solver (direct method)
@ GINKGO
Enum member to identify the Ginkgo-based solver (iterative method)
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)
If the type DDim is a B-spline, defines type to the discrete dimension of the associated knots.
A compile-time sequence of types.
A templated struct representing a discrete dimension storing the derivatives of a function along a co...