13#include <Kokkos_Core.hpp>
22
23
24
25
26
27
28
29
30
31
32
38 class LowerExtrapolationRule,
39 class UpperExtrapolationRule>
44 using exec_space = ExecSpace;
47 using memory_space = MemorySpace;
50 using continuous_dimension_type =
typename BSplines::continuous_dimension_type;
53 using evaluation_discrete_dimension_type = EvaluationDDim;
56 using bsplines_type = BSplines;
59 using evaluation_domain_type =
ddc::
DiscreteDomain<evaluation_discrete_dimension_type>;
62
63
64
65
66 template <concepts::discrete_domain BatchedInterpolationDDom>
67 using batched_evaluation_domain_type = BatchedInterpolationDDom;
73
74
75
76
77
78 template <concepts::discrete_domain BatchedInterpolationDDom>
79 using batch_domain_type
80 =
ddc::remove_dims_of_t<BatchedInterpolationDDom, evaluation_discrete_dimension_type>;
83
84
85
86
87
88 template <concepts::discrete_domain BatchedInterpolationDDom>
89 using batched_spline_domain_type =
ddc::replace_dim_of_t<
90 BatchedInterpolationDDom,
91 evaluation_discrete_dimension_type,
95 using lower_extrapolation_rule_type = LowerExtrapolationRule;
98 using upper_extrapolation_rule_type = UpperExtrapolationRule;
102 LowerExtrapolationRule m_lower_extrap_rule;
104 UpperExtrapolationRule m_upper_extrap_rule;
108 std::is_same_v<LowerExtrapolationRule,
110 == bsplines_type::is_periodic()
112 UpperExtrapolationRule,
114 == bsplines_type::is_periodic(),
115 "PeriodicExtrapolationRule has to be used if and only if dimension is periodic");
117 std::is_invocable_r_v<
119 LowerExtrapolationRule,
120 ddc::Coordinate<continuous_dimension_type>,
124 Kokkos::layout_right,
126 "LowerExtrapolationRule::operator() has to be callable with usual arguments.");
128 std::is_invocable_r_v<
130 UpperExtrapolationRule,
131 ddc::Coordinate<continuous_dimension_type>,
135 Kokkos::layout_right,
137 "UpperExtrapolationRule::operator() has to be callable with usual arguments.");
140
141
142
143
144
145
146
148 LowerExtrapolationRule
const& lower_extrap_rule,
149 UpperExtrapolationRule
const& upper_extrap_rule)
150 : m_lower_extrap_rule(lower_extrap_rule)
151 , m_upper_extrap_rule(upper_extrap_rule)
156
157
158
159
163
164
165
166
173
174
175
176
177
181
182
183
184
185
189
190
191
192
193
194
195
196
199 return m_lower_extrap_rule;
203
204
205
206
207
208
209
210
213 return m_upper_extrap_rule;
217
218
219
220
221
222
223
224
225
226
227
228 template <
class Layout,
class... CoordsDims>
230 ddc::Coordinate<CoordsDims...>
const& coord_eval,
231 ddc::
ChunkSpan<
double const, spline_domain_type, Layout, memory_space>
const
234 return eval(coord_eval, spline_coef);
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
261 class BatchedInterpolationDDom,
264 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
267 ddc::Coordinate<CoordsDims...>
const,
268 BatchedInterpolationDDom,
270 memory_space>
const coords_eval,
273 batched_spline_domain_type<BatchedInterpolationDDom>,
275 memory_space>
const spline_coef)
const
277 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
278 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
280 ddc::parallel_for_each(
281 "ddc_splines_evaluate",
285 typename batch_domain_type<
286 BatchedInterpolationDDom>::discrete_element_type
const j) {
287 auto const spline_eval_1D = spline_eval[j];
288 auto const coords_eval_1D = coords_eval[j];
289 auto const spline_coef_1D = spline_coef[j];
290 for (
auto const i : evaluation_domain) {
291 spline_eval_1D(i) = eval(coords_eval_1D(i), spline_coef_1D);
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314 template <
class Layout1,
class Layout2,
class BatchedInterpolationDDom>
316 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
320 batched_spline_domain_type<BatchedInterpolationDDom>,
322 memory_space>
const spline_coef)
const
324 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
325 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
327 ddc::parallel_for_each(
328 "ddc_splines_evaluate",
332 typename batch_domain_type<
333 BatchedInterpolationDDom>::discrete_element_type
const j) {
334 auto const spline_eval_1D = spline_eval[j];
335 auto const spline_coef_1D = spline_coef[j];
336 for (
auto const i : evaluation_domain) {
337 ddc::Coordinate<continuous_dimension_type> coord_eval_1D
338 =
ddc::coordinate(i);
339 spline_eval_1D(i) = eval(coord_eval_1D, spline_coef_1D);
346
347
348
349
350
351
352
353
354
355
356 template <
class Layout,
class... CoordsDims>
357 [[deprecated(
"Use deriv(DiscreteElement<Deriv<Dim>>(1), ...) instead")]] KOKKOS_FUNCTION
double
358 deriv(
ddc::Coordinate<CoordsDims...>
const& coord_eval,
359 ddc::
ChunkSpan<
double const, spline_domain_type, Layout, memory_space>
const spline_coef)
363 ddc::DiscreteElement<
Deriv<continuous_dimension_type>>(1),
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
390 class BatchedInterpolationDDom,
392 [[deprecated(
"Use deriv(DiscreteElement<Deriv<Dim>>(1), ...) instead")]]
void deriv(
393 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
396 ddc::Coordinate<CoordsDims...>
const,
397 BatchedInterpolationDDom,
399 memory_space>
const coords_eval,
402 batched_spline_domain_type<BatchedInterpolationDDom>,
404 memory_space>
const spline_coef)
const
407 ddc::DiscreteElement<
Deriv<continuous_dimension_type>>(1),
414
415
416
417
418
419
420
421
422
423
424
425
426
427 template <
class Layout1,
class Layout2,
class BatchedInterpolationDDom>
428 [[deprecated(
"Use deriv(DiscreteElement<Deriv<Dim>>(1), ...) instead")]]
void deriv(
429 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
433 batched_spline_domain_type<BatchedInterpolationDDom>,
435 memory_space>
const spline_coef)
const
438 ddc::DiscreteElement<
Deriv<continuous_dimension_type>>(1),
445
446
447
448
449
450
451
452
453
454
455
456
457 template <
class DElem,
class Layout,
class... CoordsDims>
458 KOKKOS_FUNCTION
double deriv(
459 DElem
const& deriv_order,
460 ddc::Coordinate<CoordsDims...>
const& coord_eval,
461 ddc::
ChunkSpan<
double const, spline_domain_type, Layout, memory_space>
const
464 static_assert(is_discrete_element_v<DElem>);
465 return eval_no_bc(deriv_order, coord_eval, spline_coef);
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
493 class BatchedInterpolationDDom,
496 DElem
const& deriv_order,
497 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
500 ddc::Coordinate<CoordsDims...>
const,
501 BatchedInterpolationDDom,
503 memory_space>
const coords_eval,
506 batched_spline_domain_type<BatchedInterpolationDDom>,
508 memory_space>
const spline_coef)
const
510 static_assert(is_discrete_element_v<DElem>);
512 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
513 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
515 ddc::parallel_for_each(
516 "ddc_splines_differentiate",
520 typename batch_domain_type<
521 BatchedInterpolationDDom>::discrete_element_type
const j) {
522 auto const spline_eval_1D = spline_eval[j];
523 auto const coords_eval_1D = coords_eval[j];
524 auto const spline_coef_1D = spline_coef[j];
525 for (
auto const i : evaluation_domain) {
527 = eval_no_bc(deriv_order, coords_eval_1D(i), spline_coef_1D);
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547 template <
class DElem,
class Layout1,
class Layout2,
class BatchedInterpolationDDom>
549 DElem
const& deriv_order,
550 ddc::
ChunkSpan<
double, BatchedInterpolationDDom, Layout1, memory_space>
const
554 batched_spline_domain_type<BatchedInterpolationDDom>,
556 memory_space>
const spline_coef)
const
558 static_assert(is_discrete_element_v<DElem>);
560 evaluation_domain_type
const evaluation_domain(spline_eval.domain());
561 batch_domain_type<BatchedInterpolationDDom>
const batch_domain(spline_eval.domain());
563 ddc::parallel_for_each(
564 "ddc_splines_differentiate",
568 typename batch_domain_type<
569 BatchedInterpolationDDom>::discrete_element_type
const j) {
570 auto const spline_eval_1D = spline_eval[j];
571 auto const spline_coef_1D = spline_coef[j];
572 for (
auto const i : evaluation_domain) {
573 ddc::Coordinate<continuous_dimension_type> coord_eval_1D
574 =
ddc::coordinate(i);
575 spline_eval_1D(i) = eval_no_bc(deriv_order, coord_eval_1D, spline_coef_1D);
581
582
583
584
585
586
587
588
589
590
591
592
593 template <
class Layout1,
class Layout2,
class BatchedDDom,
class BatchedSplineDDom>
595 ddc::
ChunkSpan<
double, BatchedDDom, Layout1, memory_space>
const integrals,
596 ddc::
ChunkSpan<
double const, BatchedSplineDDom, Layout2, memory_space>
const
600 ddc::in_tags_v<bsplines_type, to_type_seq_t<BatchedSplineDDom>>,
601 "The spline coefficients domain must contain the bsplines dimension");
602 using batch_domain_type =
ddc::remove_dims_of_t<BatchedSplineDDom, bsplines_type>;
604 std::is_same_v<batch_domain_type, BatchedDDom>,
605 "The integrals domain must only contain the batch dimensions");
607 BatchedDDom
const batch_domain(integrals.domain());
612 ddc::integrals(exec_space(), values);
614 ddc::parallel_for_each(
615 "ddc_splines_integrate",
618 KOKKOS_LAMBDA(
typename BatchedDDom::discrete_element_type
const j) {
620 for (
typename spline_domain_type::discrete_element_type
const i :
622 integrals(j) += spline_coef(i, j) * values(i);
628 template <
class Layout,
class... CoordsDims>
629 KOKKOS_INLINE_FUNCTION
double eval(
630 ddc::Coordinate<CoordsDims...>
const& coord_eval,
631 ddc::
ChunkSpan<
double const, spline_domain_type, Layout, memory_space>
const
634 ddc::Coordinate<continuous_dimension_type> coord_eval_interest(coord_eval);
635 if constexpr (bsplines_type::is_periodic()) {
636 if (coord_eval_interest <
ddc::discrete_space<bsplines_type>().rmin()
637 || coord_eval_interest >
ddc::discrete_space<bsplines_type>().rmax()) {
638 coord_eval_interest -= Kokkos::floor(
640 -
ddc::discrete_space<bsplines_type>().rmin())
641 /
ddc::discrete_space<bsplines_type>().length())
642 *
ddc::discrete_space<bsplines_type>().length();
645 if (coord_eval_interest <
ddc::discrete_space<bsplines_type>().rmin()) {
646 return m_lower_extrap_rule(coord_eval_interest, spline_coef);
648 if (coord_eval_interest >
ddc::discrete_space<bsplines_type>().rmax()) {
649 return m_upper_extrap_rule(coord_eval_interest, spline_coef);
652 return eval_no_bc(
ddc::DiscreteElement
<>(), coord_eval_interest, spline_coef);
655 template <
class... DerivDims,
class Layout,
class... CoordsDims>
656 KOKKOS_INLINE_FUNCTION
double eval_no_bc(
657 ddc::DiscreteElement<DerivDims...>
const& deriv_order,
658 ddc::Coordinate<CoordsDims...>
const& coord_eval,
659 ddc::
ChunkSpan<
double const, spline_domain_type, Layout, memory_space>
const
662 using deriv_dim =
ddc::
Deriv<continuous_dimension_type>;
664 sizeof...(DerivDims) == 0
666 detail::TypeSeq<DerivDims...>,
667 detail::TypeSeq<deriv_dim>>,
668 "The only valid dimension for deriv_order is Deriv<Dim>");
670 ddc::DiscreteElement<bsplines_type> jmin;
671 std::array<
double, bsplines_type::degree() + 1> vals_ptr;
672 Kokkos::mdspan<
double, Kokkos::extents<std::size_t, bsplines_type::degree() + 1>>
const
673 vals(vals_ptr.data());
674 ddc::Coordinate<continuous_dimension_type>
const coord_eval_interest(coord_eval);
676 if constexpr (
sizeof...(DerivDims) == 0) {
677 jmin =
ddc::discrete_space<bsplines_type>().eval_basis(vals, coord_eval_interest);
679 auto const order = deriv_order.uid();
680 KOKKOS_ASSERT(order > 0 && order <= bsplines_type::degree())
682 std::array<
double, (bsplines_type::degree() + 1) * (bsplines_type::degree() + 1)>
688 bsplines_type::degree() + 1,
689 Kokkos::dynamic_extent>>
const derivs(derivs_ptr.data(), order + 1);
691 jmin =
ddc::discrete_space<bsplines_type>()
692 .eval_basis_and_n_derivs(derivs, coord_eval_interest, order);
694 for (std::size_t i = 0; i < bsplines_type::degree() + 1; ++i) {
695 vals[i] = DDC_MDSPAN_ACCESS_OP(derivs, i, order);
700 for (std::size_t i = 0; i < bsplines_type::degree() + 1; ++i) {
701 y += spline_coef(
ddc::DiscreteElement<bsplines_type>(jmin + i)) * vals[i];
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.
void operator()(ddc::ChunkSpan< double, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< double const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min1=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max1=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2=std::nullopt) const
Compute a 2D spline approximation of a function.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
ddc::DiscreteDomain< bsplines_type1, bsplines_type2 > spline_domain() const noexcept
Get the 2D domain on which spline coefficients are defined.
SplineBuilder2D(SplineBuilder2D &&x)=default
Move-constructs.
SplineBuilder2D & operator=(SplineBuilder2D &&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.
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.
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(SplineBuilder2D const &x)=delete
Copy-constructor is deleted.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 2D interpolation mesh used by this class.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
SplineBuilder2D & operator=(SplineBuilder2D const &x)=delete
Copy-assignment is deleted.
A class for creating a 3D spline approximation of a function.
SplineBuilder3D(SplineBuilder3D const &x)=delete
Copy-constructor is deleted.
void operator()(ddc::ChunkSpan< double, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< double const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min1=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max1=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type3< BatchedInterpolationDDom >, Layout, memory_space > > derivs_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type3< BatchedInterpolationDDom >, Layout, memory_space > > derivs_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_2< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type2_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max2_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type1_3< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_max2_min3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_max1_min2_max3=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > mixed_derivs_min1_max2_max3=std::nullopt, std::optional< ddc::ChunkSpan< double 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.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
~SplineBuilder3D()=default
Destructs.
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.
ddc::DiscreteDomain< bsplines_type1, bsplines_type2, bsplines_type3 > spline_domain() const noexcept
Get the 3D domain on which spline coefficients are defined.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 3D interpolation mesh used by this class.
SplineBuilder3D & operator=(SplineBuilder3D const &x)=delete
Copy-assignment is deleted.
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(SplineBuilder3D &&x)=default
Move-constructs.
SplineBuilder3D & operator=(SplineBuilder3D &&x)=default
Move-assigns.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
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.
A class for creating a spline approximation of a function.
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 SplineSolver s_spline_solver
The SplineSolver giving the backend used to perform the spline approximation.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
std::tuple< ddc::Chunk< double, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< double, OutMemorySpace > >, ddc::Chunk< double, ddc::DiscreteDomain< InterpolationDDim >, ddc::KokkosAllocator< double, OutMemorySpace > >, ddc::Chunk< double, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< double, OutMemorySpace > > > quadrature_coefficients() const
Compute the quadrature coefficients associated to the b-splines used by this SplineBuilder.
SplineBuilder & operator=(SplineBuilder const &x)=delete
Copy-assignment is deleted.
SplineBuilder(SplineBuilder &&x)=default
Move-constructs.
static constexpr int s_nbe_xmax
The number of equations defining the boundary condition at the upper bound.
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 ddc::BoundCond s_bc_xmin
The boundary condition implemented at the lower bound.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
SplineBuilder & operator=(SplineBuilder &&x)=default
Move-assigns.
SplineBuilder(SplineBuilder const &x)=delete
Copy-constructor is deleted.
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.
static constexpr int s_nbv_xmax
The number of input values defining the boundary condition at the upper bound.
static constexpr bool s_odd
Indicates if the degree of the splines is odd or even.
static constexpr int s_nbv_xmin
The number of input values defining the boundary condition at the lower bound.
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_xmin_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which derivatives on lower boundary are defined.
static constexpr ddc::BoundCond s_bc_xmax
The boundary condition implemented at the upper bound.
void operator()(ddc::ChunkSpan< double, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > spline, ddc::ChunkSpan< double const, BatchedInterpolationDDom, Layout, memory_space > vals, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > derivs_xmin=std::nullopt, std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > derivs_xmax=std::nullopt) const
Compute a spline approximation of a function.
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_type > spline_domain() const noexcept
Get the 1D domain on which spline coefficients are defined.
~SplineBuilder()=default
Destructs.
static constexpr int s_nbe_xmin
The number of equations defining the boundary condition at the lower bound.
A class to evaluate, differentiate or integrate a spline function.
void operator()(ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
Evaluate 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.
SplineEvaluator & operator=(SplineEvaluator &&x)=default
Move-assigns.
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.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double 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.
KOKKOS_FUNCTION double operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.
KOKKOS_FUNCTION double deriv(DElem const &deriv_order, ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.
SplineEvaluator(SplineEvaluator const &x)=default
Copy-constructs.
SplineEvaluator(SplineEvaluator &&x)=default
Move-constructs.
void deriv(DElem const &deriv_order, ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double 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 integrate(ddc::ChunkSpan< double, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< double const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
Perform batched 1D integrations of a spline function (described by its spline coefficients) along the...
void operator()(ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double 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.
~SplineEvaluator()=default
Destructs.
#define DDC_BUILD_DEPRECATED_CODE
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.
@ HOMOGENEOUS_HERMITE
Homogeneous Hermite boundary condition (derivatives are 0)
@ 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.
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 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...
If the type DDim is a B-spline, defines type to the discrete dimension of the associated knots.