81 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
85 using IndexType = ArrayIndex<1>;
89 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
91 static_assert(I == 0,
"Invalid value for i (i==0)");
95 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 1> asStdArray()
const
97 return std::array<Int32, 1>{ m_extent0.v };
100 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
105 constexpr ARCCORE_HOST_DEVICE IndexType getIndices(Int32 i)
const
110 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
115 std::array<Int32, ExtentsType::nb_dynamic> x = {};
118 x[i++] = m_extent0.v;
119 return DynamicDimsType(x);
127 m_extent0.v = extents[0];
136 m_extent0.v = dims[i++];
139 constexpr std::array<Int32, 0> _removeFirstExtent()
const
144 ARCCORE_HOST_DEVICE
void _checkIndex(IndexType idx)
const
147 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
152 impl::ExtentValue<X0> m_extent0;
167 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
170 using IndexType = ArrayIndex<2>;
178 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
180 static_assert(I >= 0 && I < 2,
"Invalid value for I (0<=I<2)");
186 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 2> asStdArray()
const
188 return { m_extent0.v, m_extent1.v };
191 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
193 return m_extent0.size() * m_extent1.size();
196 constexpr ARCCORE_HOST_DEVICE IndexType getIndices(Int32 i)
const
198 Int32 i1 = impl::fastmod(i, m_extent1.v);
199 Int32 i0 = i / m_extent1.v;
203 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
204 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
209 std::array<Int32, ExtentsType::nb_dynamic> x = {};
212 x[i++] = m_extent0.v;
214 x[i++] = m_extent1.v;
215 return DynamicDimsType(x);
223 m_extent0.v = extents[0];
225 m_extent1.v = extents[1];
234 m_extent0.v = dims[i++];
236 m_extent1.v = dims[i++];
239 constexpr std::array<Int32, 1> _removeFirstExtent()
const
241 return std::array<Int32, 1>{ m_extent1.v };
244 ARCCORE_HOST_DEVICE
void _checkIndex(IndexType idx)
const
247 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
248 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
253 impl::ExtentValue<X0> m_extent0;
254 impl::ExtentValue<X1> m_extent1;
262template <
typename IndexType_, Int32 X0, Int32 X1, Int32 X2>
269 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
272 using IndexType = ArrayIndex<3>;
280 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
282 static_assert(I >= 0 && I < 3,
"Invalid value for I (0<=I<3)");
290 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 3> asStdArray()
const
292 return { m_extent0.v, m_extent1.v, m_extent2.v };
295 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
297 return m_extent0.size() * m_extent1.size() * m_extent2.size();
300 constexpr ARCCORE_HOST_DEVICE IndexType getIndices(Int32 i)
const
302 Int32 i2 = impl::fastmod(i, m_extent2.v);
303 Int32 fac = m_extent2.v;
304 Int32 i1 = impl::fastmod(i / fac, m_extent1.v);
307 return { i0, i1, i2 };
310 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
311 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
312 constexpr ARCCORE_HOST_DEVICE Int32 extent2()
const {
return m_extent2.v; };
317 std::array<Int32, ExtentsType::nb_dynamic> x = {};
320 x[i++] = m_extent0.v;
322 x[i++] = m_extent1.v;
324 x[i++] = m_extent2.v;
325 return DynamicDimsType(x);
333 m_extent0.v = extents[0];
335 m_extent1.v = extents[1];
337 m_extent2.v = extents[2];
346 m_extent0.v = dims[i++];
348 m_extent1.v = dims[i++];
350 m_extent2.v = dims[i++];
353 constexpr std::array<Int32, 2> _removeFirstExtent()
const
355 return { m_extent1.v, m_extent2.v };
358 ARCCORE_HOST_DEVICE
void _checkIndex(IndexType idx)
const
361 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
362 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
363 ARCCORE_CHECK_AT(idx.id2(), m_extent2.v);
368 impl::ExtentValue<X0> m_extent0;
369 impl::ExtentValue<X1> m_extent1;
370 impl::ExtentValue<X2> m_extent2;
378template <
typename IndexType_, Int32 X0, Int32 X1, Int32 X2, Int32 X3>
385 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
388 using IndexType = ArrayIndex<4>;
396 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
398 static_assert(I >= 0 && I < 4,
"Invalid value for I (0<=I<4)");
408 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 4> asStdArray()
const
410 return { m_extent0.v, m_extent1.v, m_extent2.v, m_extent3.v };
413 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
415 return m_extent0.size() * m_extent1.size() * m_extent2.size() * m_extent3.size();
418 constexpr ARCCORE_HOST_DEVICE IndexType getIndices(Int32 i)
const
421 Int32 i3 = impl::fastmod(i, m_extent3.v);
422 Int32 fac = m_extent3.v;
423 Int32 i2 = impl::fastmod(i / fac, m_extent2.v);
425 Int32 i1 = impl::fastmod(i / fac, m_extent1.v);
428 return { i0, i1, i2, i3 };
431 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
432 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
433 constexpr ARCCORE_HOST_DEVICE Int32 extent2()
const {
return m_extent2.v; };
434 constexpr ARCCORE_HOST_DEVICE Int32 extent3()
const {
return m_extent3.v; };
439 std::array<Int32, ExtentsType::nb_dynamic> x = {};
442 x[i++] = m_extent0.v;
444 x[i++] = m_extent1.v;
446 x[i++] = m_extent2.v;
448 x[i++] = m_extent3.v;
449 return DynamicDimsType(x);
457 m_extent0.v = extents[0];
459 m_extent1.v = extents[1];
461 m_extent2.v = extents[2];
463 m_extent3.v = extents[3];
472 m_extent0.v = dims[i++];
474 m_extent1.v = dims[i++];
476 m_extent2.v = dims[i++];
478 m_extent3.v = dims[i++];
481 constexpr std::array<Int32, 3> _removeFirstExtent()
const
483 return { m_extent1.v, m_extent2.v, m_extent3.v };
486 ARCCORE_HOST_DEVICE
void _checkIndex(IndexType idx)
const
489 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
490 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
491 ARCCORE_CHECK_AT(idx.id2(), m_extent2.v);
492 ARCCORE_CHECK_AT(idx.id3(), m_extent3.v);
497 impl::ExtentValue<X0> m_extent0;
498 impl::ExtentValue<X1> m_extent1;
499 impl::ExtentValue<X2> m_extent2;
500 impl::ExtentValue<X3> m_extent3;