12#ifndef ARCANE_UTILS_MDINDEX_H
13#define ARCANE_UTILS_MDINDEX_H
38template <
int RankValue,
typename IndexType_>
46 constexpr MDIndexBase(std::array<Int32, RankValue> _id)
53 constexpr std::array<Int32, RankValue>
operator()()
const {
return m_indexes; }
56 constexpr ARCCORE_HOST_DEVICE Int32
operator[](
int i)
const
58 ARCCORE_CHECK_AT(i, RankValue);
62 constexpr ARCCORE_HOST_DEVICE Int64
asInt64(
int i)
const
64 ARCCORE_CHECK_AT(i, RankValue);
71 for (
int i = 0; i < RankValue; ++i)
72 m_indexes[i] += rhs[i];
77 std::array<Int32, RankValue> m_indexes = {};
83template <
typename IndexType_>
90 ARCCORE_HOST_DEVICE
constexpr MDIndex(std::array<Int32, 0> _id)
98template <
typename IndexType_>
103 using BaseClass::m_indexes;
108 ARCCORE_HOST_DEVICE
constexpr MDIndex(Int32 _id0)
113 ARCCORE_HOST_DEVICE
constexpr MDIndex(std::array<Int32, 1> _id)
119 ARCCORE_HOST_DEVICE
constexpr Int32 id0()
const {
return m_indexes[0]; }
120 ARCCORE_HOST_DEVICE
constexpr Int64 largeId0()
const {
return m_indexes[0]; }
126template <
typename IndexType_>
131 using BaseClass::m_indexes;
136 ARCCORE_HOST_DEVICE
constexpr MDIndex(Int32 _id0, Int32 _id1)
142 ARCCORE_HOST_DEVICE
constexpr MDIndex(std::array<Int32, 2> _id)
148 ARCCORE_HOST_DEVICE
constexpr Int32 id0()
const {
return m_indexes[0]; }
149 ARCCORE_HOST_DEVICE
constexpr Int32 id1()
const {
return m_indexes[1]; }
150 ARCCORE_HOST_DEVICE
constexpr Int64 largeId0()
const {
return m_indexes[0]; }
151 ARCCORE_HOST_DEVICE
constexpr Int64 largeId1()
const {
return m_indexes[1]; }
157template <
typename IndexType_>
162 using BaseClass::m_indexes;
167 ARCCORE_HOST_DEVICE
constexpr MDIndex(Int32 _id0, Int32 _id1, Int32 _id2)
174 ARCCORE_HOST_DEVICE
constexpr MDIndex(std::array<Int32, 3> _id)
180 ARCCORE_HOST_DEVICE
constexpr Int32 id0()
const {
return m_indexes[0]; }
181 ARCCORE_HOST_DEVICE
constexpr Int32 id1()
const {
return m_indexes[1]; }
182 ARCCORE_HOST_DEVICE
constexpr Int32 id2()
const {
return m_indexes[2]; }
183 ARCCORE_HOST_DEVICE
constexpr Int64 largeId0()
const {
return m_indexes[0]; }
184 ARCCORE_HOST_DEVICE
constexpr Int64 largeId1()
const {
return m_indexes[1]; }
185 ARCCORE_HOST_DEVICE
constexpr Int64 largeId2()
const {
return m_indexes[2]; }
191template <
typename IndexType_>
196 using BaseClass::m_indexes;
201 ARCCORE_HOST_DEVICE
constexpr MDIndex(Int32 _id0, Int32 _id1, Int32 _id2, Int32 _id3)
209 ARCCORE_HOST_DEVICE
constexpr MDIndex(std::array<Int32, 4> _id)
215 ARCCORE_HOST_DEVICE
constexpr Int32 id0()
const {
return m_indexes[0]; }
216 ARCCORE_HOST_DEVICE
constexpr Int32 id1()
const {
return m_indexes[1]; }
217 ARCCORE_HOST_DEVICE
constexpr Int32 id2()
const {
return m_indexes[2]; }
218 ARCCORE_HOST_DEVICE
constexpr Int32 id3()
const {
return m_indexes[3]; }
219 ARCCORE_HOST_DEVICE
constexpr Int64 largeId0()
const {
return m_indexes[0]; }
220 ARCCORE_HOST_DEVICE
constexpr Int64 largeId1()
const {
return m_indexes[1]; }
221 ARCCORE_HOST_DEVICE
constexpr Int64 largeId2()
const {
return m_indexes[2]; }
222 ARCCORE_HOST_DEVICE
constexpr Int64 largeId3()
const {
return m_indexes[3]; }
Déclarations des types utilisés dans Arcane.
Classe de base de la gestion des indices d'un tableau N-dimension.
constexpr __host__ __device__ void add(const MDIndexBase< RankValue > &rhs)
Ajoute rhs aux valeurs des indices de l'instance.
constexpr std::array< Int32, RankValue > operator()() const
Liste des indices.
constexpr __host__ __device__ Int32 operator[](int i) const
Retourne le i-ème indice.
constexpr __host__ __device__ Int64 asInt64(int i) const
Retourne le i-ème indice sous la forme d'un Int64.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-