Skip to content

Commit 5b0f2e4

Browse files
committed
Add empty ctor for ViewBroadcast
1 parent 32e4b80 commit 5b0f2e4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/kokkos/ekat_view_broadcast.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,24 @@ class ViewBroadcast
2222
using view_type = Unmanaged<ToView>;
2323
using reference_type = typename view_type::reference_type;
2424

25+
ViewBroadcast () = default;
26+
27+
template<typename FromView>
28+
ViewBroadcast (const FromView& from_v,
29+
const std::vector<int>& extents)
30+
{
31+
setup(from_v,extents);
32+
}
33+
2534
// Broadcast an input view to the type provided by the class template arg
2635
// - from_v: view to be broadcasted
2736
// - extents: list of extents of the outfacing view (of type ToView).
2837
// Must have rank=ToView::rank(). Must contain FromView::rank() entries
2938
// that are <=0, which signal that those dimensions' extents will be
3039
// retrieved from the input view.
3140
template<typename FromView>
32-
ViewBroadcast (const FromView& from_v,
33-
const std::vector<int>& extents)
41+
void setup (const FromView& from_v,
42+
const std::vector<int>& extents)
3443
{
3544
constexpr int from_rank = FromView::rank();
3645
constexpr int to_rank = ToView::rank();

tests/kokkos/view_broadcast.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ TEST_CASE("view_broadcast") {
4545
SECTION ("along d0") {
4646
d0 = 4;
4747
d1 = n;
48-
auto b2d = broadcast<view_2d>(orig,{d0,-1});
48+
ViewBroadcast<view_2d> b2d;
49+
b2d.setup(orig,{d0,-1});
4950

5051
int err = 0;
5152
auto lambda = KOKKOS_LAMBDA (int idx, int& l_err) {

0 commit comments

Comments
 (0)