8#include <similie/misc/stride.hpp>
9#include <similie/tensor/tensor_impl.hpp>
16template <TensorNatIndex... TensorIndex>
27 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
29 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...));
32 static constexpr std::size_t
rank()
34 if constexpr (
sizeof...(TensorIndex) == 0) {
37 return (TensorIndex::rank() + ...);
41 static constexpr std::size_t
size()
43 if constexpr (
rank() == 0) {
46 return (TensorIndex::size() * ...);
52 if constexpr (
rank() == 0) {
55 return (TensorIndex::mem_size() * ...);
61 return (1 * ... * TensorIndex::access_size());
64 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
65 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
70 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
71 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
73 if constexpr (
rank() == 0) {
76 return ((misc::detail::stride<TensorIndex, TensorIndex...>()
77 * natural_ids[ddc::type_seq_rank_v<
TensorIndex, ddc::TypeSeq<TensorIndex...>>])
87 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
89 const FunctorType& access,
93 return access(tensor, elem);
96 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
100 if constexpr (
rank() == 0) {
101 return std::array<std::size_t,
rank()> {};
103 return std::array<std::size_t,
rank()> {
105 / misc::detail::stride<TensorIndex, TensorIndex...>()...};
110static_assert(TensorIndexConcept<TensorFullIndex<TensorNaturalIndex<detail::DimensionConcept>>>);
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 subindices_domain_t subindices_domain()
static constexpr std::size_t size()
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
static constexpr std::size_t rank()
static KOKKOS_FUNCTION constexpr std::size_t access_id(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
static KOKKOS_FUNCTION constexpr std::array< std::size_t, rank()> mem_id_to_canonical_natural_ids(std::size_t mem_id)
static constexpr std::size_t access_size()
static constexpr bool is_tensor_index
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 Tensor::element_type process_access(const FunctorType &access, Tensor const &tensor, Elem const &elem)
static constexpr std::size_t mem_size()