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