8#include <similie/misc/filled_struct.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 return (TensorIndex::rank() + ...);
37 static constexpr std::size_t
size()
39 return (TensorIndex::size() * ...);
52 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
53 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
55 assert(std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
56 return id == *natural_ids.begin();
58 return natural_ids[0];
61 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
62 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
64 if (!std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
65 return id == *natural_ids.begin();
69 return 1 +
mem_id(natural_ids);
75 assert(
access_id != 0 &&
"There is no mem_id associated to access_id=0");
79 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
81 const FunctorType& access,
85 if (elem.template uid<Id>() == 0) {
88 return access(tensor, elem);
92 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
96 std::array<std::size_t,
rank()> ids;
97 std::fill(ids.begin(), ids.end(),
mem_id);
103 TensorIndexConcept<TensorDiagonalIndex<TensorNaturalIndex<detail::DimensionConcept>>>);
The top-level namespace of SimiLie.
static KOKKOS_FUNCTION constexpr Tensor::element_type process_access(const FunctorType &access, Tensor const &tensor, Elem const &elem)
static KOKKOS_FUNCTION constexpr std::size_t access_id_to_mem_id(std::size_t access_id)
static constexpr std::size_t access_size()
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 mem_size()
static KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t
static constexpr std::size_t size()
static KOKKOS_FUNCTION constexpr std::size_t access_id(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
static KOKKOS_FUNCTION constexpr std::size_t mem_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 constexpr std::size_t rank()