Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_Splines.hpp
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2018-2023 by the Cabana authors *
3 * All rights reserved. *
4 * *
5 * This file is part of the Cabana library. Cabana is distributed under a *
6 * BSD 3-clause license. For the licensing terms see the LICENSE file in *
7 * the top-level directory. *
8 * *
9 * SPDX-License-Identifier: BSD-3-Clause *
10 ****************************************************************************/
11
16#ifndef CABANA_GRID_SPLINES_HPP
17#define CABANA_GRID_SPLINES_HPP
18
20#include <Cabana_Grid_Types.hpp>
21
22#include <Kokkos_Core.hpp>
23
24#include <type_traits>
25
26namespace Cabana
27{
28namespace Grid
29{
30//---------------------------------------------------------------------------//
32template <int Order>
33struct Spline;
34
35//---------------------------------------------------------------------------//
37template <>
38struct Spline<0>
39{
41 static constexpr int order = 0;
42
44 static constexpr int num_knot = 1;
45
59 template <class Scalar>
60 KOKKOS_INLINE_FUNCTION static Scalar
61 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
62 {
63 return ( xp - low_x ) * rdx + 0.5;
64 }
65
71 KOKKOS_INLINE_FUNCTION
72 static void offsets( int indices[num_knot] ) { indices[0] = 0; }
73
79 template <class Scalar>
80 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
81 int indices[num_knot] )
82 {
83 indices[0] = static_cast<int>( x0 );
84 }
85
93 template <typename Scalar>
94 KOKKOS_INLINE_FUNCTION static void value( const Scalar,
95 Scalar values[num_knot] )
96 {
97 // Knot at i
98 values[0] = 1.0;
99 }
100
111 template <typename Scalar>
112 KOKKOS_INLINE_FUNCTION static void gradient( const Scalar, const Scalar,
113 Scalar gradients[num_knot] )
114 {
115 // Knot at i.
116 gradients[0] = 0.0;
117 }
118};
119
120//---------------------------------------------------------------------------//
122template <>
123struct Spline<1>
124{
126 static constexpr int order = 1;
127
129 static constexpr int num_knot = 2;
130
144 template <class Scalar>
145 KOKKOS_INLINE_FUNCTION static Scalar
146 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
147 {
148 return ( xp - low_x ) * rdx;
149 }
150
156 KOKKOS_INLINE_FUNCTION
157 static void offsets( int indices[num_knot] )
158 {
159 indices[0] = 0;
160 indices[1] = 1;
161 }
162
168 template <class Scalar>
169 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
170 int indices[num_knot] )
171 {
172 indices[0] = static_cast<int>( x0 );
173 indices[1] = indices[0] + 1;
174 }
175
183 template <typename Scalar>
184 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
185 Scalar values[num_knot] )
186 {
187 // Knot at i
188 Scalar xn = x0 - static_cast<int>( x0 );
189 values[0] = 1.0 - xn;
190
191 // Knot at i + 1
192 values[1] = xn;
193 }
194
204 template <typename Scalar>
205 KOKKOS_INLINE_FUNCTION static void gradient( const Scalar, const Scalar rdx,
206 Scalar gradients[num_knot] )
207 {
208 // Knot at i.
209 gradients[0] = -rdx;
210
211 // Knot at i + 1;
212 gradients[1] = rdx;
213 }
214};
215
216//---------------------------------------------------------------------------//
218template <>
219struct Spline<2>
220{
222 static constexpr int order = 2;
223
225 static constexpr int num_knot = 3;
226
239 template <class Scalar>
240 KOKKOS_INLINE_FUNCTION static Scalar
241 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
242 {
243 return ( xp - low_x ) * rdx + 0.5;
244 }
245
251 KOKKOS_INLINE_FUNCTION
252 static void offsets( int indices[num_knot] )
253 {
254 indices[0] = -1;
255 indices[1] = 0;
256 indices[2] = 1;
257 }
258
264 template <class Scalar>
265 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
266 int indices[num_knot] )
267 {
268 indices[0] = static_cast<int>( x0 ) - 1;
269 indices[1] = indices[0] + 1;
270 indices[2] = indices[1] + 1;
271 }
272
280 template <typename Scalar>
281 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
282 Scalar values[num_knot] )
283 {
284 // Constants
285 Scalar nine_eights = 9.0 / 8.0;
286
287 // Knot at i - 1
288 Scalar xn = x0 - static_cast<int>( x0 ) + 0.5;
289 values[0] = 0.5 * xn * xn - 1.5 * xn + nine_eights;
290
291 // Knot at i
292 xn -= 1.0;
293 values[1] = -xn * xn + 0.75;
294
295 // Knot at i + 1
296 xn -= 1.0;
297 values[2] = 0.5 * xn * xn + 1.5 * xn + nine_eights;
298 }
299
309 template <typename Scalar>
310 KOKKOS_INLINE_FUNCTION static void
311 gradient( const Scalar x0, const Scalar rdx, Scalar gradients[num_knot] )
312 {
313 // Knot at i - 1
314 Scalar xn = x0 - static_cast<int>( x0 ) + 0.5;
315 gradients[0] = ( xn - 1.5 ) * rdx;
316
317 // Knot at i
318 xn -= 1.0;
319 gradients[1] = ( -2.0 * xn ) * rdx;
320
321 // Knot at i + 1
322 xn -= 1.0;
323 gradients[2] = ( xn + 1.5 ) * rdx;
324 }
325};
326
327//---------------------------------------------------------------------------//
329template <>
330struct Spline<3>
331{
333 static constexpr int order = 3;
334
336 static constexpr int num_knot = 4;
337
350 template <class Scalar>
351 KOKKOS_INLINE_FUNCTION static Scalar
352 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
353 {
354 return ( xp - low_x ) * rdx;
355 }
356
362 KOKKOS_INLINE_FUNCTION
363 static void offsets( int indices[num_knot] )
364 {
365 indices[0] = -1;
366 indices[1] = 0;
367 indices[2] = 1;
368 indices[3] = 2;
369 }
370
376 template <class Scalar>
377 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
378 int indices[num_knot] )
379 {
380 indices[0] = static_cast<int>( x0 ) - 1;
381 indices[1] = indices[0] + 1;
382 indices[2] = indices[1] + 1;
383 indices[3] = indices[2] + 1;
384 }
385
393 template <typename Scalar>
394 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
395 Scalar values[num_knot] )
396 {
397 // Constants
398 Scalar one_sixth = 1.0 / 6.0;
399 Scalar two_thirds = one_sixth * 4.0;
400 Scalar four_thirds = two_thirds * 2.0;
401
402 // Knot at i - 1
403 Scalar xn = x0 - static_cast<int>( x0 ) + 1.0;
404 Scalar xn2 = xn * xn;
405 values[0] = -xn * xn2 * one_sixth + xn2 - 2.0 * xn + four_thirds;
406
407 // Knot at i
408 xn -= 1.0;
409 xn2 = xn * xn;
410 values[1] = 0.5 * xn * xn2 - xn2 + two_thirds;
411
412 // Knot at i + 1
413 xn -= 1.0;
414 xn2 = xn * xn;
415 values[2] = -0.5 * xn * xn2 - xn2 + two_thirds;
416
417 // Knot at i + 2
418 xn -= 1.0;
419 xn2 = xn * xn;
420 values[3] = xn * xn2 * one_sixth + xn2 + 2.0 * xn + four_thirds;
421 }
422
432 template <typename Scalar>
433 KOKKOS_INLINE_FUNCTION static void
434 gradient( const Scalar x0, const Scalar rdx, Scalar gradients[num_knot] )
435 {
436 // Knot at i - 1
437 Scalar xn = x0 - static_cast<int>( x0 ) + 1.0;
438 gradients[0] = ( -0.5 * xn * xn + 2.0 * xn - 2.0 ) * rdx;
439
440 // Knot at i
441 xn -= 1.0;
442 gradients[1] = ( 1.5 * xn * xn - 2.0 * xn ) * rdx;
443
444 // Knot at i + 1
445 xn -= 1.0;
446 gradients[2] = ( -1.5 * xn * xn - 2.0 * xn ) * rdx;
447
448 // Knot at i + 2
449 xn -= 1.0;
450 gradients[3] = ( 0.5 * xn * xn + 2.0 * xn + 2.0 ) * rdx;
451 }
452};
453
455template <>
456struct Spline<4>
457{
459 static constexpr int order = 4;
460
462 static constexpr int num_knot = 5;
463
476 template <class Scalar>
477 KOKKOS_INLINE_FUNCTION static Scalar
478 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
479 {
480 return ( xp - low_x ) * rdx + 0.5;
481 }
482
488 KOKKOS_INLINE_FUNCTION
489 static void offsets( int indices[num_knot] )
490 {
491 indices[0] = -2;
492 indices[1] = -1;
493 indices[2] = 0;
494 indices[3] = 1;
495 indices[4] = 2;
496 }
497
503 template <class Scalar>
504 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
505 int indices[num_knot] )
506 {
507 indices[0] = static_cast<int>( x0 ) - 2;
508 indices[1] = indices[0] + 1;
509 indices[2] = indices[1] + 1;
510 indices[3] = indices[2] + 1;
511 indices[4] = indices[3] + 1;
512 }
513
521 template <typename Scalar>
522 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
523 Scalar values[num_knot] )
524 {
525 // Constants
526 Scalar denom_2 = 1.0 / 384.0;
527 Scalar denom_1 = denom_2 * 4.0;
528 Scalar denom_0 = denom_2 * 2.0;
529
530 // Knot at i - 2
531 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
532 Scalar xn2 = xn * xn;
533 Scalar xn4 = xn2 * xn2;
534 values[0] =
535 ( 16.0 * xn4 - 32.0 * xn * xn2 + 24.0 * xn2 - 8.0 * xn + 1.0 ) *
536 denom_2;
537
538 // Knot at i - 1
539 values[1] =
540 ( -16.0 * xn4 + 16.0 * xn * xn2 + 24.0 * xn2 - 44.0 * xn + 19.0 ) *
541 denom_1;
542
543 // Knot at i
544 values[2] = ( 48.0 * xn4 - 120.0 * xn2 + 115.0 ) * denom_0;
545
546 // Knot at i + 1
547 values[3] =
548 ( -16.0 * xn4 - 16.0 * xn * xn2 + 24.0 * xn2 + 44.0 * xn + 19.0 ) *
549 denom_1;
550
551 // Knot at i + 2
552 values[4] =
553 ( 16.0 * xn4 + 32.0 * xn * xn2 + 24.0 * xn2 + 8.0 * xn + 1 ) *
554 denom_2;
555 }
556
566 template <typename Scalar>
567 KOKKOS_INLINE_FUNCTION static void
568 gradient( const Scalar x0, const Scalar rdx, Scalar gradients[num_knot] )
569 {
570 // Constants
571 Scalar denom_2 = 1.0 / 48.0;
572 Scalar denom_1 = denom_2 * 2.0;
573 Scalar denom_0 = denom_2 * 12.0;
574
575 // Knot at i - 2
576 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
577 Scalar xn2 = xn * xn;
578 gradients[0] =
579 ( 8.0 * xn * xn2 - 12.0 * xn2 + 6.0 * xn - 1.0 ) * denom_2 * rdx;
580
581 // Knot at i - 1
582 gradients[1] = ( -16.0 * xn * xn2 + 12.0 * xn2 + 12.0 * xn - 11.0 ) *
583 denom_1 * rdx;
584
585 // Knot at i
586 gradients[2] = ( 4.0 * xn * xn2 - 5.0 * xn ) * denom_0 * rdx;
587
588 // Knot at i + 1
589 gradients[3] = ( -16.0 * xn * xn2 - 12.0 * xn2 + 12.0 * xn + 11.0 ) *
590 denom_1 * rdx;
591
592 // Knot at i + 2
593 gradients[4] =
594 ( 8.0 * xn * xn2 + 12.0 * xn2 + 6.0 * xn + 1.0 ) * denom_2 * rdx;
595 }
596};
597
599template <>
600struct Spline<5>
601{
603 static constexpr int order = 5;
604
606 static constexpr int num_knot = 6;
607
620 template <class Scalar>
621 KOKKOS_INLINE_FUNCTION static Scalar
622 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
623 {
624 return ( xp - low_x ) * rdx;
625 }
626
632 KOKKOS_INLINE_FUNCTION
633 static void offsets( int indices[num_knot] )
634 {
635 indices[0] = -2;
636 indices[1] = -1;
637 indices[2] = 0;
638 indices[3] = 1;
639 indices[4] = 2;
640 indices[5] = 3;
641 }
642
648 template <class Scalar>
649 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
650 int indices[num_knot] )
651 {
652 indices[0] = static_cast<int>( x0 ) - 2;
653 indices[1] = indices[0] + 1;
654 indices[2] = indices[1] + 1;
655 indices[3] = indices[2] + 1;
656 indices[4] = indices[3] + 1;
657 indices[5] = indices[4] + 1;
658 }
659
667 template <typename Scalar>
668 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
669 Scalar values[num_knot] )
670 {
671 // Constants
672 Scalar denom_2 = 1.0 / 3840.0;
673 Scalar denom_1 = denom_2 * 2.0;
674
675 // Knot at i - 2
676 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
677 Scalar xn2 = xn * xn;
678 Scalar xn4 = xn2 * xn2;
679 values[0] = ( -32.0 * xn * xn4 + 80.0 * xn4 - 80.0 * xn * xn2 +
680 40.0 * xn2 - 10.0 * xn + 1.0 ) *
681 denom_2;
682
683 // Knot at i - 1
684 values[1] = ( 160.0 * xn * xn4 - 240.0 * xn4 - 240.0 * xn * xn2 +
685 840.0 * xn2 - 750.0 * xn + 237.0 ) *
686 denom_2;
687
688 // Knot at i
689 values[2] = ( -160.0 * xn * xn4 + 80.0 * xn4 + 560.0 * xn * xn2 -
690 440.0 * xn2 - 770.0 * xn + 841.0 ) *
691 denom_1;
692
693 // Knot at i + 1
694 values[3] = ( 160.0 * xn * xn4 + 80.0 * xn4 - 560.0 * xn * xn2 -
695 440.0 * xn2 + 770.0 * xn + 841.0 ) *
696 denom_1;
697
698 // Knot at i + 2
699 values[4] = ( -160.0 * xn * xn4 - 240.0 * xn4 + 240.0 * xn * xn2 +
700 840.0 * xn2 + 750.0 * xn + 237.0 ) *
701 denom_2;
702
703 // Knot at i + 3
704 values[5] = ( 32.0 * xn * xn4 + 80.0 * xn4 + 80.0 * xn * xn2 +
705 40.0 * xn2 + 10.0 * xn + 1.0 ) *
706 denom_2;
707 }
708
718 template <typename Scalar>
719 KOKKOS_INLINE_FUNCTION static void
720 gradient( const Scalar x0, const Scalar rdx, Scalar gradients[num_knot] )
721 {
722 // Constants
723 Scalar denom_2 = 1.0 / 384.0;
724 Scalar denom_1 = denom_2 * 2.0;
725
726 // Knot at i - 2
727 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
728 Scalar xn2 = xn * xn;
729 Scalar xn4 = xn2 * xn2;
730 gradients[0] =
731 ( -16.0 * xn4 + 32.0 * xn * xn2 - 24.0 * xn2 + 8.0 * xn - 1.0 ) *
732 denom_2 * rdx;
733
734 // Knot at i - 1
735 gradients[1] =
736 ( 80.0 * xn4 - 96.0 * xn * xn2 - 72.0 * xn2 + 168.0 * xn - 75.0 ) *
737 denom_2 * rdx;
738
739 // Knot at i
740 gradients[2] =
741 ( -80.0 * xn4 + 32.0 * xn * xn2 + 168.0 * xn2 - 88.0 * xn - 77.0 ) *
742 denom_1 * rdx;
743
744 // Knot at i + 1
745 gradients[3] =
746 ( 80.0 * xn4 + 32.0 * xn * xn2 - 168.0 * xn2 - 88.0 * xn + 77.0 ) *
747 denom_1 * rdx;
748
749 // Knot at i + 2
750 gradients[4] =
751 ( -80.0 * xn4 - 96.0 * xn * xn2 + 72.0 * xn2 + 168.0 * xn + 75.0 ) *
752 denom_2 * rdx;
753
754 // Knot at i + 3
755 gradients[5] =
756 ( 16.0 * xn4 + 32.0 * xn * xn2 + 24.0 * xn2 + 8.0 * xn + 1.0 ) *
757 denom_2 * rdx;
758 }
759};
760
762template <>
763struct Spline<6>
764{
766 static constexpr int order = 6;
767
769 static constexpr int num_knot = 7;
770
783 template <class Scalar>
784 KOKKOS_INLINE_FUNCTION static Scalar
785 mapToLogicalGrid( const Scalar xp, const Scalar rdx, const Scalar low_x )
786 {
787 return ( xp - low_x ) * rdx + 0.5;
788 }
789
795 KOKKOS_INLINE_FUNCTION
796 static void offsets( int indices[num_knot] )
797 {
798 indices[0] = -3;
799 indices[1] = -2;
800 indices[2] = -1;
801 indices[3] = 0;
802 indices[4] = 1;
803 indices[5] = 2;
804 indices[6] = 3;
805 }
806
812 template <class Scalar>
813 KOKKOS_INLINE_FUNCTION static void stencil( const Scalar x0,
814 int indices[num_knot] )
815 {
816 indices[0] = static_cast<int>( x0 ) - 3;
817 indices[1] = indices[0] + 1;
818 indices[2] = indices[1] + 1;
819 indices[3] = indices[2] + 1;
820 indices[4] = indices[3] + 1;
821 indices[5] = indices[4] + 1;
822 indices[6] = indices[5] + 1;
823 }
824
832 template <typename Scalar>
833 KOKKOS_INLINE_FUNCTION static void value( const Scalar x0,
834 Scalar values[num_knot] )
835 {
836 // Constants
837 Scalar denom_31 = 1.0 / 46080.0;
838 Scalar denom_2 = denom_31 * 2.0;
839 Scalar denom_0 = denom_2 * 2.0;
840
841 // Knot at i - 3
842 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
843 Scalar xn2 = xn * xn;
844 Scalar xn4 = xn2 * xn2;
845 Scalar xn6 = xn2 * xn4;
846 values[0] = ( 64.0 * xn6 - 192.0 * xn * xn4 + 240.0 * xn4 -
847 160.0 * xn * xn2 + 60.0 * xn2 - 12.0 * xn + 1.0 ) *
848 denom_31;
849
850 // Knot at i - 2
851 values[1] = ( -192.0 * xn6 + 384.0 * xn * xn4 + 240.0 * xn4 -
852 1600.0 * xn * xn2 + 2220.0 * xn2 - 1416.0 * xn + 361.0 ) *
853 denom_2;
854
855 // Knot at i - 1
856 values[2] =
857 ( 960.0 * xn6 - 960.0 * xn * xn4 - 4080.0 * xn4 +
858 6880.0 * xn * xn2 + 4740.0 * xn2 - 17340.0 * xn + 10543.0 ) *
859 denom_31;
860
861 // Knot at i
862 values[3] =
863 ( -320.0 * xn6 + 1680.0 * xn4 - 4620.0 * xn2 + 5887.0 ) * denom_0;
864
865 // Knot at i + 1
866 values[4] =
867 ( 960.0 * xn6 + 960.0 * xn * xn4 - 4080.0 * xn4 -
868 6880.0 * xn * xn2 + 4740.0 * xn2 + 17340.0 * xn + 10543.0 ) *
869 denom_31;
870
871 // Knot at i + 2
872 values[5] = ( -192.0 * xn6 - 384.0 * xn * xn4 + 240.0 * xn4 +
873 1600.0 * xn * xn2 + 2220.0 * xn2 + 1416.0 * xn + 361.0 ) *
874 denom_2;
875
876 // Knot at i + 3
877 values[6] = ( 64.0 * xn6 + 192.0 * xn * xn4 + 240.0 * xn4 +
878 160.0 * xn * xn2 + 60.0 * xn2 + 12.0 * xn + 1.0 ) *
879 denom_31;
880 }
881
891 template <typename Scalar>
892 KOKKOS_INLINE_FUNCTION static void
893 gradient( const Scalar x0, const Scalar rdx, Scalar gradients[num_knot] )
894 {
895 // Constants
896 Scalar denom_3 = 1.0 / 3840.0;
897 Scalar denom_2 = denom_3 * 4.0;
898 Scalar denom_1 = denom_3 * 5.0;
899 Scalar denom_0 = denom_3 * 40.0;
900
901 // Knot at i - 2
902 Scalar xn = x0 - static_cast<int>( x0 ) - 0.5;
903 Scalar xn2 = xn * xn;
904 Scalar xn4 = xn2 * xn2;
905 gradients[0] = ( 32.0 * xn * xn4 - 80.0 * xn4 + 80.0 * xn * xn2 -
906 40.0 * xn2 + 10.0 * xn - 1.0 ) *
907 denom_3 * rdx;
908
909 // Knot at i - 2
910 gradients[1] = ( -48.0 * xn * xn4 + 80.0 * xn4 + 40.0 * xn * xn2 -
911 200.0 * xn2 + 185.0 * xn - 59.0 ) *
912 denom_2 * rdx;
913
914 // Knot at i - 1
915 gradients[2] = ( 96.0 * xn * xn4 - 80.0 * xn4 - 272.0 * xn * xn2 +
916 344.0 * xn2 + 158.0 * xn - 289.0 ) *
917 denom_1 * rdx;
918
919 // Knot at i
920 gradients[3] =
921 ( -16.0 * xn * xn4 + 56.0 * xn * xn2 - 77.0 * xn ) * denom_0 * rdx;
922
923 // Knot at i + 1
924 gradients[4] = ( 96.0 * xn * xn4 + 80.0 * xn4 - 272.0 * xn * xn2 -
925 344.0 * xn2 + 158.0 * xn + 289.0 ) *
926 denom_1 * rdx;
927
928 // Knot at i + 2
929 gradients[5] = ( -48.0 * xn * xn4 - 80.0 * xn4 + 40.0 * xn * xn2 +
930 200.0 * xn2 + 185.0 * xn + 59.0 ) *
931 denom_2 * rdx;
932
933 // Knot at i + 3
934 gradients[6] = ( 32.0 * xn * xn4 + 80.0 * xn4 + 80.0 * xn * xn2 +
935 40.0 * xn2 + 10.0 * xn + 1.0 ) *
936 denom_3 * rdx;
937 }
938};
939
940//---------------------------------------------------------------------------//
941// Spline Data
942//---------------------------------------------------------------------------//
945{
946};
947
949{
950};
951
953{
954};
955
957{
958};
959
963
965template <class... DataTags>
967{
968};
969
971template <typename T, typename SplineDataMemberTypes_t>
973
975template <typename T>
976struct has_spline_tag<T, SplineDataMemberTypes<>> : std::false_type
977{
978};
979
980template <typename T, typename U, typename... Tags>
981struct has_spline_tag<T, SplineDataMemberTypes<U, Tags...>>
982 : has_spline_tag<T, SplineDataMemberTypes<Tags...>>
983{
984};
985template <typename T, typename... Tags>
986struct has_spline_tag<T, SplineDataMemberTypes<T, Tags...>> : std::true_type
987{
988};
990
992template <typename Scalar, int Order, std::size_t NumSpaceDim, class Tag>
994
996template <typename Scalar, int Order, std::size_t NumSpaceDim>
997struct SplineDataMember<Scalar, Order, NumSpaceDim, SplinePhysicalCellSize>
998{
1000 Scalar dx[NumSpaceDim];
1001};
1002
1004template <typename Scalar, int Order, std::size_t NumSpaceDim>
1005struct SplineDataMember<Scalar, Order, NumSpaceDim, SplineLogicalPosition>
1006{
1008 Scalar x[NumSpaceDim];
1009};
1010
1012template <typename Scalar, int Order, std::size_t NumSpaceDim>
1013struct SplineDataMember<Scalar, Order, NumSpaceDim, SplinePhysicalDistance>
1014{
1018 static constexpr int num_knot = spline_type::num_knot;
1019
1021 Scalar d[NumSpaceDim][num_knot];
1022};
1023
1025template <typename Scalar, int Order, std::size_t NumSpaceDim>
1026struct SplineDataMember<Scalar, Order, NumSpaceDim, SplineWeightValues>
1027{
1031 static constexpr int num_knot = spline_type::num_knot;
1032
1034 Scalar w[NumSpaceDim][num_knot];
1035};
1036
1038template <typename Scalar, int Order, std::size_t NumSpaceDim>
1039struct SplineDataMember<Scalar, Order, NumSpaceDim,
1041{
1045 static constexpr int num_knot = spline_type::num_knot;
1046
1048 Scalar g[NumSpaceDim][num_knot];
1049};
1050
1052template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1053 class Tags = void>
1055
1057template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType>
1058struct SplineData<Scalar, Order, NumSpaceDim, EntityType, void>
1059 : SplineDataMember<Scalar, Order, NumSpaceDim, SplinePhysicalCellSize>,
1060 SplineDataMember<Scalar, Order, NumSpaceDim, SplineLogicalPosition>,
1061 SplineDataMember<Scalar, Order, NumSpaceDim, SplinePhysicalDistance>,
1062 SplineDataMember<Scalar, Order, NumSpaceDim, SplineWeightValues>,
1063 SplineDataMember<Scalar, Order, NumSpaceDim,
1064 SplineWeightPhysicalGradients>
1065{
1067 using scalar_type = Scalar;
1069 static constexpr int order = Order;
1073 static constexpr int num_knot = spline_type::num_knot;
1075 using entity_type = EntityType;
1077 static constexpr std::size_t num_space_dim = NumSpaceDim;
1078
1080 static constexpr bool has_physical_cell_size = true;
1082 static constexpr bool has_logical_position = true;
1084 static constexpr bool has_physical_distance = true;
1086 static constexpr bool has_weight_values = true;
1088 static constexpr bool has_weight_physical_gradients = true;
1089
1091 int s[NumSpaceDim][num_knot];
1092};
1093
1095template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1096 class... Tags>
1097struct SplineData<Scalar, Order, NumSpaceDim, EntityType,
1098 SplineDataMemberTypes<Tags...>>
1099 : SplineDataMember<Scalar, Order, NumSpaceDim, Tags>...
1100{
1102 using scalar_type = Scalar;
1104 static constexpr int order = Order;
1108 static constexpr int num_knot = spline_type::num_knot;
1110 using entity_type = EntityType;
1112 static constexpr std::size_t num_space_dim = NumSpaceDim;
1113
1117 static constexpr bool has_physical_cell_size =
1120 static constexpr bool has_logical_position =
1123 static constexpr bool has_physical_distance =
1126 static constexpr bool has_weight_values =
1129 static constexpr bool has_weight_physical_gradients =
1131
1133 int s[NumSpaceDim][num_knot];
1134};
1135
1137template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1138 class DataTags>
1139KOKKOS_INLINE_FUNCTION
1140 std::enable_if_t<SplineData<Scalar, Order, NumSpaceDim, EntityType,
1141 DataTags>::has_physical_cell_size>
1145 const int d, const Scalar dx )
1146{
1147 data.dx[d] = dx;
1148}
1149
1150template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1151 class DataTags>
1152KOKKOS_INLINE_FUNCTION std::enable_if_t<!SplineData<
1153 Scalar, Order, NumSpaceDim, EntityType, DataTags>::has_physical_cell_size>
1159
1161template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1162 class DataTags>
1163KOKKOS_INLINE_FUNCTION
1164 std::enable_if_t<SplineData<Scalar, Order, NumSpaceDim, EntityType,
1165 DataTags>::has_logical_position>
1169 const int d, const Scalar x )
1170{
1171 data.x[d] = x;
1172}
1173
1174template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1175 class DataTags>
1176KOKKOS_INLINE_FUNCTION std::enable_if_t<!SplineData<
1177 Scalar, Order, NumSpaceDim, EntityType, DataTags>::has_logical_position>
1183
1185template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1186 class DataTags>
1187KOKKOS_INLINE_FUNCTION
1188 std::enable_if_t<SplineData<Scalar, Order, NumSpaceDim, EntityType,
1189 DataTags>::has_weight_values>
1193 const Scalar x[NumSpaceDim] )
1194
1195{
1196 using spline_type = typename SplineData<Scalar, Order, NumSpaceDim,
1197 EntityType, DataTags>::spline_type;
1198 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1199 spline_type::value( x[d], data.w[d] );
1200}
1201
1202template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1203 class DataTags>
1204KOKKOS_INLINE_FUNCTION std::enable_if_t<!SplineData<
1205 Scalar, Order, NumSpaceDim, EntityType, DataTags>::has_weight_values>
1212
1214template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1215 class DataTags>
1216KOKKOS_INLINE_FUNCTION
1217 std::enable_if_t<SplineData<Scalar, Order, NumSpaceDim, EntityType,
1218 DataTags>::has_weight_physical_gradients>
1222 const Scalar x[NumSpaceDim], const Scalar rdx[NumSpaceDim] )
1223
1224{
1225 using spline_type = typename SplineData<Scalar, Order, NumSpaceDim,
1226 EntityType, DataTags>::spline_type;
1227 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1228 spline_type::gradient( x[d], rdx[d], data.g[d] );
1229}
1230
1231template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1232 class DataTags>
1233KOKKOS_INLINE_FUNCTION
1234 std::enable_if_t<!SplineData<Scalar, Order, NumSpaceDim, EntityType,
1235 DataTags>::has_weight_physical_gradients>
1239 const Scalar[NumSpaceDim], const Scalar[NumSpaceDim] )
1240
1241{
1242}
1243
1245template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1246 class DataTags>
1247KOKKOS_INLINE_FUNCTION
1248 std::enable_if_t<SplineData<Scalar, Order, NumSpaceDim, EntityType,
1249 DataTags>::has_physical_distance>
1253 const Scalar low_x[NumSpaceDim], const Scalar p[NumSpaceDim],
1254 const Scalar dx[NumSpaceDim] )
1255
1256{
1257 using spline_type = typename SplineData<Scalar, Order, NumSpaceDim,
1258 EntityType, DataTags>::spline_type;
1259 Scalar offset;
1260 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1261 {
1262 offset = low_x[d] - p[d];
1263 for ( int n = 0; n < spline_type::num_knot; ++n )
1264 data.d[d][n] = offset + data.s[d][n] * dx[d];
1265 }
1266}
1267
1268template <typename Scalar, int Order, std::size_t NumSpaceDim, class EntityType,
1269 class DataTags>
1270KOKKOS_INLINE_FUNCTION std::enable_if_t<!SplineData<
1271 Scalar, Order, NumSpaceDim, EntityType, DataTags>::has_physical_distance>
1274 const Scalar[NumSpaceDim], const Scalar[NumSpaceDim],
1275 const Scalar[NumSpaceDim] )
1276{
1277}
1278
1279//---------------------------------------------------------------------------//
1281template <typename Scalar, int Order, std::size_t NumSpaceDim,
1282 class MemorySpace, class EntityType, class DataTags>
1283KOKKOS_INLINE_FUNCTION void evaluateSpline(
1284 const LocalMesh<MemorySpace, UniformMesh<Scalar, NumSpaceDim>>& local_mesh,
1285 const Scalar p[NumSpaceDim],
1287{
1288 // data type
1289 using sd_type =
1291
1292 // spline type.
1293
1294 // Get the low corner of the mesh.
1295 Scalar low_x[NumSpaceDim];
1296 Scalar low_x_p1[NumSpaceDim];
1297 int low_id[NumSpaceDim];
1298 int low_id_p1[NumSpaceDim];
1299 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1300 {
1301 low_id[d] = 0;
1302 low_id_p1[d] = 1;
1303 }
1304 local_mesh.coordinates( EntityType(), low_id, low_x );
1305 local_mesh.coordinates( EntityType(), low_id_p1, low_x_p1 );
1306
1307 // Compute the physical cell size.
1308 Scalar dx[NumSpaceDim];
1309 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1310 {
1311 dx[d] = low_x_p1[d] - low_x[d];
1312 setSplineData( SplinePhysicalCellSize(), data, d, dx[d] );
1313 }
1314
1315 // Compute the inverse physicall cell size.
1316 Scalar rdx[NumSpaceDim];
1317 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1318 rdx[d] = 1.0 / dx[d];
1319
1320 // Compute the reference coordinates.
1321 Scalar x[NumSpaceDim];
1322 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1323 {
1324 x[d] = sd_type::spline_type::mapToLogicalGrid( p[d], rdx[d], low_x[d] );
1325 setSplineData( SplineLogicalPosition(), data, d, x[d] );
1326 }
1327
1328 // Compute the stencil.
1329 for ( std::size_t d = 0; d < NumSpaceDim; ++d )
1330 {
1331 sd_type::spline_type::stencil( x[d], data.s[d] );
1332 }
1333
1334 // Compute the weight values.
1335 setSplineData( SplineWeightValues(), data, x );
1336
1337 // Compute the weight gradients.
1339
1340 // Compute the physical distance.
1341 setSplineData( SplinePhysicalDistance(), data, low_x, p, dx );
1342}
1343
1344//---------------------------------------------------------------------------//
1345
1346} // namespace Grid
1347} // namespace Cabana
1348
1349#endif // end CABANA_GRID_SPLINES_HPP
KOKKOS_INLINE_FUNCTION std::enable_if_t< SplineData< Scalar, Order, NumSpaceDim, EntityType, DataTags >::has_physical_cell_size > setSplineData(SplinePhysicalCellSize, SplineData< Scalar, Order, NumSpaceDim, EntityType, DataTags > &data, const int d, const Scalar dx)
Assign physical cell size to the spline data.
Definition Cabana_Grid_Splines.hpp:1142
KOKKOS_INLINE_FUNCTION void evaluateSpline(const LocalMesh< MemorySpace, UniformMesh< Scalar, NumSpaceDim > > &local_mesh, const Scalar p[NumSpaceDim], SplineData< Scalar, Order, NumSpaceDim, EntityType, DataTags > &data)
Evaluate spline data at a point in a uniform mesh.
Definition Cabana_Grid_Splines.hpp:1283
Grid type tags.
Definition Cabana_Grid_LocalMesh.hpp:33
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Spline data members holder.
Definition Cabana_Grid_Splines.hpp:967
Scalar x[NumSpaceDim]
Logical position.
Definition Cabana_Grid_Splines.hpp:1008
Scalar dx[NumSpaceDim]
Physical cell size.
Definition Cabana_Grid_Splines.hpp:1000
Scalar d[NumSpaceDim][num_knot]
Physical distance.
Definition Cabana_Grid_Splines.hpp:1021
Spline< Order > spline_type
Spline type.
Definition Cabana_Grid_Splines.hpp:1016
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:1018
Scalar g[NumSpaceDim][num_knot]
Weight physical gradients.
Definition Cabana_Grid_Splines.hpp:1048
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:1045
Spline< Order > spline_type
Spline type.
Definition Cabana_Grid_Splines.hpp:1043
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:1031
Spline< Order > spline_type
Spline type.
Definition Cabana_Grid_Splines.hpp:1029
Scalar w[NumSpaceDim][num_knot]
Weight values.
Definition Cabana_Grid_Splines.hpp:1034
Spline data member.
Definition Cabana_Grid_Splines.hpp:993
static constexpr bool has_physical_distance
Is physical distance present.
Definition Cabana_Grid_Splines.hpp:1123
Scalar scalar_type
Spline scalar type.
Definition Cabana_Grid_Splines.hpp:1102
int s[NumSpaceDim][num_knot]
Local interpolation stencil.
Definition Cabana_Grid_Splines.hpp:1133
SplineDataMemberTypes< Tags... > member_tags
Spline member types.
Definition Cabana_Grid_Splines.hpp:1115
static constexpr bool has_weight_physical_gradients
Are weight physical gradients present.
Definition Cabana_Grid_Splines.hpp:1129
static constexpr bool has_physical_cell_size
Is physical cell size present.
Definition Cabana_Grid_Splines.hpp:1117
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:1108
Spline< Order > spline_type
Spline type.
Definition Cabana_Grid_Splines.hpp:1106
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_Splines.hpp:1112
static constexpr int order
Spline order.
Definition Cabana_Grid_Splines.hpp:1104
static constexpr bool has_logical_position
Is logical position present.
Definition Cabana_Grid_Splines.hpp:1120
static constexpr bool has_weight_values
Are weight values present.
Definition Cabana_Grid_Splines.hpp:1126
static constexpr bool has_weight_values
Weight values present.
Definition Cabana_Grid_Splines.hpp:1086
static constexpr bool has_logical_position
Logical position present.
Definition Cabana_Grid_Splines.hpp:1082
Scalar scalar_type
Spline scalar type.
Definition Cabana_Grid_Splines.hpp:1067
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_Splines.hpp:1077
static constexpr bool has_weight_physical_gradients
Weight physical gradients present.
Definition Cabana_Grid_Splines.hpp:1088
int s[NumSpaceDim][num_knot]
Local interpolation stencil.
Definition Cabana_Grid_Splines.hpp:1091
static constexpr bool has_physical_cell_size
Physical cell size present.
Definition Cabana_Grid_Splines.hpp:1080
static constexpr bool has_physical_distance
Physical distance present.
Definition Cabana_Grid_Splines.hpp:1084
EntityType entity_type
Entity type.
Definition Cabana_Grid_Splines.hpp:1075
static constexpr int order
Spline order.
Definition Cabana_Grid_Splines.hpp:1069
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:1073
Spline< Order > spline_type
Spline type.
Definition Cabana_Grid_Splines.hpp:1071
Spline data container.
Definition Cabana_Grid_Splines.hpp:1054
Spline data tag: logical position.
Definition Cabana_Grid_Splines.hpp:949
Spline data tag: physical cell size.
Definition Cabana_Grid_Splines.hpp:945
Spline data tag: physical distance.
Definition Cabana_Grid_Splines.hpp:953
Spline data tag: physical gradient.
Definition Cabana_Grid_Splines.hpp:961
Spline data tag: weight value.
Definition Cabana_Grid_Splines.hpp:957
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:41
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:72
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:44
static KOKKOS_INLINE_FUNCTION void value(const Scalar, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:94
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the dual grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:61
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar, const Scalar, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:112
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:80
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the primal grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:146
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:126
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:169
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:157
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:205
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:184
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:129
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:222
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar x0, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:311
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:281
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:252
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the dual grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:241
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:265
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:225
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:394
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar x0, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:434
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:363
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:336
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:333
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the primal grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:352
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:377
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:504
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:459
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Definition Cabana_Grid_Splines.hpp:489
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar x0, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:568
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:522
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:462
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the primal grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:478
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the primal grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:622
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:606
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:633
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:649
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:668
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar x0, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:720
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:603
static KOKKOS_INLINE_FUNCTION void value(const Scalar x0, Scalar values[num_knot])
Calculate the value of the spline at all knots.
Definition Cabana_Grid_Splines.hpp:833
static constexpr int order
Order.
Definition Cabana_Grid_Splines.hpp:766
static KOKKOS_INLINE_FUNCTION Scalar mapToLogicalGrid(const Scalar xp, const Scalar rdx, const Scalar low_x)
Map a physical location to the logical space of the primal grid in a single dimension.
Definition Cabana_Grid_Splines.hpp:785
static KOKKOS_INLINE_FUNCTION void gradient(const Scalar x0, const Scalar rdx, Scalar gradients[num_knot])
Calculate the value of the gradient of the spline in the physical frame.
Definition Cabana_Grid_Splines.hpp:893
static constexpr int num_knot
The number of non-zero knots in the spline.
Definition Cabana_Grid_Splines.hpp:769
static KOKKOS_INLINE_FUNCTION void stencil(const Scalar x0, int indices[num_knot])
Compute the stencil indices for a given logical space location.
Definition Cabana_Grid_Splines.hpp:813
static KOKKOS_INLINE_FUNCTION void offsets(int indices[num_knot])
Get the logical space stencil offsets of the spline. The stencil defines the offsets into a grid fiel...
Definition Cabana_Grid_Splines.hpp:796
B-Spline interface for uniform grids.
Definition Cabana_Grid_Splines.hpp:33
Uniform mesh tag.
Definition Cabana_Grid_Types.hpp:227
Determine if a given spline tag is present.
Definition Cabana_Grid_Splines.hpp:972