DDC 0.4.1
Loading...
Searching...
No Matches
spline_evaluator.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 <array>
8#include <cstddef>
9#include <type_traits>
10
11#include <ddc/ddc.hpp>
12
13#include <Kokkos_Macros.hpp>
14#include <Kokkos_MathematicalFunctions.hpp>
15
16#include "integrals.hpp"
17#include "periodic_extrapolation_rule.hpp"
18
19namespace ddc {
20
21/**
22 * @brief A class to evaluate, differentiate or integrate a spline function.
23 *
24 * A class which contains an operator () which can be used to evaluate, differentiate or integrate a spline function.
25 *
26 * @tparam ExecSpace The Kokkos execution space on which the spline evaluation is performed.
27 * @tparam MemorySpace The Kokkos memory space on which the data (spline coefficients and evaluation) is stored.
28 * @tparam BSplines The discrete dimension representing the B-splines.
29 * @tparam EvaluationDDim The discrete dimension on which evaluation points are defined.
30 * @tparam LowerExtrapolationRule The lower extrapolation rule type.
31 * @tparam UpperExtrapolationRule The upper extrapolation rule type.
32 * @tparam DDimX A variadic template of all the discrete dimensions forming the full space (EvaluationDDim + batched dimensions).
33 */
34template <
35 class ExecSpace,
36 class MemorySpace,
37 class BSplines,
38 class EvaluationDDim,
39 class LowerExtrapolationRule,
40 class UpperExtrapolationRule,
41 class... DDimX>
43{
44private:
45 /**
46 * @brief Tag to indicate that the value of the spline should be evaluated.
47 */
48 struct eval_type
49 {
50 };
51
52 /**
53 * @brief Tag to indicate that derivative of the spline should be evaluated.
54 */
55 struct eval_deriv_type
56 {
57 };
58
59public:
60 /// @brief The type of the Kokkos execution space used by this class.
61 using exec_space = ExecSpace;
62
63 /// @brief The type of the Kokkos memory space used by this class.
64 using memory_space = MemorySpace;
65
66 /// @brief The type of the evaluation continuous dimension (continuous dimension of interest) used by this class.
67 using continuous_dimension_type = typename BSplines::continuous_dimension_type;
68
69 /// @brief The type of the evaluation discrete dimension (discrete dimension of interest) used by this class.
70 using evaluation_discrete_dimension_type = EvaluationDDim;
71
72 /// @brief The discrete dimension representing the B-splines.
73 using bsplines_type = BSplines;
74
75 /// @brief The type of the domain for the 1D evaluation mesh used by this class.
76 using evaluation_domain_type = ddc::DiscreteDomain<evaluation_discrete_dimension_type>;
77
78 /// @brief The type of the whole domain representing evaluation points.
79 using batched_evaluation_domain_type = ddc::DiscreteDomain<DDimX...>;
80
81 /// @brief The type of the 1D spline domain corresponding to the dimension of interest.
82 using spline_domain_type = ddc::DiscreteDomain<bsplines_type>;
83
84 /**
85 * @brief The type of the batch domain (obtained by removing the dimension of interest
86 * from the whole domain).
87 */
88 using batch_domain_type = ddc::
89 remove_dims_of_t<batched_evaluation_domain_type, evaluation_discrete_dimension_type>;
90
91 /**
92 * @brief The type of the whole spline domain (cartesian product of 1D spline domain
93 * and batch domain) preserving the order of dimensions.
94 */
95 using batched_spline_domain_type = ddc::replace_dim_of_t<
96 batched_evaluation_domain_type,
97 evaluation_discrete_dimension_type,
98 bsplines_type>;
99
100 /// @brief The type of the extrapolation rule at the lower boundary.
101 using lower_extrapolation_rule_type = LowerExtrapolationRule;
102
103 /// @brief The type of the extrapolation rule at the upper boundary.
104 using upper_extrapolation_rule_type = UpperExtrapolationRule;
105
106
107private:
108 LowerExtrapolationRule m_lower_extrap_rule;
109
110 UpperExtrapolationRule m_upper_extrap_rule;
111
112public:
113 static_assert(
114 std::is_same_v<LowerExtrapolationRule,
115 typename ddc::PeriodicExtrapolationRule<continuous_dimension_type>>
116 == bsplines_type::is_periodic()
117 && std::is_same_v<
118 UpperExtrapolationRule,
119 typename ddc::PeriodicExtrapolationRule<continuous_dimension_type>>
120 == bsplines_type::is_periodic(),
121 "PeriodicExtrapolationRule has to be used if and only if dimension is periodic");
122 static_assert(
123 std::is_invocable_r_v<
124 double,
125 LowerExtrapolationRule,
126 ddc::Coordinate<continuous_dimension_type>,
127 ddc::ChunkSpan<
128 double const,
129 spline_domain_type,
130 Kokkos::layout_right,
131 memory_space>>,
132 "LowerExtrapolationRule::operator() has to be callable with usual arguments.");
133 static_assert(
134 std::is_invocable_r_v<
135 double,
136 UpperExtrapolationRule,
137 ddc::Coordinate<continuous_dimension_type>,
138 ddc::ChunkSpan<
139 double const,
140 spline_domain_type,
141 Kokkos::layout_right,
142 memory_space>>,
143 "UpperExtrapolationRule::operator() has to be callable with usual arguments.");
144
145 /**
146 * @brief Build a SplineEvaluator acting on batched_spline_domain.
147 *
148 * @param lower_extrap_rule The extrapolation rule at the lower boundary.
149 * @param upper_extrap_rule The extrapolation rule at the upper boundary.
150 *
151 * @see NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule
152 */
153 explicit SplineEvaluator(
154 LowerExtrapolationRule const& lower_extrap_rule,
155 UpperExtrapolationRule const& upper_extrap_rule)
156 : m_lower_extrap_rule(lower_extrap_rule)
157 , m_upper_extrap_rule(upper_extrap_rule)
158 {
159 }
160
161 /**
162 * @brief Copy-constructs.
163 *
164 * @param x A reference to another SplineEvaluator.
165 */
166 SplineEvaluator(SplineEvaluator const& x) = default;
167
168 /**
169 * @brief Move-constructs.
170 *
171 * @param x An rvalue to another SplineEvaluator.
172 */
173 SplineEvaluator(SplineEvaluator&& x) = default;
174
175 /// @brief Destructs
176 ~SplineEvaluator() = default;
177
178 /**
179 * @brief Copy-assigns.
180 *
181 * @param x A reference to another SplineEvaluator.
182 * @return A reference to this object.
183 */
184 SplineEvaluator& operator=(SplineEvaluator const& x) = default;
185
186 /**
187 * @brief Move-assigns.
188 *
189 * @param x An rvalue to another SplineEvaluator.
190 * @return A reference to this object.
191 */
193
194 /**
195 * @brief Get the lower extrapolation rule.
196 *
197 * Extrapolation rules are functors used to define the behavior of the SplineEvaluator out of the domain where the break points of the B-splines are defined.
198 *
199 * @return The lower extrapolation rule.
200 *
201 * @see NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule
202 */
203 lower_extrapolation_rule_type lower_extrapolation_rule() const
204 {
205 return m_lower_extrap_rule;
206 }
207
208 /**
209 * @brief Get the upper extrapolation rule.
210 *
211 * Extrapolation rules are functors used to define the behavior of the SplineEvaluator out of the domain where the break points of the B-splines are defined.
212 *
213 * @return The upper extrapolation rule.
214 *
215 * @see NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule
216 */
217 upper_extrapolation_rule_type upper_extrapolation_rule() const
218 {
219 return m_upper_extrap_rule;
220 }
221
222 /**
223 * @brief Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.
224 *
225 * The spline coefficients represent a 1D spline function defined on a B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.
226 *
227 * Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline interpolation.
228 *
229 * @param coord_eval The coordinate where the spline is evaluated. Note that only the component along the dimension of interest is used.
230 * @param spline_coef A ChunkSpan storing the 1D spline coefficients.
231 *
232 * @return The value of the spline function at the desired coordinate.
233 */
234 template <class Layout, class... CoordsDims>
235 KOKKOS_FUNCTION double operator()(
236 ddc::Coordinate<CoordsDims...> const& coord_eval,
237 ddc::ChunkSpan<double const, spline_domain_type, Layout, memory_space> const
238 spline_coef) const
239 {
240 return eval(coord_eval, spline_coef);
241 }
242
243 /**
244 * @brief Evaluate spline function (described by its spline coefficients) on a mesh.
245 *
246 * The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines
247 * (basis splines). They can be obtained via various methods, such as using a SplineBuilder.
248 *
249 * This is not a multidimensional evaluation. This is a batched 1D evaluation. This means that for each slice of coordinates
250 * identified by a batch_domain_type::discrete_element_type, the evaluation is performed with the 1D set of
251 * spline coefficients identified by the same batch_domain_type::discrete_element_type.
252 *
253 * Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline interpolation.
254 *
255 * @param[out] spline_eval The values of the spline function at the desired coordinates. For practical reasons those are
256 * stored in a ChunkSpan defined on a batched_evaluation_domain_type.
257 * @param[in] coords_eval The coordinates where the spline is evaluated. Those are
258 * stored in a ChunkSpan defined on a batched_evaluation_domain_type. Note that the coordinates of the
259 * points represented by this domain are unused and irrelevant (but the points themselves (DiscreteElement) are used to select
260 * the set of 1D spline coefficients retained to perform the evaluation).
261 * @param[in] spline_coef A ChunkSpan storing the spline coefficients.
262 */
263 template <class Layout1, class Layout2, class Layout3, class... CoordsDims>
264 void operator()(
265 ddc::ChunkSpan<double, batched_evaluation_domain_type, Layout1, memory_space> const
266 spline_eval,
267 ddc::ChunkSpan<
268 ddc::Coordinate<CoordsDims...> const,
269 batched_evaluation_domain_type,
270 Layout2,
271 memory_space> const coords_eval,
272 ddc::ChunkSpan<double const, batched_spline_domain_type, Layout3, memory_space> const
273 spline_coef) const
274 {
275 evaluation_domain_type const evaluation_domain(spline_eval.domain());
276 batch_domain_type const batch_domain(spline_eval.domain());
277
278 ddc::parallel_for_each(
279 "ddc_splines_evaluate",
280 exec_space(),
281 batch_domain,
282 KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
283 const auto spline_eval_1D = spline_eval[j];
284 const auto coords_eval_1D = coords_eval[j];
285 const auto spline_coef_1D = spline_coef[j];
286 for (auto const i : evaluation_domain) {
287 spline_eval_1D(i) = eval(coords_eval_1D(i), spline_coef_1D);
288 }
289 });
290 }
291
292 /**
293 * @brief Evaluate a spline function (described by its spline coefficients) on a mesh.
294 *
295 * The spline coefficients represent a spline function defined on a cartesian
296 * product of batch_domain and B-splines (basis splines). They can be obtained
297 * via various methods, such as using a SplineBuilder.
298 *
299 * This is not a multidimensional evaluation. This is a batched 1D evaluation.
300 * This means that for each slice of spline_eval the evaluation is performed with
301 * the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.
302 *
303 * Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline
304 * interpolation.
305 *
306 * @param[out] spline_eval The values of the spline function at the coordinates
307 * of the mesh.
308 * @param[in] spline_coef A ChunkSpan storing the spline coefficients.
309 */
310 template <class Layout1, class Layout2>
311 void operator()(
312 ddc::ChunkSpan<double, batched_evaluation_domain_type, Layout1, memory_space> const
313 spline_eval,
314 ddc::ChunkSpan<double const, batched_spline_domain_type, Layout2, memory_space> const
315 spline_coef) const
316 {
317 evaluation_domain_type const evaluation_domain(spline_eval.domain());
318 batch_domain_type const batch_domain(spline_eval.domain());
319
320 ddc::parallel_for_each(
321 "ddc_splines_evaluate",
322 exec_space(),
323 batch_domain,
324 KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
325 const auto spline_eval_1D = spline_eval[j];
326 const auto spline_coef_1D = spline_coef[j];
327 for (auto const i : evaluation_domain) {
328 ddc::Coordinate<continuous_dimension_type> coord_eval_1D
329 = ddc::coordinate(i);
330 spline_eval_1D(i) = eval(coord_eval_1D, spline_coef_1D);
331 }
332 });
333 }
334
335 /**
336 * @brief Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.
337 *
338 * The spline coefficients represent a 1D spline function defined on a B-splines (basis splines). They can be
339 * obtained via various methods, such as using a SplineBuilder.
340 *
341 * @param coord_eval The coordinate where the spline is differentiated. Note that only the component along the dimension of interest is used.
342 * @param spline_coef A ChunkSpan storing the 1D spline coefficients.
343 *
344 * @return The derivative of the spline function at the desired coordinate.
345 */
346 template <class Layout, class... CoordsDims>
347 KOKKOS_FUNCTION double deriv(
348 ddc::Coordinate<CoordsDims...> const& coord_eval,
349 ddc::ChunkSpan<double const, spline_domain_type, Layout, memory_space> const
350 spline_coef) const
351 {
352 return eval_no_bc<eval_deriv_type>(coord_eval, spline_coef);
353 }
354
355 /**
356 * @brief Differentiate spline function (described by its spline coefficients) on a mesh.
357 *
358 * The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines
359 * (basis splines). They can be obtained via various methods, such as using a SplineBuilder.
360 *
361 * The derivation is not performed in a multidimensional way (in any sense). This is a batched 1D derivation.
362 * This means that for each slice of coordinates identified by a batch_domain_type::discrete_element_type,
363 * the derivation is performed with the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.
364 *
365 * @param[out] spline_eval The derivatives of the spline function at the desired coordinates. For practical reasons those are
366 * stored in a ChunkSpan defined on a batched_evaluation_domain_type.
367 * @param[in] coords_eval The coordinates where the spline is differentiated. Those are
368 * stored in a ChunkSpan defined on a batched_evaluation_domain_type. Note that the coordinates of the
369 * points represented by this domain are unused and irrelevant (but the points themselves (DiscreteElement) are used to select
370 * the set of 1D spline coefficients retained to perform the evaluation).
371 * @param[in] spline_coef A ChunkSpan storing the spline coefficients.
372 */
373 template <class Layout1, class Layout2, class Layout3, class... CoordsDims>
374 void deriv(
375 ddc::ChunkSpan<double, batched_evaluation_domain_type, Layout1, memory_space> const
376 spline_eval,
377 ddc::ChunkSpan<
378 ddc::Coordinate<CoordsDims...> const,
379 batched_evaluation_domain_type,
380 Layout2,
381 memory_space> const coords_eval,
382 ddc::ChunkSpan<double const, batched_spline_domain_type, Layout3, memory_space> const
383 spline_coef) const
384 {
385 evaluation_domain_type const evaluation_domain(spline_eval.domain());
386 batch_domain_type const batch_domain(spline_eval.domain());
387
388 ddc::parallel_for_each(
389 "ddc_splines_differentiate",
390 exec_space(),
391 batch_domain,
392 KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
393 const auto spline_eval_1D = spline_eval[j];
394 const auto coords_eval_1D = coords_eval[j];
395 const auto spline_coef_1D = spline_coef[j];
396 for (auto const i : evaluation_domain) {
397 spline_eval_1D(i)
398 = eval_no_bc<eval_deriv_type>(coords_eval_1D(i), spline_coef_1D);
399 }
400 });
401 }
402
403 /**
404 * @brief Differentiate spline function (described by its spline coefficients) on a mesh.
405 *
406 * The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines
407 * (basis splines). They can be obtained via various methods, such as using a SplineBuilder.
408 *
409 * The derivation is not performed in a multidimensional way (in any sense). This is a batched 1D derivation.
410 * This is not a multidimensional evaluation. This is a batched 1D evaluation.
411 * This means that for each slice of spline_eval the evaluation is performed with
412 * the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.
413 *
414 * @param[out] spline_eval The derivatives of the spline function at the coordinates.
415 * @param[in] spline_coef A ChunkSpan storing the spline coefficients.
416 */
417 template <class Layout1, class Layout2>
418 void deriv(
419 ddc::ChunkSpan<double, batched_evaluation_domain_type, Layout1, memory_space> const
420 spline_eval,
421 ddc::ChunkSpan<double const, batched_spline_domain_type, Layout2, memory_space> const
422 spline_coef) const
423 {
424 evaluation_domain_type const evaluation_domain(spline_eval.domain());
425 batch_domain_type const batch_domain(spline_eval.domain());
426
427 ddc::parallel_for_each(
428 "ddc_splines_differentiate",
429 exec_space(),
430 batch_domain,
431 KOKKOS_CLASS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
432 const auto spline_eval_1D = spline_eval[j];
433 const auto spline_coef_1D = spline_coef[j];
434 for (auto const i : evaluation_domain) {
435 ddc::Coordinate<continuous_dimension_type> coord_eval_1D
436 = ddc::coordinate(i);
437 spline_eval_1D(i)
438 = eval_no_bc<eval_deriv_type>(coord_eval_1D, spline_coef_1D);
439 }
440 });
441 }
442
443 /** @brief Perform batched 1D integrations of a spline function (described by its spline coefficients) along the dimension of interest and store results on a subdomain of batch_domain.
444 *
445 * The spline coefficients represent a spline function defined on a B-splines (basis splines). They can be obtained via the SplineBuilder.
446 *
447 * The integration is not performed in a multidimensional way (in any sense). This is a batched 1D integration.
448 * This means that for each element of integrals, the integration is performed with the 1D set of
449 * spline coefficients identified by the same DiscreteElement.
450 *
451 * @param[out] integrals The integrals of the spline function on the subdomain of batch_domain. For practical reasons those are
452 * stored in a ChunkSpan defined on a batch_domain_type. Note that the coordinates of the
453 * points represented by this domain are unused and irrelevant.
454 * @param[in] spline_coef A ChunkSpan storing the spline coefficients.
455 */
456 template <class Layout1, class Layout2>
457 void integrate(
458 ddc::ChunkSpan<double, batch_domain_type, Layout1, memory_space> const integrals,
459 ddc::ChunkSpan<double const, batched_spline_domain_type, Layout2, memory_space> const
460 spline_coef) const
461 {
462 batch_domain_type const batch_domain(integrals.domain());
463 ddc::Chunk values_alloc(
464 ddc::DiscreteDomain<bsplines_type>(spline_coef.domain()),
465 ddc::KokkosAllocator<double, memory_space>());
466 ddc::ChunkSpan const values = values_alloc.span_view();
467 ddc::integrals(exec_space(), values);
468
469 ddc::parallel_for_each(
470 "ddc_splines_integrate",
471 exec_space(),
472 batch_domain,
473 KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) {
474 integrals(j) = 0;
475 for (typename spline_domain_type::discrete_element_type const i :
476 values.domain()) {
477 integrals(j) += spline_coef(i, j) * values(i);
478 }
479 });
480 }
481
482private:
483 template <class Layout, class... CoordsDims>
484 KOKKOS_INLINE_FUNCTION double eval(
485 ddc::Coordinate<CoordsDims...> const& coord_eval,
486 ddc::ChunkSpan<double const, spline_domain_type, Layout, memory_space> const
487 spline_coef) const
488 {
489 ddc::Coordinate<continuous_dimension_type> coord_eval_interest(coord_eval);
490 if constexpr (bsplines_type::is_periodic()) {
491 if (coord_eval_interest < ddc::discrete_space<bsplines_type>().rmin()
492 || coord_eval_interest > ddc::discrete_space<bsplines_type>().rmax()) {
493 coord_eval_interest -= Kokkos::floor(
494 (coord_eval_interest
495 - ddc::discrete_space<bsplines_type>().rmin())
496 / ddc::discrete_space<bsplines_type>().length())
497 * ddc::discrete_space<bsplines_type>().length();
498 }
499 } else {
500 if (coord_eval_interest < ddc::discrete_space<bsplines_type>().rmin()) {
501 return m_lower_extrap_rule(coord_eval_interest, spline_coef);
502 }
503 if (coord_eval_interest > ddc::discrete_space<bsplines_type>().rmax()) {
504 return m_upper_extrap_rule(coord_eval_interest, spline_coef);
505 }
506 }
507 return eval_no_bc<eval_type>(coord_eval_interest, spline_coef);
508 }
509
510 template <class EvalType, class Layout, class... CoordsDims>
511 KOKKOS_INLINE_FUNCTION double eval_no_bc(
512 ddc::Coordinate<CoordsDims...> const& coord_eval,
513 ddc::ChunkSpan<double const, spline_domain_type, Layout, memory_space> const
514 spline_coef) const
515 {
516 static_assert(
517 std::is_same_v<EvalType, eval_type> || std::is_same_v<EvalType, eval_deriv_type>);
518 ddc::DiscreteElement<bsplines_type> jmin;
519 std::array<double, bsplines_type::degree() + 1> vals_ptr;
520 Kokkos::mdspan<double, Kokkos::extents<std::size_t, bsplines_type::degree() + 1>> const
521 vals(vals_ptr.data());
522 ddc::Coordinate<continuous_dimension_type> const coord_eval_interest(coord_eval);
523 if constexpr (std::is_same_v<EvalType, eval_type>) {
524 jmin = ddc::discrete_space<bsplines_type>().eval_basis(vals, coord_eval_interest);
525 } else if constexpr (std::is_same_v<EvalType, eval_deriv_type>) {
526 jmin = ddc::discrete_space<bsplines_type>().eval_deriv(vals, coord_eval_interest);
527 }
528 double y = 0.0;
529 for (std::size_t i = 0; i < bsplines_type::degree() + 1; ++i) {
530 y += spline_coef(ddc::DiscreteElement<bsplines_type>(jmin + i)) * vals[i];
531 }
532 return y;
533 }
534};
535
536} // namespace ddc
friend class DiscreteDomain
A class to evaluate, differentiate or integrate a spline function.
SplineEvaluator & operator=(SplineEvaluator &&x)=default
Move-assigns.
void integrate(ddc::ChunkSpan< double, batch_domain_type, Layout1, memory_space > const integrals, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout2, memory_space > const spline_coef) const
Perform batched 1D integrations of a spline function (described by its spline coefficients) along the...
void operator()(ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, batched_evaluation_domain_type, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout3, memory_space > const spline_coef) const
Evaluate spline function (described by its spline coefficients) on a mesh.
upper_extrapolation_rule_type upper_extrapolation_rule() const
Get the upper extrapolation rule.
lower_extrapolation_rule_type lower_extrapolation_rule() const
Get the lower extrapolation rule.
~SplineEvaluator()=default
Destructs.
SplineEvaluator(SplineEvaluator const &x)=default
Copy-constructs.
SplineEvaluator(LowerExtrapolationRule const &lower_extrap_rule, UpperExtrapolationRule const &upper_extrap_rule)
Build a SplineEvaluator acting on batched_spline_domain.
void deriv(ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout2, memory_space > const spline_coef) const
Differentiate spline function (described by its spline coefficients) on a mesh.
SplineEvaluator & operator=(SplineEvaluator const &x)=default
Copy-assigns.
void deriv(ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, batched_evaluation_domain_type, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout3, memory_space > const spline_coef) const
Differentiate spline function (described by its spline coefficients) on a mesh.
KOKKOS_FUNCTION double deriv(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.
void operator()(ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout2, memory_space > const spline_coef) const
Evaluate a spline function (described by its spline coefficients) on a mesh.
SplineEvaluator(SplineEvaluator &&x)=default
Move-constructs.
KOKKOS_FUNCTION double operator()(ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.
The top-level namespace of DDC.