8#include <similie/misc/stride.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 if constexpr (
sizeof...(TensorIndex) == 0) {
38 return (TensorIndex::rank() + ...);
42 KOKKOS_FUNCTION
static constexpr std::size_t
size()
44 if constexpr (
rank() == 0) {
47 return (TensorIndex::size() * ...);
51 KOKKOS_FUNCTION
static constexpr std::size_t
mem_size()
53 if constexpr (
rank() == 0) {
56 return (TensorIndex::mem_size() * ...);
62 return (TensorIndex::access_size() * ...);
65 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
66 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
71 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
72 std::array<std::size_t,
sizeof...(
TensorIndex)>
const natural_ids)
74 if constexpr (
rank() == 0) {
77 return ((misc::detail::stride<TensorIndex, TensorIndex...>()
78 * natural_ids[ddc::type_seq_rank_v<
80 ddc::detail::TypeSeq<TensorIndex...>>])
90 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
92 const FunctorType& access,
96 return access(tensor, elem);
99 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
103 if constexpr (
rank() == 0) {
104 return std::array<std::size_t,
rank()> {};
106 return std::array<std::size_t,
rank()> {
108 / misc::detail::stride<TensorIndex, TensorIndex...>()...};
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 mem_id(std::array< std::size_t, sizeof...(TensorIndex)> const natural_ids)
static KOKKOS_FUNCTION constexpr std::size_t mem_size()
static KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
static KOKKOS_FUNCTION constexpr Tensor::element_type process_access(const FunctorType &access, Tensor tensor, Elem elem)
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
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 rank()
static constexpr bool is_tensor_index
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 KOKKOS_FUNCTION constexpr std::size_t access_id_to_mem_id(std::size_t access_id)
static KOKKOS_FUNCTION constexpr std::size_t access_size()
static KOKKOS_FUNCTION constexpr std::size_t size()