PACMAN 0.1.0
Portable Algorithms for Coupling, Mapping, and Adaptive iNterpolation
Loading...
Searching...
No Matches
getters.hpp
Go to the documentation of this file.
1//
2// This file is subject to the terms and conditions defined in
3// file 'LICENSE', which is part of this source code package.
4//
5
6#pragma once
7
8#include <Kokkos_Core.hpp>
9
10#include "common/concepts.hpp"
11#include "common/types.hpp"
12#include "utils/utils.hpp"
13
14namespace PACMAN {
15namespace RbfPum {
16
29template <KokkosViewRank<1> AsViewType, KokkosViewRank<1> OffsViewType>
30KOKKOS_FORCEINLINE_FUNCTION auto
32 const int_t &n, const int_t &m) {
33 using DataType = typename AsViewType::non_const_value_type;
34 using MemorySpace = typename AsViewType::memory_space;
35 const auto slice = Kokkos::make_pair(offs(k), offs(k + 1));
36 auto A_data = Kokkos::subview(As, slice);
37 return Kokkos::View<DataType **, MemorySpace,
38 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(A_data.data(), n,
39 m);
40}
41
56template <KokkosViewRank<1> PsViewType, KokkosViewRank<1> OffsViewType,
57 KokkosArray AxisType>
60 const int_t &n, const AxisType &activeAxis) {
61 using DataType = typename PsViewType::non_const_value_type;
62 using MemorySpace = typename PsViewType::memory_space;
63 const int_t N = offs(k + 1) - offs(k);
64 int_t M = activeAxis.size() + 1;
65 const auto slice = Kokkos::make_pair(offs(k) * M, offs(k + 1) * M);
66 auto P_data = Kokkos::subview(Ps, slice);
67 M = 1;
68 for (int_t d = 0; d < activeAxis.size(); ++d) {
69 if (activeAxis[d]) {
70 ++M;
71 }
72 }
73
74 return Kokkos::View<DataType **, MemorySpace,
75 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(P_data.data(), n,
76 M);
77}
78
90template <KokkosViewRank<1> BsViewType, KokkosViewRank<1> OffsViewType>
93 const int_t &n) {
94 using DataType = typename BsViewType::non_const_value_type;
95 using MemorySpace = typename BsViewType::memory_space;
96 const auto slice = Kokkos::make_pair(offs(k), offs(k + 1));
97 auto B_data = Kokkos::subview(Bs, slice);
98 return Kokkos::View<DataType *, MemorySpace,
99 Kokkos::MemoryTraits<Kokkos::Unmanaged>>(B_data.data(),
100 n);
101}
102
103} // namespace RbfPum
104} // namespace PACMAN
KOKKOS_FORCEINLINE_FUNCTION auto GetPolyMatrix(const index_t &k, const PsViewType &Ps, const OffsViewType &offs, const int_t &n, const AxisType &activeAxis)
Returns a matrix of rank 2, shaped as (n, m), using the given data view, team rank,...
Definition getters.hpp:59
KOKKOS_FORCEINLINE_FUNCTION auto GetRbfVector(const index_t &k, const BsViewType &Bs, const OffsViewType &offs, const int_t &n)
Returns a vector view of rank 1, of length n, using the given data view, team rank,...
Definition getters.hpp:92
KOKKOS_FORCEINLINE_FUNCTION auto GetRbfMatrix(const index_t &k, const AsViewType &As, const OffsViewType &offs, const int_t &n, const int_t &m)
Returns a matrix of rank 2, shaped as (n, m), using the given data view, team rank,...
Definition getters.hpp:31