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