DDC 0.14.0
Loading...
Searching...
No Matches
spline_builder_3d.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 <cassert>
8#include <cstddef>
9#include <optional>
10#include <string>
11#include <utility>
12
13#include <ddc/ddc.hpp>
14
18
19namespace ddc {
20
21/**
22 * @brief A class for creating a 3D spline approximation of a function.
23 *
24 * A class which contains an operator () which can be used to build a 3D spline approximation
25 * of a function. A 3D spline approximation uses a cross-product between three 1D SplineBuilder.
26 *
27 * @see SplineBuilder
28 */
29template <
30 class ExecSpace,
31 class MemorySpace,
32 class BSpline1,
33 class BSpline2,
34 class BSpline3,
35 class DDimI1,
36 class DDimI2,
37 class DDimI3,
38 ddc::BoundCond BcLower1,
39 ddc::BoundCond BcUpper1,
40 ddc::BoundCond BcLower2,
41 ddc::BoundCond BcUpper2,
42 ddc::BoundCond BcLower3,
43 ddc::BoundCond BcUpper3,
44 ddc::SplineSolver Solver>
46{
47public:
48 /// @brief The type of the Kokkos execution space used by this class.
49 using exec_space = ExecSpace;
50
51 /// @brief The type of the Kokkos memory space used by this class.
52 using memory_space = MemorySpace;
53
54 /// @brief The type of the SplineBuilder used by this class to spline-approximate along first dimension.
55 using builder_type1 = ddc::
56 SplineBuilder<ExecSpace, MemorySpace, BSpline1, DDimI1, BcLower1, BcUpper1, Solver>;
57
58 /// @brief The type of SplineBuilder used by this class to spline-approximate along the second and third dimensions.
59 using builder_type_2_3 = ddc::SplineBuilder2D<
60 ExecSpace,
61 MemorySpace,
62 BSpline2,
63 BSpline3,
64 DDimI2,
65 DDimI3,
66 BcLower2,
67 BcUpper2,
68 BcLower3,
69 BcUpper3,
70 Solver>;
71
72 /// @brief The type of the first interpolation continuous dimension.
73 using continuous_dimension_type1 = builder_type1::continuous_dimension_type;
74
75 /// @brief The type of the second interpolation continuous dimension.
76 using continuous_dimension_type2 = builder_type_2_3::continuous_dimension_type1;
77
78 /// @brief The type of the third interpolation continuous dimension.
79 using continuous_dimension_type3 = builder_type_2_3::continuous_dimension_type2;
80
81 /// @brief The type of the first interpolation discrete dimension.
82 using interpolation_discrete_dimension_type1
83 = builder_type1::interpolation_discrete_dimension_type;
84
85 /// @brief The type of the second interpolation discrete dimension.
86 using interpolation_discrete_dimension_type2
87 = builder_type_2_3::interpolation_discrete_dimension_type1;
88
89 /// @brief The type of the third interpolation discrete dimension.
90 using interpolation_discrete_dimension_type3
91 = builder_type_2_3::interpolation_discrete_dimension_type2;
92
93 /// @brief The type of the B-splines in the first dimension.
94 using bsplines_type1 = builder_type1::bsplines_type;
95
96 /// @brief The type of the B-splines in the second dimension.
97 using bsplines_type2 = builder_type_2_3::bsplines_type1;
98
99 /// @brief The type of the B-splines in the third dimension.
100 using bsplines_type3 = builder_type_2_3::bsplines_type2;
101
102 /// @brief The type of the Deriv domain on boundaries in the first dimension.
103 using deriv_type1 = builder_type1::deriv_type;
104
105 /// @brief The type of the Deriv domain on boundaries in the second dimension.
106 using deriv_type2 = builder_type_2_3::deriv_type1;
107
108 /// @brief The type of the Deriv domain on boundaries in the third dimension.
109 using deriv_type3 = builder_type_2_3::deriv_type2;
110
111 /// @brief The type of the domain for the interpolation mesh in the first dimension.
112 using interpolation_domain_type1 = builder_type1::interpolation_discrete_dimension_type;
113
114 /// @brief The type of the domain for the interpolation mesh in the second dimension.
115 using interpolation_domain_type2 = builder_type_2_3::interpolation_discrete_dimension_type1;
116
117 /// @brief The type of the domain for the interpolation mesh in the third dimension.
118 using interpolation_domain_type3 = builder_type_2_3::interpolation_discrete_dimension_type2;
119
120 /// @brief The type of the domain for the interpolation mesh in the 3D dimension.
121 using interpolation_domain_type = ddc::DiscreteDomain<
122 interpolation_discrete_dimension_type1,
123 interpolation_discrete_dimension_type2,
124 interpolation_discrete_dimension_type3>;
125
126 /**
127 * @brief The type of the whole domain representing interpolation points.
128 *
129 * @tparam The batched discrete domain on which the interpolation points are defined.
130 */
131 template <concepts::discrete_domain BatchedInterpolationDDom>
132 using batched_interpolation_domain_type = BatchedInterpolationDDom;
133
134 /**
135 * @brief The type of the batch domain (obtained by removing the dimensions of interest
136 * from the whole domain).
137 *
138 * @tparam The batched discrete domain on which the interpolation points are defined.
139 *
140 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y and Z,
141 * this is DiscreteDomain<T>.
142 */
143 template <concepts::discrete_domain BatchedInterpolationDDom>
144 using batch_domain_type = ddc::remove_dims_of_t<
145 BatchedInterpolationDDom,
146 interpolation_discrete_dimension_type1,
147 interpolation_discrete_dimension_type2,
148 interpolation_discrete_dimension_type3>;
149
150 /**
151 * @brief The type of the whole spline domain (cartesian product of 3D spline domain
152 * and batch domain) preserving the order of dimensions.
153 *
154 * @tparam The batched discrete domain on which the interpolation points are defined.
155 *
156 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y and Z
157 * (associated to B-splines tags BSplinesX, BSplinesY and BSplinesZ), this is DiscreteDomain<BSplinesX, BSplinesY, BSplinesZ, T>
158 */
159 template <concepts::discrete_domain BatchedInterpolationDDom>
160 using batched_spline_domain_type
161 = ddc::detail::convert_type_seq_to_discrete_domain_t<ddc::type_seq_replace_t<
162 ddc::to_type_seq_t<BatchedInterpolationDDom>,
163 ddc::detail::TypeSeq<
164 interpolation_discrete_dimension_type1,
165 interpolation_discrete_dimension_type2,
166 interpolation_discrete_dimension_type3>,
167 ddc::detail::TypeSeq<bsplines_type1, bsplines_type2, bsplines_type3>>>;
168
169 /**
170 * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain
171 * and the associated batch domain) in the first dimension, preserving the order of dimensions.
172 *
173 * @tparam The batched discrete domain on which the interpolation points are defined.
174 *
175 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y and Z,
176 * this is DiscreteDomain<Deriv<X>, Y, Z, T>.
177 */
178 template <concepts::discrete_domain BatchedInterpolationDDom>
179 using batched_derivs_domain_type1 = ddc::replace_dim_of_t<
180 BatchedInterpolationDDom,
181 interpolation_discrete_dimension_type1,
182 deriv_type1>;
183
184 /**
185 * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain
186 * and the associated batch domain) in the second dimension, preserving the order of dimensions.
187 *
188 * @tparam The batched discrete domain on which the interpolation points are defined.
189 *
190 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y, and Z
191 * this is DiscreteDomain<X, Deriv<Y>, Z, T>.
192 */
193 template <concepts::discrete_domain BatchedInterpolationDDom>
194 using batched_derivs_domain_type2 = ddc::replace_dim_of_t<
195 BatchedInterpolationDDom,
196 interpolation_discrete_dimension_type2,
197 deriv_type2>;
198
199 /**
200 * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain
201 * and the associated batch domain) in the third dimension, preserving the order of dimensions.
202 *
203 * @tparam The batched discrete domain on which the interpolation points are defined.
204 *
205 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y, and Z
206 * this is DiscreteDomain<X, Y, Deriv<Z>, T>.
207 */
208 template <concepts::discrete_domain BatchedInterpolationDDom>
209 using batched_derivs_domain_type3 = ddc::replace_dim_of_t<
210 BatchedInterpolationDDom,
211 interpolation_discrete_dimension_type3,
212 deriv_type3>;
213
214 /**
215 * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain
216 * and the associated batch domain) in the first and second dimensions, preserving the order
217 * of dimensions.
218 *
219 * @tparam The batched discrete domain on which the interpolation points are defined.
220 *
221 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y and Z,
222 * this is DiscreteDomain<Deriv<X>, Deriv<Y>, Z, T>.
223 */
224 template <concepts::discrete_domain BatchedInterpolationDDom>
225 using batched_derivs_domain_type1_2 = ddc::replace_dim_of_t<
226 ddc::replace_dim_of_t<
227 BatchedInterpolationDDom,
228 interpolation_discrete_dimension_type1,
229 deriv_type1>,
230 interpolation_domain_type2,
231 deriv_type2>;
232
233 /**
234 * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain
235 * and the associated batch domain) in the second and third dimensions, preserving the order
236 * of dimensions.
237 *
238 * @tparam The batched discrete domain on which the interpolation points are defined.
239 *
240 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y, and Z
241 * this is DiscreteDomain<X, Deriv<Y>, Deriv<Z>, T>.
242 */
243 template <concepts::discrete_domain BatchedInterpolationDDom>
244 using batched_derivs_domain_type2_3 = ddc::replace_dim_of_t<
245 ddc::replace_dim_of_t<
246 BatchedInterpolationDDom,
247 interpolation_discrete_dimension_type2,
248 deriv_type2>,
249 interpolation_domain_type3,
250 deriv_type3>;
251
252 /**
253 * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain
254 * and the associated batch domain) in the first and third dimensions, preserving the order
255 * of dimensions.
256 *
257 * @tparam The batched discrete domain on which the interpolation points are defined.
258 *
259 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y, and Z
260 * this is DiscreteDomain<Deriv<X>, Y, Deriv<Z>, T>.
261 */
262 template <concepts::discrete_domain BatchedInterpolationDDom>
263 using batched_derivs_domain_type1_3 = ddc::replace_dim_of_t<
264 ddc::replace_dim_of_t<
265 BatchedInterpolationDDom,
266 interpolation_discrete_dimension_type1,
267 deriv_type1>,
268 interpolation_domain_type3,
269 deriv_type3>;
270
271 /**
272 * @brief The type of the whole Derivs domain (cartesian product of the 3D Deriv domain
273 * and the batch domain), preserving the order of dimensions.
274 *
275 * @tparam The batched discrete domain on which the interpolation points are defined.
276 *
277 * Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z,T> and dimensions of interest X, Y and Z,
278 * this is DiscreteDomain<Deriv<X>, Deriv<Y>, Deriv<Z>, T>.
279 */
280 template <concepts::discrete_domain BatchedInterpolationDDom>
281 using batched_derivs_domain_type
282 = ddc::detail::convert_type_seq_to_discrete_domain_t<ddc::type_seq_replace_t<
283 ddc::to_type_seq_t<BatchedInterpolationDDom>,
284 ddc::detail::TypeSeq<
285 interpolation_discrete_dimension_type1,
286 interpolation_discrete_dimension_type2,
287 interpolation_discrete_dimension_type3>,
288 ddc::detail::TypeSeq<deriv_type1, deriv_type2, deriv_type3>>>;
289
290private:
291 builder_type1 m_spline_builder1;
292 builder_type_2_3 m_spline_builder_2_3;
293 std::string m_label;
294
295public:
296 /**
297 * @brief Build a SplineBuilder3D acting on interpolation_domain.
298 *
299 * @param label A label used to tag parallel regions and memory allocations for profiling.
300 *
301 * @param interpolation_domain The domain on which the interpolation points are defined, without the batch dimensions.
302 *
303 * @param cols_per_chunk A parameter used by the slicer (internal to the solver) to define the size
304 * of a chunk of right-hand-sides of the linear problem to be computed in parallel (chunks are treated
305 * by the linear solver one-after-the-other).
306 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
307 *
308 * @param preconditioner_max_block_size A parameter used by the slicer (internal to the solver) to
309 * define the size of a block used by the Block-Jacobi preconditioner.
310 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
311 *
312 * @see SplinesLinearProblemSparse
313 */
314 explicit SplineBuilder3D(
315 std::string label,
316 interpolation_domain_type const& interpolation_domain,
317 std::optional<std::size_t> cols_per_chunk = std::nullopt,
318 std::optional<unsigned int> preconditioner_max_block_size = std::nullopt)
319 : m_spline_builder1(interpolation_domain, cols_per_chunk, preconditioner_max_block_size)
320 , m_spline_builder_2_3(interpolation_domain, cols_per_chunk, preconditioner_max_block_size)
321 , m_label(std::move(label))
322 {
323 }
324
325 /**
326 * @brief Build a SplineBuilder3D acting on interpolation_domain.
327 *
328 * @param interpolation_domain The domain on which the interpolation points are defined, without the batch dimensions.
329 *
330 * @param cols_per_chunk A parameter used by the slicer (internal to the solver) to define the size
331 * of a chunk of right-hand-sides of the linear problem to be computed in parallel (chunks are treated
332 * by the linear solver one-after-the-other).
333 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
334 *
335 * @param preconditioner_max_block_size A parameter used by the slicer (internal to the solver) to
336 * define the size of a block used by the Block-Jacobi preconditioner.
337 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
338 *
339 * @see SplinesLinearProblemSparse
340 */
341 explicit SplineBuilder3D(
342 interpolation_domain_type const& interpolation_domain,
343 std::optional<std::size_t> cols_per_chunk = std::nullopt,
344 std::optional<unsigned int> preconditioner_max_block_size = std::nullopt)
346 "no-label",
347 interpolation_domain,
348 cols_per_chunk,
349 preconditioner_max_block_size)
350 {
351 }
352
353 /**
354 * @brief Build a SplineBuilder3D acting on the interpolation domain contained in batched_interpolation_domain.
355 *
356 * @param label A label used to tag parallel regions and memory allocations for profiling.
357 *
358 * @param batched_interpolation_domain The domain on which the interpolation points are defined.
359 *
360 * @param cols_per_chunk A parameter used by the slicer (internal to the solver) to define the size
361 * of a chunk of right-hand-sides of the linear problem to be computed in parallel (chunks are treated
362 * by the linear solver one-after-the-other).
363 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
364 *
365 * @param preconditioner_max_block_size A parameter used by the slicer (internal to the solver) to
366 * define the size of a block used by the Block-Jacobi preconditioner.
367 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
368 *
369 * @see SplinesLinearProblemSparse
370 */
371 template <concepts::discrete_domain BatchedInterpolationDDom>
372 explicit SplineBuilder3D(
373 std::string label,
374 BatchedInterpolationDDom const& batched_interpolation_domain,
375 std::optional<std::size_t> cols_per_chunk = std::nullopt,
376 std::optional<unsigned int> preconditioner_max_block_size = std::nullopt)
378 std::move(label),
379 interpolation_domain_type(batched_interpolation_domain),
380 cols_per_chunk,
381 preconditioner_max_block_size)
382 {
383 }
384
385 /**
386 * @brief Build a SplineBuilder3D acting on the interpolation domain contained in batched_interpolation_domain.
387 *
388 * @param batched_interpolation_domain The domain on which the interpolation points are defined.
389 *
390 * @param cols_per_chunk A parameter used by the slicer (internal to the solver) to define the size
391 * of a chunk of right-hand-sides of the linear problem to be computed in parallel (chunks are treated
392 * by the linear solver one-after-the-other).
393 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
394 *
395 * @param preconditioner_max_block_size A parameter used by the slicer (internal to the solver) to
396 * define the size of a block used by the Block-Jacobi preconditioner.
397 * This value is optional. If no value is provided then the default value is chosen by the requested solver.
398 *
399 * @see SplinesLinearProblemSparse
400 */
401 template <concepts::discrete_domain BatchedInterpolationDDom>
402 explicit SplineBuilder3D(
403 BatchedInterpolationDDom const& batched_interpolation_domain,
404 std::optional<std::size_t> cols_per_chunk = std::nullopt,
405 std::optional<unsigned int> preconditioner_max_block_size = std::nullopt)
407 "no-label",
408 interpolation_domain_type(batched_interpolation_domain),
409 cols_per_chunk,
410 preconditioner_max_block_size)
411 {
412 }
413
414 /// @brief Copy-constructor is deleted.
415 SplineBuilder3D(SplineBuilder3D const& x) = delete;
416
417 /**
418 * @brief Move-constructs.
419 *
420 * @param x An rvalue to another SplineBuilder3D.
421 */
422 SplineBuilder3D(SplineBuilder3D&& x) = default;
423
424 /// @brief Destructs.
425 ~SplineBuilder3D() = default;
426
427 /// @brief Copy-assignment is deleted.
428 SplineBuilder3D& operator=(SplineBuilder3D const& x) = delete;
429
430 /** @brief Move-assigns.
431 *
432 * @param x An rvalue to another SplineBuilder.
433 * @return A reference to this object.
434 */
436
437 /**
438 * @brief Get the domain for the 3D interpolation mesh used by this class.
439 *
440 * This is 3D because it is defined along the dimensions of interest.
441 *
442 * @return The 3D domain for the interpolation mesh.
443 */
444 interpolation_domain_type interpolation_domain() const noexcept
445 {
446 return ddc::DiscreteDomain<
447 interpolation_domain_type1,
448 interpolation_domain_type2,
449 interpolation_domain_type3>(
450 m_spline_builder1.interpolation_domain(),
451 m_spline_builder_2_3.interpolation_domain());
452 }
453
454 /**
455 * @brief Get the whole domain representing interpolation points.
456 *
457 * Values of the function must be provided on this domain in order
458 * to build a spline representation of the function (cartesian product of 3D interpolation_domain and batch_domain).
459 *
460 * @param batched_interpolation_domain The whole domain on which the interpolation points are defined.
461 *
462 * @return The domain for the interpolation mesh.
463 */
464 template <concepts::discrete_domain BatchedInterpolationDDom>
465 BatchedInterpolationDDom batched_interpolation_domain(
466 BatchedInterpolationDDom const& batched_interpolation_domain) const noexcept
467 {
468 assert(interpolation_domain() == interpolation_domain_type(batched_interpolation_domain));
469 return batched_interpolation_domain;
470 }
471
472 /**
473 * @brief Get the batch domain.
474 *
475 * Obtained by removing the dimensions of interest from the whole interpolation domain.
476 *
477 * @param batched_interpolation_domain The whole domain on which the interpolation points are defined.
478 *
479 * @return The batch domain.
480 */
481 template <concepts::discrete_domain BatchedInterpolationDDom>
482 batch_domain_type<BatchedInterpolationDDom> batch_domain(
483 BatchedInterpolationDDom const& batched_interpolation_domain) const noexcept
484 {
485 assert(interpolation_domain() == interpolation_domain_type(batched_interpolation_domain));
486 return ddc::remove_dims_of(batched_interpolation_domain, interpolation_domain());
487 }
488
489 /**
490 * @brief Get the 3D domain on which spline coefficients are defined.
491 *
492 * The 3D spline domain corresponding to the dimensions of interest.
493 *
494 * @return The 3D domain for the spline coefficients.
495 */
496 ddc::DiscreteDomain<bsplines_type1, bsplines_type2, bsplines_type3> spline_domain()
497 const noexcept
498 {
499 return ddc::DiscreteDomain<bsplines_type1, bsplines_type2, bsplines_type3>(
500 ddc::discrete_space<bsplines_type1>().full_domain(),
501 ddc::discrete_space<bsplines_type2>().full_domain(),
502 ddc::discrete_space<bsplines_type3>().full_domain());
503 }
504
505 /**
506 * @brief Get the whole domain on which spline coefficients are defined.
507 *
508 * Spline approximations (spline-transformed functions) are computed on this domain.
509 *
510 * @param batched_interpolation_domain The whole domain on which the interpolation points are defined.
511 *
512 * @return The domain for the spline coefficients.
513 */
514 template <concepts::discrete_domain BatchedInterpolationDDom>
515 batched_spline_domain_type<BatchedInterpolationDDom> batched_spline_domain(
516 BatchedInterpolationDDom const& batched_interpolation_domain) const noexcept
517 {
518 assert(interpolation_domain() == interpolation_domain_type(batched_interpolation_domain));
519 return ddc::replace_dim_of<interpolation_discrete_dimension_type1, bsplines_type1>(
520 ddc::replace_dim_of<interpolation_discrete_dimension_type2, bsplines_type2>(
521 ddc::replace_dim_of<
522 interpolation_discrete_dimension_type3,
523 bsplines_type3>(batched_interpolation_domain, spline_domain()),
526 }
527
528 /**
529 * @brief Compute a 3D spline approximation of a function.
530 *
531 * Use the values of a function (defined on
532 * SplineBuilder3D::batched_interpolation_domain) and the derivatives of the
533 * function at the boundaries (in the case of BoundCond::HERMITE only)
534 * to calculate a 3D spline approximation of this function.
535 *
536 * The spline approximation is stored as a ChunkSpan of coefficients
537 * associated with B-splines.
538 *
539 * @param[out] spline
540 * The coefficients of the spline computed by this SplineBuilder.
541 * @param[in] vals
542 * The values of the function at the interpolation mesh.
543 * @param[in] derivs_min1
544 * The values of the derivatives at the lower boundary in the first dimension.
545 * @param[in] derivs_max1
546 * The values of the derivatives at the upper boundary in the first dimension.
547 * @param[in] derivs_min2
548 * The values of the derivatives at the lower boundary in the second dimension.
549 * @param[in] derivs_max2
550 * The values of the derivatives at the upper boundary in the second dimension.
551 * @param[in] derivs_min3
552 * The values of the derivatives at the lower boundary in the third dimension.
553 * @param[in] derivs_max3
554 * The values of the derivatives at the upper boundary in the third dimension.
555 * @param[in] mixed_derivs_min1_min2
556 * The values of the the cross-derivatives at the lower boundary in the first dimension and the lower boundary in the second dimension.
557 * @param[in] mixed_derivs_max1_min2
558 * The values of the the cross-derivatives at the upper boundary in the first dimension and the lower boundary in the second dimension.
559 * @param[in] mixed_derivs_min1_max2
560 * The values of the the cross-derivatives at the lower boundary in the first dimension and the upper boundary in the second dimension.
561 * @param[in] mixed_derivs_max1_max2
562 * The values of the the cross-derivatives at the upper boundary in the first dimension and the upper boundary in the second dimension.
563 * @param[in] mixed_derivs_min2_min3
564 * The values of the the cross-derivatives at the lower boundary in the second dimension and the lower boundary in the third dimension.
565 * @param[in] mixed_derivs_max2_min3
566 * The values of the the cross-derivatives at the upper boundary in the second dimension and the lower boundary in the third dimension.
567 * @param[in] mixed_derivs_min2_max3
568 * The values of the the cross-derivatives at the lower boundary in the second dimension and the upper boundary in the third dimension.
569 * @param[in] mixed_derivs_max2_max3
570 * The values of the the cross-derivatives at the upper boundary in the second dimension and the upper boundary in the third dimension.
571 * @param[in] mixed_derivs_min1_min3
572 * The values of the the cross-derivatives at the lower boundary in the first dimension and the lower boundary in the third dimension.
573 * @param[in] mixed_derivs_max1_min3
574 * The values of the the cross-derivatives at the upper boundary in the first dimension and the lower boundary in the third dimension.
575 * @param[in] mixed_derivs_min1_max3
576 * The values of the the cross-derivatives at the lower boundary in the first dimension and the upper boundary in the third dimension.
577 * @param[in] mixed_derivs_max1_max3
578 * The values of the the cross-derivatives at the upper boundary in the first dimension and the upper boundary in the third dimension.
579 * @param[in] mixed_derivs_min1_min2_min3
580 * The values of the the cross-derivatives at the lower boundary in the first dimension, the lower boundary in the second dimension and the lower boundary in the third dimension.
581 * @param[in] mixed_derivs_max1_min2_min3
582 * The values of the the cross-derivatives at the upper boundary in the first dimension, the lower boundary in the second dimension and the lower boundary in the third dimension.
583 * @param[in] mixed_derivs_min1_max2_min3
584 * The values of the the cross-derivatives at the lower boundary in the first dimension, the upper boundary in the second dimension and the lower boundary in the third dimension.
585 * @param[in] mixed_derivs_max1_max2_min3
586 * The values of the the cross-derivatives at the upper boundary in the first dimension, the upper boundary in the second dimension and the lower boundary in the third dimension.
587 * @param[in] mixed_derivs_min1_min2_max3
588 * The values of the the cross-derivatives at the lower boundary in the first dimension, the lower boundary in the second dimension and the upper boundary in the third dimension.
589 * @param[in] mixed_derivs_max1_min2_max3
590 * The values of the the cross-derivatives at the upper boundary in the first dimension, the lower boundary in the second dimension and the upper boundary in the third dimension.
591 * @param[in] mixed_derivs_min1_max2_max3
592 * The values of the the cross-derivatives at the lower boundary in the first dimension, the upper boundary in the second dimension and the upper boundary in the third dimension.
593 * @param[in] mixed_derivs_max1_max2_max3
594 * The values of the the cross-derivatives at the upper boundary in the first dimension, the upper boundary in the second dimension and the upper boundary in the third dimension.
595 */
596 template <class Layout, class BatchedInterpolationDDom>
597 void operator()(
598 ddc::ChunkSpan<
599 double,
600 batched_spline_domain_type<BatchedInterpolationDDom>,
601 Layout,
602 memory_space> spline,
603 ddc::ChunkSpan<double const, BatchedInterpolationDDom, Layout, memory_space> vals,
604 std::optional<ddc::ChunkSpan<
605 double const,
606 batched_derivs_domain_type1<BatchedInterpolationDDom>,
607 Layout,
608 memory_space>> derivs_min1
609 = std::nullopt,
610 std::optional<ddc::ChunkSpan<
611 double const,
612 batched_derivs_domain_type1<BatchedInterpolationDDom>,
613 Layout,
614 memory_space>> derivs_max1
615 = std::nullopt,
616 std::optional<ddc::ChunkSpan<
617 double const,
618 batched_derivs_domain_type2<BatchedInterpolationDDom>,
619 Layout,
620 memory_space>> derivs_min2
621 = std::nullopt,
622 std::optional<ddc::ChunkSpan<
623 double const,
624 batched_derivs_domain_type2<BatchedInterpolationDDom>,
625 Layout,
626 memory_space>> derivs_max2
627 = std::nullopt,
628 std::optional<ddc::ChunkSpan<
629 double const,
630 batched_derivs_domain_type3<BatchedInterpolationDDom>,
631 Layout,
632 memory_space>> derivs_min3
633 = std::nullopt,
634 std::optional<ddc::ChunkSpan<
635 double const,
636 batched_derivs_domain_type3<BatchedInterpolationDDom>,
637 Layout,
638 memory_space>> derivs_max3
639 = std::nullopt,
640 std::optional<ddc::ChunkSpan<
641 double const,
642 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
643 Layout,
644 memory_space>> mixed_derivs_min1_min2
645 = std::nullopt,
646 std::optional<ddc::ChunkSpan<
647 double const,
648 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
649 Layout,
650 memory_space>> mixed_derivs_max1_min2
651 = std::nullopt,
652 std::optional<ddc::ChunkSpan<
653 double const,
654 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
655 Layout,
656 memory_space>> mixed_derivs_min1_max2
657 = std::nullopt,
658 std::optional<ddc::ChunkSpan<
659 double const,
660 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
661 Layout,
662 memory_space>> mixed_derivs_max1_max2
663 = std::nullopt,
664 std::optional<ddc::ChunkSpan<
665 double const,
666 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
667 Layout,
668 memory_space>> mixed_derivs_min2_min3
669 = std::nullopt,
670 std::optional<ddc::ChunkSpan<
671 double const,
672 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
673 Layout,
674 memory_space>> mixed_derivs_max2_min3
675 = std::nullopt,
676 std::optional<ddc::ChunkSpan<
677 double const,
678 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
679 Layout,
680 memory_space>> mixed_derivs_min2_max3
681 = std::nullopt,
682 std::optional<ddc::ChunkSpan<
683 double const,
684 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
685 Layout,
686 memory_space>> mixed_derivs_max2_max3
687 = std::nullopt,
688 std::optional<ddc::ChunkSpan<
689 double const,
690 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
691 Layout,
692 memory_space>> mixed_derivs_min1_min3
693 = std::nullopt,
694 std::optional<ddc::ChunkSpan<
695 double const,
696 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
697 Layout,
698 memory_space>> mixed_derivs_max1_min3
699 = std::nullopt,
700 std::optional<ddc::ChunkSpan<
701 double const,
702 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
703 Layout,
704 memory_space>> mixed_derivs_min1_max3
705 = std::nullopt,
706 std::optional<ddc::ChunkSpan<
707 double const,
708 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
709 Layout,
710 memory_space>> mixed_derivs_max1_max3
711 = std::nullopt,
712 std::optional<ddc::ChunkSpan<
713 double const,
714 batched_derivs_domain_type<BatchedInterpolationDDom>,
715 Layout,
716 memory_space>> mixed_derivs_min1_min2_min3
717 = std::nullopt,
718 std::optional<ddc::ChunkSpan<
719 double const,
720 batched_derivs_domain_type<BatchedInterpolationDDom>,
721 Layout,
722 memory_space>> mixed_derivs_max1_min2_min3
723 = std::nullopt,
724 std::optional<ddc::ChunkSpan<
725 double const,
726 batched_derivs_domain_type<BatchedInterpolationDDom>,
727 Layout,
728 memory_space>> mixed_derivs_min1_max2_min3
729 = std::nullopt,
730 std::optional<ddc::ChunkSpan<
731 double const,
732 batched_derivs_domain_type<BatchedInterpolationDDom>,
733 Layout,
734 memory_space>> mixed_derivs_max1_max2_min3
735 = std::nullopt,
736 std::optional<ddc::ChunkSpan<
737 double const,
738 batched_derivs_domain_type<BatchedInterpolationDDom>,
739 Layout,
740 memory_space>> mixed_derivs_min1_min2_max3
741 = std::nullopt,
742 std::optional<ddc::ChunkSpan<
743 double const,
744 batched_derivs_domain_type<BatchedInterpolationDDom>,
745 Layout,
746 memory_space>> mixed_derivs_max1_min2_max3
747 = std::nullopt,
748 std::optional<ddc::ChunkSpan<
749 double const,
750 batched_derivs_domain_type<BatchedInterpolationDDom>,
751 Layout,
752 memory_space>> mixed_derivs_min1_max2_max3
753 = std::nullopt,
754 std::optional<ddc::ChunkSpan<
755 double const,
756 batched_derivs_domain_type<BatchedInterpolationDDom>,
757 Layout,
758 memory_space>> mixed_derivs_max1_max2_max3
759 = std::nullopt) const;
760};
761
762
763template <
764 class ExecSpace,
765 class MemorySpace,
766 class BSpline1,
767 class BSpline2,
768 class BSpline3,
769 class DDimI1,
770 class DDimI2,
771 class DDimI3,
779template <class Layout, class BatchedInterpolationDDom>
780void SplineBuilder3D<
781 ExecSpace,
782 MemorySpace,
783 BSpline1,
784 BSpline2,
785 BSpline3,
786 DDimI1,
787 DDimI2,
788 DDimI3,
789 BcLower1,
790 BcUpper1,
791 BcLower2,
792 BcUpper2,
793 BcLower3,
794 BcUpper3,
795 Solver>::
796operator()(
797 ddc::ChunkSpan<
798 double,
799 batched_spline_domain_type<BatchedInterpolationDDom>,
800 Layout,
801 memory_space> spline,
802 ddc::ChunkSpan<double const, BatchedInterpolationDDom, Layout, memory_space> vals,
803 std::optional<ddc::ChunkSpan<
804 double const,
805 batched_derivs_domain_type1<BatchedInterpolationDDom>,
806 Layout,
807 memory_space>> derivs_min1,
808 std::optional<ddc::ChunkSpan<
809 double const,
810 batched_derivs_domain_type1<BatchedInterpolationDDom>,
811 Layout,
812 memory_space>> derivs_max1,
813 std::optional<ddc::ChunkSpan<
814 double const,
815 batched_derivs_domain_type2<BatchedInterpolationDDom>,
816 Layout,
817 memory_space>> derivs_min2,
818 std::optional<ddc::ChunkSpan<
819 double const,
820 batched_derivs_domain_type2<BatchedInterpolationDDom>,
821 Layout,
822 memory_space>> derivs_max2,
823 std::optional<ddc::ChunkSpan<
824 double const,
825 batched_derivs_domain_type3<BatchedInterpolationDDom>,
826 Layout,
827 memory_space>> derivs_min3,
828 std::optional<ddc::ChunkSpan<
829 double const,
830 batched_derivs_domain_type3<BatchedInterpolationDDom>,
831 Layout,
832 memory_space>> derivs_max3,
833 std::optional<ddc::ChunkSpan<
834 double const,
835 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
836 Layout,
837 memory_space>> mixed_derivs_min1_min2,
838 std::optional<ddc::ChunkSpan<
839 double const,
840 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
841 Layout,
842 memory_space>> mixed_derivs_max1_min2,
843 std::optional<ddc::ChunkSpan<
844 double const,
845 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
846 Layout,
847 memory_space>> mixed_derivs_min1_max2,
848 std::optional<ddc::ChunkSpan<
849 double const,
850 batched_derivs_domain_type1_2<BatchedInterpolationDDom>,
851 Layout,
852 memory_space>> mixed_derivs_max1_max2,
853 std::optional<ddc::ChunkSpan<
854 double const,
855 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
856 Layout,
857 memory_space>> mixed_derivs_min2_min3,
858 std::optional<ddc::ChunkSpan<
859 double const,
860 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
861 Layout,
862 memory_space>> mixed_derivs_max2_min3,
863 std::optional<ddc::ChunkSpan<
864 double const,
865 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
866 Layout,
867 memory_space>> mixed_derivs_min2_max3,
868 std::optional<ddc::ChunkSpan<
869 double const,
870 batched_derivs_domain_type2_3<BatchedInterpolationDDom>,
871 Layout,
872 memory_space>> mixed_derivs_max2_max3,
873 std::optional<ddc::ChunkSpan<
874 double const,
875 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
876 Layout,
877 memory_space>> mixed_derivs_min1_min3,
878 std::optional<ddc::ChunkSpan<
879 double const,
880 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
881 Layout,
882 memory_space>> mixed_derivs_max1_min3,
883 std::optional<ddc::ChunkSpan<
884 double const,
885 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
886 Layout,
887 memory_space>> mixed_derivs_min1_max3,
888 std::optional<ddc::ChunkSpan<
889 double const,
890 batched_derivs_domain_type1_3<BatchedInterpolationDDom>,
891 Layout,
892 memory_space>> mixed_derivs_max1_max3,
893 std::optional<ddc::ChunkSpan<
894 double const,
895 batched_derivs_domain_type<BatchedInterpolationDDom>,
896 Layout,
897 memory_space>> mixed_derivs_min1_min2_min3,
898 std::optional<ddc::ChunkSpan<
899 double const,
900 batched_derivs_domain_type<BatchedInterpolationDDom>,
901 Layout,
902 memory_space>> mixed_derivs_max1_min2_min3,
903 std::optional<ddc::ChunkSpan<
904 double const,
905 batched_derivs_domain_type<BatchedInterpolationDDom>,
906 Layout,
907 memory_space>> mixed_derivs_min1_max2_min3,
908 std::optional<ddc::ChunkSpan<
909 double const,
910 batched_derivs_domain_type<BatchedInterpolationDDom>,
911 Layout,
912 memory_space>> mixed_derivs_max1_max2_min3,
913 std::optional<ddc::ChunkSpan<
914 double const,
915 batched_derivs_domain_type<BatchedInterpolationDDom>,
916 Layout,
917 memory_space>> mixed_derivs_min1_min2_max3,
918 std::optional<ddc::ChunkSpan<
919 double const,
920 batched_derivs_domain_type<BatchedInterpolationDDom>,
921 Layout,
922 memory_space>> mixed_derivs_max1_min2_max3,
923 std::optional<ddc::ChunkSpan<
924 double const,
925 batched_derivs_domain_type<BatchedInterpolationDDom>,
926 Layout,
927 memory_space>> mixed_derivs_min1_max2_max3,
928 std::optional<ddc::ChunkSpan<
929 double const,
930 batched_derivs_domain_type<BatchedInterpolationDDom>,
931 Layout,
932 memory_space>> mixed_derivs_max1_max2_max3) const
933{
934 auto const batched_interpolation_domain = vals.domain();
935
936 assert(interpolation_domain() == interpolation_domain_type(batched_interpolation_domain));
937 assert(batch_domain_type<BatchedInterpolationDDom>(batched_interpolation_domain)
938 == batch_domain_type<BatchedInterpolationDDom>(spline.domain()));
939
940 if (batch_domain(batched_interpolation_domain).empty()) {
941 return;
942 }
943
944 // Build the derivatives along the second dimension
945 auto const batched_interpolation_deriv_domain2
946 = ddc::replace_dim_of<interpolation_discrete_dimension_type2, deriv_type2>(
947 batched_interpolation_domain,
948 ddc::DiscreteDomain<deriv_type2>(
949 ddc::DiscreteElement<deriv_type2>(BSpline2::degree() % 2),
950 ddc::DiscreteVector<deriv_type2>(bsplines_type2::degree() / 2)));
951
952 ddc::Chunk spline_derivs_min2_alloc(
953 m_label + " > spline_derivs_min2 (ddc::SplineBuilder3D::operator())",
954 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2),
955 ddc::KokkosAllocator<double, MemorySpace>());
956 auto spline_derivs_min2 = spline_derivs_min2_alloc.span_view();
957 auto spline_derivs_min2_opt = std::optional(spline_derivs_min2.span_cview());
958 if constexpr (BcLower2 == ddc::BoundCond::HERMITE) {
959 m_spline_builder1(
960 spline_derivs_min2,
961 *derivs_min2,
962 mixed_derivs_min1_min2,
963 mixed_derivs_max1_min2);
964 } else {
965 spline_derivs_min2_opt = std::nullopt;
966 }
967
968 ddc::Chunk spline_derivs_max2_alloc(
969 m_label + " > spline_derivs_max2 (ddc::SplineBuilder3D::operator())",
970 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2),
971 ddc::KokkosAllocator<double, MemorySpace>());
972 auto spline_derivs_max2 = spline_derivs_max2_alloc.span_view();
973 auto spline_derivs_max2_opt = std::optional(spline_derivs_max2.span_cview());
974 if constexpr (BcUpper2 == ddc::BoundCond::HERMITE) {
975 m_spline_builder1(
976 spline_derivs_max2,
977 *derivs_max2,
978 mixed_derivs_min1_max2,
979 mixed_derivs_max1_max2);
980 } else {
981 spline_derivs_max2_opt = std::nullopt;
982 }
983
984 // Build the derivatives along the third dimension
985 auto const batched_interpolation_deriv_domain3
986 = ddc::replace_dim_of<interpolation_discrete_dimension_type3, deriv_type3>(
987 batched_interpolation_domain,
988 ddc::DiscreteDomain<deriv_type3>(
989 ddc::DiscreteElement<deriv_type3>(BSpline3::degree() % 2),
990 ddc::DiscreteVector<deriv_type3>(bsplines_type3::degree() / 2)));
991
992 ddc::Chunk spline_derivs_min3_alloc(
993 m_label + " > spline_derivs_min3 (ddc::SplineBuilder3D::operator())",
994 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain3),
995 ddc::KokkosAllocator<double, MemorySpace>());
996 auto spline_derivs_min3 = spline_derivs_min3_alloc.span_view();
997 auto spline_derivs_min3_opt = std::optional(spline_derivs_min3.span_cview());
998 if constexpr (BcLower3 == ddc::BoundCond::HERMITE) {
999 m_spline_builder1(
1000 spline_derivs_min3,
1001 *derivs_min3,
1002 mixed_derivs_min1_min3,
1003 mixed_derivs_max1_min3);
1004 } else {
1005 spline_derivs_min3_opt = std::nullopt;
1006 }
1007
1008 ddc::Chunk spline_derivs_max3_alloc(
1009 m_label + " > spline_derivs_max3 (ddc::SplineBuilder3D::operator())",
1010 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain3),
1011 ddc::KokkosAllocator<double, MemorySpace>());
1012 auto spline_derivs_max3 = spline_derivs_max3_alloc.span_view();
1013 auto spline_derivs_max3_opt = std::optional(spline_derivs_max3.span_cview());
1014 if constexpr (BcUpper3 == ddc::BoundCond::HERMITE) {
1015 m_spline_builder1(
1016 spline_derivs_max3,
1017 *derivs_max3,
1018 mixed_derivs_min1_max3,
1019 mixed_derivs_max1_max3);
1020 } else {
1021 spline_derivs_max3_opt = std::nullopt;
1022 }
1023
1024 // Build the cross derivatives along the second and third dimensions
1025 auto batched_interpolation_deriv_domain2_3
1026 = ddc::replace_dim_of<interpolation_discrete_dimension_type3, deriv_type3>(
1027 batched_interpolation_deriv_domain2,
1028 ddc::DiscreteDomain<deriv_type3>(
1029 ddc::DiscreteElement<deriv_type3>(BSpline3::degree() % 2),
1030 ddc::DiscreteVector<deriv_type3>(bsplines_type3::degree() / 2)));
1031
1032 ddc::Chunk spline_derivs_min2_min3_alloc(
1033 m_label + " > spline_derivs_min2_min3 (ddc::SplineBuilder3D::operator())",
1034 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2_3),
1035 ddc::KokkosAllocator<double, MemorySpace>());
1036 auto spline_derivs_min2_min3 = spline_derivs_min2_min3_alloc.span_view();
1037 auto spline_derivs_min2_min3_opt = std::optional(spline_derivs_min2_min3.span_cview());
1038 if constexpr (BcLower2 == ddc::BoundCond::HERMITE || BcLower3 == ddc::BoundCond::HERMITE) {
1039 m_spline_builder1(
1040 spline_derivs_min2_min3,
1041 *mixed_derivs_min2_min3,
1042 mixed_derivs_min1_min2_min3,
1043 mixed_derivs_max1_min2_min3);
1044 } else {
1045 spline_derivs_min2_min3_opt = std::nullopt;
1046 }
1047
1048 ddc::Chunk spline_derivs_min2_max3_alloc(
1049 m_label + " > spline_derivs_min2_max3 (ddc::SplineBuilder3D::operator())",
1050 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2_3),
1051 ddc::KokkosAllocator<double, MemorySpace>());
1052 auto spline_derivs_min2_max3 = spline_derivs_min2_max3_alloc.span_view();
1053 auto spline_derivs_min2_max3_opt = std::optional(spline_derivs_min2_max3.span_cview());
1054 if constexpr (BcLower2 == ddc::BoundCond::HERMITE || BcUpper3 == ddc::BoundCond::HERMITE) {
1055 m_spline_builder1(
1056 spline_derivs_min2_max3,
1057 *mixed_derivs_min2_max3,
1058 mixed_derivs_min1_min2_max3,
1059 mixed_derivs_max1_min2_max3);
1060 } else {
1061 spline_derivs_min2_max3_opt = std::nullopt;
1062 }
1063
1064 ddc::Chunk spline_derivs_max2_min3_alloc(
1065 m_label + " > spline_derivs_max2_min3 (ddc::SplineBuilder3D::operator())",
1066 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2_3),
1067 ddc::KokkosAllocator<double, MemorySpace>());
1068 auto spline_derivs_max2_min3 = spline_derivs_max2_min3_alloc.span_view();
1069 auto spline_derivs_max2_min3_opt = std::optional(spline_derivs_max2_min3.span_cview());
1070 if constexpr (BcUpper2 == ddc::BoundCond::HERMITE || BcLower3 == ddc::BoundCond::HERMITE) {
1071 m_spline_builder1(
1072 spline_derivs_max2_min3,
1073 *mixed_derivs_max2_min3,
1074 mixed_derivs_min1_max2_min3,
1075 mixed_derivs_max1_max2_min3);
1076 } else {
1077 spline_derivs_max2_min3_opt = std::nullopt;
1078 }
1079
1080 ddc::Chunk spline_derivs_max2_max3_alloc(
1081 m_label + " > spline_derivs_max2_max3 (ddc::SplineBuilder3D::operator())",
1082 m_spline_builder1.batched_spline_domain(batched_interpolation_deriv_domain2_3),
1083 ddc::KokkosAllocator<double, MemorySpace>());
1084 auto spline_derivs_max2_max3 = spline_derivs_max2_max3_alloc.span_view();
1085 auto spline_derivs_max2_max3_opt = std::optional(spline_derivs_max2_max3.span_cview());
1086 if constexpr (BcUpper2 == ddc::BoundCond::HERMITE || BcUpper3 == ddc::BoundCond::HERMITE) {
1087 m_spline_builder1(
1088 spline_derivs_max2_max3,
1089 *mixed_derivs_max2_max3,
1090 mixed_derivs_min1_max2_max3,
1091 mixed_derivs_max1_max2_max3);
1092 } else {
1093 spline_derivs_max2_max3_opt = std::nullopt;
1094 }
1095
1096 // Spline1-approximate vals (to spline1)
1097 ddc::Chunk spline1_alloc(
1098 m_label + " > spline1 (ddc::SplineBuilder3D::operator())",
1099 m_spline_builder1.batched_spline_domain(batched_interpolation_domain),
1100 ddc::KokkosAllocator<double, MemorySpace>());
1101 ddc::ChunkSpan const spline1 = spline1_alloc.span_view();
1102
1103 m_spline_builder1(spline1, vals, derivs_min1, derivs_max1);
1104
1105 m_spline_builder_2_3(
1106 spline,
1107 spline1.span_cview(),
1108 spline_derivs_min2_opt,
1109 spline_derivs_max2_opt,
1110 spline_derivs_min3_opt,
1111 spline_derivs_max3_opt,
1112 spline_derivs_min2_min3_opt,
1113 spline_derivs_max2_min3_opt,
1114 spline_derivs_min2_max3_opt,
1115 spline_derivs_max2_max3_opt);
1116}
1117
1118} // namespace ddc
friend class ChunkSpan
friend class Chunk
Definition chunk.hpp:81
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.
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.
Storage class of the static attributes of the discrete dimension.
Impl & operator=(Impl &&x)=default
Move-assigns.
Impl(RandomIt breaks_begin, RandomIt breaks_end)
Constructs an Impl by iterating over a range of break points from begin to end.
KOKKOS_INLINE_FUNCTION ddc::Coordinate< CDim > rmin() const noexcept
Returns the coordinate of the first break point of the domain on which the B-splines are defined.
Impl(std::vector< ddc::Coordinate< CDim > > const &breaks)
Constructs an Impl using a std::vector.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate< CDim > const &x) const
Evaluates non-zero B-splines at a given coordinate.
KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept
Returns the number of elements necessary to construct a spline representation of a function.
Impl(Impl< DDim, OriginMemorySpace > const &impl)
Copy-constructs from another Impl with a different Kokkos memory space.
~Impl()=default
Destructs.
KOKKOS_INLINE_FUNCTION ddc::DiscreteDomain< knot_discrete_dimension_type > break_point_domain() const
Returns the discrete domain which describes the break points.
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< knot_discrete_dimension_type > get_last_support_knot(discrete_element_type const &ix) const
Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-splin...
Impl(Impl &&x)=default
Move-constructs.
Impl(std::initializer_list< ddc::Coordinate< CDim > > breaks)
Constructs an Impl using a brace-list, i.e.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs(ddc::DSpan2D derivs, ddc::Coordinate< CDim > const &x, std::size_t n) const
Evaluates non-zero B-spline values and derivatives at a given coordinate.
KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept
Returns the number of cells over which the B-splines are defined.
KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const
Returns the discrete domain including eventual additional B-splines in the periodic case.
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< knot_discrete_dimension_type > get_first_support_knot(discrete_element_type const &ix) const
Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spli...
KOKKOS_INLINE_FUNCTION std::size_t npoints() const noexcept
The number of break points.
KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept
Returns the number of basis functions.
Impl(Impl const &x)=default
Copy-constructs.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate< CDim > const &x) const
Evaluates non-zero B-spline derivatives at a given coordinate.
KOKKOS_INLINE_FUNCTION double length() const noexcept
Returns the length of the domain.
Impl & operator=(Impl const &x)=default
Copy-assigns.
KOKKOS_INLINE_FUNCTION ddc::Coordinate< CDim > rmax() const noexcept
Returns the coordinate of the last break point of the domain on which the B-splines are defined.
The type of a non-uniform 1D spline basis (B-spline).
static constexpr std::size_t degree() noexcept
The degree of B-splines.
static constexpr bool is_periodic() noexcept
Indicates if the B-splines are periodic or not.
static constexpr bool is_uniform() noexcept
Indicates if the B-splines are uniform or not (this is not the case here).
NonUniformPointSampling models a non-uniform discretization of the CDim segment .
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.
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.
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(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.
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.
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.
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(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.
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(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.
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.
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.
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.
Storage class of the static attributes of the discrete dimension.
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< knot_discrete_dimension_type > get_last_support_knot(discrete_element_type const &ix) const
Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-splin...
Impl(ddc::Coordinate< CDim > rmin, ddc::Coordinate< CDim > rmax, std::size_t ncells)
Constructs a spline basis (B-splines) with n equidistant knots over .
KOKKOS_INLINE_FUNCTION ddc::Coordinate< CDim > rmax() const noexcept
Returns the coordinate of the upper bound of the domain on which the B-splines are defined.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate< CDim > const &x) const
Evaluates non-zero B-splines at a given coordinate.
KOKKOS_INLINE_FUNCTION ddc::DiscreteDomain< knot_discrete_dimension_type > break_point_domain() const
Returns the discrete domain which describes the break points.
KOKKOS_INLINE_FUNCTION ddc::Coordinate< CDim > rmin() const noexcept
Returns the coordinate of the lower bound of the domain on which the B-splines are defined.
~Impl()=default
Destructs.
KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept
Returns the number of basis functions.
Impl(Impl const &x)=default
Copy-constructs.
KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept
Returns the number of elements necessary to construct a spline representation of a function.
Impl(Impl &&x)=default
Move-constructs.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs(ddc::DSpan2D derivs, ddc::Coordinate< CDim > const &x, std::size_t n) const
Evaluates non-zero B-spline values and derivatives at a given coordinate.
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< knot_discrete_dimension_type > get_first_support_knot(discrete_element_type const &ix) const
Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spli...
KOKKOS_INLINE_FUNCTION double length() const noexcept
Returns the length of the domain.
Impl(Impl< DDim, OriginMemorySpace > const &impl)
Copy-constructs from another Impl with a different Kokkos memory space.
KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept
Returns the number of cells over which the B-splines are defined.
KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate< CDim > const &x) const
Evaluates non-zero B-spline derivatives at a given coordinate.
Impl & operator=(Impl &&x)=default
Move-assigns.
KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const
Returns the discrete domain including eventual additional B-splines in the periodic case.
Impl & operator=(Impl const &x)=default
Copy-assigns.
The type of a uniform 1D spline basis (B-spline).
static constexpr bool is_uniform() noexcept
Indicates if the B-splines are uniform or not (this is the case here).
static constexpr bool is_periodic() noexcept
Indicates if the B-splines are periodic or not.
static constexpr std::size_t degree() noexcept
The degree of B-splines.
UniformPointSampling models a uniform discretization of the provided continuous dimension.
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...
Definition deriv.hpp:15
If the type DDim is a B-spline, defines type to the discrete dimension of the associated knots.
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos, ddc::Coordinate< DimNI > eval_pos_not_interest_min, ddc::Coordinate< DimNI > eval_pos_not_interest_max)
Instantiate a ConstantExtrapolationRule.
KOKKOS_FUNCTION double operator()(CoordType coord_extrap, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines1, BSplines2 >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.
KOKKOS_FUNCTION double operator()(CoordType pos, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.
A functor describing a null extrapolation boundary value for 1D spline evaluator.
KOKKOS_FUNCTION double operator()(CoordType, ChunkSpan) const
Evaluates the spline at a coordinate outside of the domain.
KOKKOS_FUNCTION double operator()(CoordType, ChunkSpan) const