8#include <similie/misc/filled_struct.hpp>
10#include "tensor_impl.hpp"
17template <TensorNatIndex... TensorIndex>
28 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
30 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...));
33 KOKKOS_FUNCTION
static constexpr std::size_t
rank()
35 return (TensorIndex::rank() + ...);
38 KOKKOS_FUNCTION
static constexpr std::size_t
size()
40 return (TensorIndex::size() * ...);
43 KOKKOS_FUNCTION
static constexpr std::size_t
mem_size()
53 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
54 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
56 assert(std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
57 return id == *natural_ids.begin();
59 return natural_ids[0];
62 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
63 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
65 if (!std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
66 return id == *natural_ids.begin();
70 return 1 +
mem_id(natural_ids);
76 assert(
access_id != 0 &&
"There is no mem_id associated to access_id=0");
80 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
82 const FunctorType& access,
86 if (elem.template uid<Id>() == 0) {
89 return access(tensor, elem);
93 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
97 std::array<std::size_t,
rank()> ids;
98 std::fill(ids.begin(), ids.end(),
mem_id);
Tensor(ddc::Chunk< ElementType, SupportType, Allocator >) -> Tensor< ElementType, SupportType, Kokkos::layout_right, typename Allocator::memory_space >
The top-level namespace of SimiLie.
static KOKKOS_FUNCTION constexpr std::size_t access_id_to_mem_id(std::size_t access_id)
static KOKKOS_FUNCTION constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr std::array< std::size_t, rank()> mem_id_to_canonical_natural_ids(std::size_t mem_id)
static KOKKOS_FUNCTION constexpr std::size_t access_size()
static KOKKOS_FUNCTION constexpr std::size_t rank()
static KOKKOS_FUNCTION constexpr std::size_t mem_id(std::array< std::size_t, sizeof...(TensorIndex)> const natural_ids)
static KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
static KOKKOS_FUNCTION constexpr std::size_t mem_size()
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
static KOKKOS_FUNCTION constexpr std::size_t access_id(std::array< std::size_t, sizeof...(TensorIndex)> const natural_ids)
static constexpr bool is_explicitely_stored_tensor
static constexpr bool is_tensor_index
static KOKKOS_FUNCTION constexpr Tensor::element_type process_access(const FunctorType &access, Tensor tensor, Elem elem)