256 MemorySpace::Default::kokkos_space::execution_space>::member_type
258 const Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
263#if KOKKOS_VERSION >= 40000
264 if constexpr (dim == 1)
265 apply_1d<n_q_points_1d, Number, direction, dof_to_quad, add, in_place>(
266 team_member, shape_data, in, out);
267 if constexpr (dim == 2)
268 apply_2d<n_q_points_1d, Number, direction, dof_to_quad, add, in_place>(
269 team_member, shape_data, in, out);
270 if constexpr (dim == 3)
271 apply_3d<n_q_points_1d, Number, direction, dof_to_quad, add, in_place>(
272 team_member, shape_data, in, out);
274 constexpr unsigned int n_q_points =
Utilities::pow(n_q_points_1d, dim);
276 Number t[n_q_points];
277 Kokkos::parallel_for(
278 Kokkos::TeamThreadRange(team_member, n_q_points),
279 [&](
const int &q_point) {
280 const unsigned int i = (dim == 1) ? 0 : q_point % n_q_points_1d;
281 const unsigned int j =
282 (dim == 3) ? (q_point / n_q_points_1d) % n_q_points_1d : 0;
283 const unsigned int q =
284 (dim == 1) ? q_point :
285 (dim == 2) ? (q_point / n_q_points_1d) % n_q_points_1d :
286 q_point / (n_q_points_1d * n_q_points_1d);
290 const int stride_shape = dof_to_quad ? n_q_points_1d : 1;
292 const int base_shape = dof_to_quad ? q : (q * n_q_points_1d);
294 (direction == 0) ? (n_q_points_1d * (i + n_q_points_1d * j)) :
295 (direction == 1) ? (i + n_q_points_1d * (n_q_points_1d * j)) :
296 (i + n_q_points_1d * j);
298 shape_data[base_shape] * (in_place ? out(base) : in(base));
299 for (
int k = 1; k < n_q_points_1d; ++k)
302 shape_data[base_shape + k * stride_shape] *
303 (in_place ? out(base + k * stride) : in(base + k * stride));
309 team_member.team_barrier();
311 Kokkos::parallel_for(
312 Kokkos::TeamThreadRange(team_member, n_q_points),
313 [&](
const int &q_point) {
314 const unsigned int i = (dim == 1) ? 0 : q_point % n_q_points_1d;
315 const unsigned int j =
316 (dim == 3) ? (q_point / n_q_points_1d) % n_q_points_1d : 0;
317 const unsigned int q =
318 (dim == 1) ? q_point :
319 (dim == 2) ? (q_point / n_q_points_1d) % n_q_points_1d :
320 q_point / (n_q_points_1d * n_q_points_1d);
322 const unsigned int destination_idx =
323 (direction == 0) ? (q + n_q_points_1d * (i + n_q_points_1d * j)) :
324 (direction == 1) ? (i + n_q_points_1d * (q + n_q_points_1d * j)) :
325 (i + n_q_points_1d * (j + n_q_points_1d * q));
328 Kokkos::atomic_add(&out(destination_idx), t[q_point]);
330 out(destination_idx) = t[q_point];
366 MemorySpace::Default::kokkos_space::execution_space>::member_type;
371 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> shape_values,
372 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
374 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
380 template <
typename ViewType>
382 evaluate_values(ViewType u);
388 template <
typename ViewTypeIn,
typename ViewTypeOut>
390 evaluate_gradients(
const ViewTypeIn u, ViewTypeOut grad_u);
396 template <
typename ViewType1,
typename ViewType2>
398 evaluate_values_and_gradients(ViewType1 u, ViewType2 grad_u);
403 template <
typename ViewType>
405 integrate_values(ViewType u);
411 template <
bool add,
typename ViewType1,
typename ViewType2>
413 integrate_gradients(ViewType1 u, ViewType2 grad_u);
419 template <
typename ViewType1,
typename ViewType2>
421 integrate_values_and_gradients(ViewType1 u, ViewType2 grad_u);
427 template <
int direction,
432 typename ViewTypeOut>
434 values(
const ViewTypeIn in, ViewTypeOut out)
const;
440 template <
int direction,
445 typename ViewTypeOut>
447 gradients(
const ViewTypeIn in, ViewTypeOut out)
const;
454 template <
int direction,
459 typename ViewTypeOut>
461 co_gradients(
const ViewTypeIn in, ViewTypeOut out)
const;
471 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
shape_values;
476 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
482 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
580 Number>::evaluate_values(ViewType u)
582 if constexpr (dim == 1)
583 values<0, true, false, true>(u, u);
584 else if constexpr (dim == 2)
586 values<0, true, false, true>(u, u);
587 team_member.team_barrier();
588 values<1, true, false, true>(u, u);
590 else if constexpr (dim == 3)
592 values<0, true, false, true>(u, u);
593 team_member.team_barrier();
594 values<1, true, false, true>(u, u);
595 team_member.team_barrier();
596 values<2, true, false, true>(u, u);
599 Kokkos::abort(
"dim must not exceed 3!");
611 Number>::integrate_values(ViewType u)
613 if constexpr (dim == 1)
614 values<0, false, false, true>(u, u);
615 else if constexpr (dim == 2)
617 values<0, false, false, true>(u, u);
618 team_member.team_barrier();
619 values<1, false, false, true>(u, u);
621 else if constexpr (dim == 3)
623 values<0, false, false, true>(u, u);
624 team_member.team_barrier();
625 values<1, false, false, true>(u, u);
626 team_member.team_barrier();
627 values<2, false, false, true>(u, u);
630 Kokkos::abort(
"dim must not exceed 3!");
642 Number>::evaluate_gradients(
const ViewTypeIn u,
645 if constexpr (dim == 1)
647 gradients<0, true, false, false>(
648 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
650 else if constexpr (dim == 2)
652 gradients<0, true, false, false>(
653 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
654 values<0, true, false, false>(
655 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
657 team_member.team_barrier();
659 values<1, true, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
660 Kokkos::subview(grad_u, Kokkos::ALL, 0));
661 gradients<1, true, false, true>(
662 Kokkos::subview(grad_u, Kokkos::ALL, 1),
663 Kokkos::subview(grad_u, Kokkos::ALL, 1));
665 else if constexpr (dim == 3)
667 gradients<0, true, false, false>(
668 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
669 values<0, true, false, false>(
670 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
671 values<0, true, false, false>(
672 u, Kokkos::subview(grad_u, Kokkos::ALL, 2));
674 team_member.team_barrier();
676 values<1, true, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
677 Kokkos::subview(grad_u, Kokkos::ALL, 0));
678 gradients<1, true, false, true>(
679 Kokkos::subview(grad_u, Kokkos::ALL, 1),
680 Kokkos::subview(grad_u, Kokkos::ALL, 1));
681 values<1, true, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 2),
682 Kokkos::subview(grad_u, Kokkos::ALL, 2));
684 team_member.team_barrier();
686 values<2, true, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
687 Kokkos::subview(grad_u, Kokkos::ALL, 0));
688 values<2, true, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 1),
689 Kokkos::subview(grad_u, Kokkos::ALL, 1));
690 gradients<2, true, false, true>(
691 Kokkos::subview(grad_u, Kokkos::ALL, 2),
692 Kokkos::subview(grad_u, Kokkos::ALL, 2));
695 Kokkos::abort(
"dim must not exceed 3!");
707 Number>::evaluate_values_and_gradients(ViewType1 u,
711 if constexpr (dim == 1)
713 values<0, true, false, true>(u, u);
714 team_member.team_barrier();
716 co_gradients<0, true, false, false>(
717 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
719 else if constexpr (dim == 2)
721 values<0, true, false, true>(u, u);
722 team_member.team_barrier();
723 values<1, true, false, true>(u, u);
724 team_member.team_barrier();
726 co_gradients<0, true, false, false>(
727 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
728 co_gradients<1, true, false, false>(
729 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
731 else if constexpr (dim == 3)
733 values<0, true, false, true>(u, u);
734 team_member.team_barrier();
735 values<1, true, false, true>(u, u);
736 team_member.team_barrier();
737 values<2, true, false, true>(u, u);
738 team_member.team_barrier();
740 co_gradients<0, true, false, false>(
741 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
742 co_gradients<1, true, false, false>(
743 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
744 co_gradients<2, true, false, false>(
745 u, Kokkos::subview(grad_u, Kokkos::ALL, 2));
748 Kokkos::abort(
"dim must not exceed 3!");
760 Number>::integrate_gradients(ViewType1 u,
763 if constexpr (dim == 1)
765 gradients<0, false, add, false>(
766 Kokkos::subview(grad_u, Kokkos::ALL, dim), u);
768 else if constexpr (dim == 2)
770 gradients<0, false, false, true>(
771 Kokkos::subview(grad_u, Kokkos::ALL, 0),
772 Kokkos::subview(grad_u, Kokkos::ALL, 0));
773 values<0, false, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 1),
774 Kokkos::subview(grad_u,
778 team_member.team_barrier();
780 values<1, false, add, false>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
782 team_member.team_barrier();
783 gradients<1, false, true, false>(
784 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
786 else if constexpr (dim == 3)
788 gradients<0, false, false, true>(
789 Kokkos::subview(grad_u, Kokkos::ALL, 0),
790 Kokkos::subview(grad_u, Kokkos::ALL, 0));
791 values<0, false, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 1),
792 Kokkos::subview(grad_u,
795 values<0, false, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 2),
796 Kokkos::subview(grad_u,
800 team_member.team_barrier();
802 values<1, false, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
803 Kokkos::subview(grad_u,
806 gradients<1, false, false, true>(
807 Kokkos::subview(grad_u, Kokkos::ALL, 1),
808 Kokkos::subview(grad_u, Kokkos::ALL, 1));
809 values<1, false, false, true>(Kokkos::subview(grad_u, Kokkos::ALL, 2),
810 Kokkos::subview(grad_u,
814 team_member.team_barrier();
816 values<2, false, add, false>(Kokkos::subview(grad_u, Kokkos::ALL, 0),
818 team_member.team_barrier();
819 values<2, false, true, false>(Kokkos::subview(grad_u, Kokkos::ALL, 1),
821 team_member.team_barrier();
822 gradients<2, false, true, false>(
823 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
826 Kokkos::abort(
"dim must not exceed 3!");
838 Number>::integrate_values_and_gradients(ViewType1 u,
842 if constexpr (dim == 1)
844 co_gradients<0, false, true, false>(
845 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
846 team_member.team_barrier();
848 values<0, false, false, true>(u, u);
850 else if constexpr (dim == 2)
852 co_gradients<1, false, true, false>(
853 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
854 team_member.team_barrier();
855 co_gradients<0, false, true, false>(
856 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
857 team_member.team_barrier();
859 values<1, false, false, true>(u, u);
860 team_member.team_barrier();
861 values<0, false, false, true>(u, u);
862 team_member.team_barrier();
864 else if constexpr (dim == 3)
866 co_gradients<2, false, true, false>(
867 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
868 team_member.team_barrier();
869 co_gradients<1, false, true, false>(
870 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
871 team_member.team_barrier();
872 co_gradients<0, false, true, false>(
873 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
874 team_member.team_barrier();
876 values<2, false, false, true>(u, u);
877 team_member.team_barrier();
878 values<1, false, false, true>(u, u);
879 team_member.team_barrier();
880 values<0, false, false, true>(u, u);
881 team_member.team_barrier();
884 Kokkos::abort(
"dim must not exceed 3!");