Skip to content

Commit

Permalink
view_builder.hpp: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed May 8, 2024
1 parent 87b53ff commit 3ab8441
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions unit_tests/view_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,25 @@ struct noncontig {};
template <typename T, int RANK>
struct ViewBuilder;


template <typename T>
struct ViewBuilder<T, 1> {
static auto view(noncontig, int e0) {

// this is C-style layout, i.e. v(0,0) is next to v(0,1)
Kokkos::View<T**, Kokkos::LayoutRight> v("", e0, 2);
return Kokkos::subview(v, Kokkos::ALL, 1); // take column 1
}
static auto view(noncontig, int e0) {
// this is C-style layout, i.e. v(0,0) is next to v(0,1)
Kokkos::View<T**, Kokkos::LayoutRight> v("", e0, 2);
return Kokkos::subview(v, Kokkos::ALL, 1); // take column 1
}

static auto view(contig, int e0) {
return Kokkos::View<T*>("", e0);
}
static auto view(contig, int e0) { return Kokkos::View<T*>("", e0); }
};

template <typename T>
struct ViewBuilder<T, 2> {
static auto view(noncontig, int e0, int e1) {

Kokkos::View<T***, Kokkos::LayoutRight> v("", e0, e1, 2);
return Kokkos::subview(v, Kokkos::ALL, Kokkos::ALL, 1);
}

static auto view(contig, int e0, int e1) {
return Kokkos::View<T**>("", e0, e1);
}
static auto view(noncontig, int e0, int e1) {
Kokkos::View<T***, Kokkos::LayoutRight> v("", e0, e1, 2);
return Kokkos::subview(v, Kokkos::ALL, Kokkos::ALL, 1);
}

static auto view(contig, int e0, int e1) {
return Kokkos::View<T**>("", e0, e1);
}
};

0 comments on commit 3ab8441

Please sign in to comment.