9#include <similie/tensor/tensor_impl.hpp>
22template <TensorNatIndex... TensorIndex>
38 ddc::DiscreteElement<
TensorIndex...>(ddc::DiscreteElement<TensorIndex>(0)...),
40 ddc::DiscreteVector<TensorIndex>(TensorIndex::size())...));
43 static constexpr std::size_t
rank()
45 return (TensorIndex::rank() + ...);
48 static constexpr std::size_t
size()
50 return (TensorIndex::size() * ...);
63 KOKKOS_FUNCTION
static constexpr std::size_t
mem_id(
64 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
66 assert(std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
67 return id == *natural_ids.begin();
72 KOKKOS_FUNCTION
static constexpr std::size_t
access_id(
73 std::array<std::size_t,
sizeof...(
TensorIndex)>
const& natural_ids)
75 if (!std::all_of(natural_ids.begin(), natural_ids.end(), [&](
const std::size_t
id) {
76 return id == *natural_ids.begin();
80 return 1 +
mem_id(natural_ids);
86 assert(
access_id != 0 &&
"There is no mem_id associated to access_id=0");
90 template <
class Tensor,
class Elem,
class Id,
class FunctorType>
92 const FunctorType& access,
96 if (elem.template uid<Id>() == 0) {
99 return access(tensor, elem);
103 KOKKOS_FUNCTION
static constexpr std::array<std::size_t,
rank()>
107 std::array<std::size_t,
rank()> ids;
108 std::fill(ids.begin(), ids.end(), 0);
113static_assert(TensorIndexConcept<TensorScalingIndex<TensorNaturalIndex<detail::DimensionConcept>>>);
The top-level namespace of SimiLie.
Store a scalar multiple of the identity using one coefficient.
static constexpr bool is_tensor_index
static constexpr std::size_t size()
static constexpr std::size_t rank()
static KOKKOS_FUNCTION constexpr std::size_t access_id_to_mem_id(std::size_t access_id)
static constexpr bool is_explicitely_stored_tensor
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_id(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
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()
static constexpr std::size_t access_size()
static KOKKOS_FUNCTION constexpr subindices_domain_t subindices_domain()
static KOKKOS_FUNCTION constexpr std::size_t mem_id(std::array< std::size_t, sizeof...(TensorIndex)> const &natural_ids)
ddc::DiscreteDomain< TensorIndex... > subindices_domain_t