Skip to content

Commit

Permalink
Remove const for ChunkSpan<const ElementType>
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Nov 15, 2023
1 parent 1505522 commit 96a1328
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions include/ddc/mirror.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#include <type_traits>

#include <Kokkos_Core.hpp>

#include "ddc/chunk_span.hpp"
Expand All @@ -15,7 +17,10 @@ auto create_mirror(
Space const& space,
ChunkSpan<ElementType, Support, Layout, MemorySpace> const& src)
{
return Chunk<ElementType, Support, KokkosAllocator<ElementType, typename Space::memory_space>>(
return Chunk<
std::remove_const_t<ElementType>,
Support,
KokkosAllocator<std::remove_const_t<ElementType>, typename Space::memory_space>>(
src.domain());
}

Expand All @@ -32,8 +37,10 @@ auto create_mirror_and_copy(
Space const& space,
ChunkSpan<ElementType, Support, Layout, MemorySpace> const& src)
{
Chunk<ElementType, Support, KokkosAllocator<ElementType, typename Space::memory_space>> chunk(
src.domain());
Chunk<std::remove_const_t<ElementType>,
Support,
KokkosAllocator<std::remove_const_t<ElementType>, typename Space::memory_space>>
chunk(src.domain());
deepcopy(chunk, src);
return chunk;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ TEST(Chunk2DTest, Mirror)
{
ChunkXY<double> chunk(dom_x_y);
ddc::fill(chunk, 1.4);
auto const chunk2 = ddc::create_mirror_and_copy(chunk.span_view());
auto const chunk2 = ddc::create_mirror_and_copy(chunk.span_cview());
for (auto&& ix : chunk.domain<DDimX>()) {
for (auto&& iy : chunk.domain<DDimY>()) {
// we expect complete equality, not EXPECT_DOUBLE_EQ: these are copy
Expand Down

0 comments on commit 96a1328

Please sign in to comment.