81 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
84 using IndexType ARCANE_DEPRECATED_REASON(
"Use 'MDIndexType' instead") = ArrayIndex<1>;
88 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
90 static_assert(I == 0,
"Invalid value for i (i==0)");
94 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 1> asStdArray()
const
96 return std::array<Int32, 1>{ m_extent0.v };
99 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
104 constexpr ARCCORE_HOST_DEVICE MDIndexType getIndices(Int32 i)
const
109 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
114 std::array<Int32, ExtentsType::nb_dynamic> x = {};
117 x[i++] = m_extent0.v;
118 return DynamicDimsType(x);
126 m_extent0.v = extents[0];
135 m_extent0.v = dims[i++];
138 constexpr std::array<Int32, 0> _removeFirstExtent()
const
143 ARCCORE_HOST_DEVICE
void _checkIndex(MDIndexType idx)
const
146 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
151 impl::ExtentValue<X0> m_extent0;
166 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
168 using IndexType ARCANE_DEPRECATED_REASON(
"Use 'MDIndexType' instead") = ArrayIndex<2>;
176 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
178 static_assert(I >= 0 && I < 2,
"Invalid value for I (0<=I<2)");
184 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 2> asStdArray()
const
186 return { m_extent0.v, m_extent1.v };
189 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
191 return m_extent0.size() * m_extent1.size();
194 constexpr ARCCORE_HOST_DEVICE MDIndexType getIndices(Int32 i)
const
196 Int32 i1 = impl::fastmod(i, m_extent1.v);
197 Int32 i0 = i / m_extent1.v;
201 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
202 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
207 std::array<Int32, ExtentsType::nb_dynamic> x = {};
210 x[i++] = m_extent0.v;
212 x[i++] = m_extent1.v;
213 return DynamicDimsType(x);
221 m_extent0.v = extents[0];
223 m_extent1.v = extents[1];
232 m_extent0.v = dims[i++];
234 m_extent1.v = dims[i++];
237 constexpr std::array<Int32, 1> _removeFirstExtent()
const
239 return std::array<Int32, 1>{ m_extent1.v };
242 ARCCORE_HOST_DEVICE
void _checkIndex(MDIndexType idx)
const
245 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
246 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
251 impl::ExtentValue<X0> m_extent0;
252 impl::ExtentValue<X1> m_extent1;
260template <
typename IndexType_, Int32 X0, Int32 X1, Int32 X2>
267 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
269 using IndexType ARCANE_DEPRECATED_REASON(
"Use 'MDIndexType' instead") = ArrayIndex<3>;
277 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
279 static_assert(I >= 0 && I < 3,
"Invalid value for I (0<=I<3)");
287 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 3> asStdArray()
const
289 return { m_extent0.v, m_extent1.v, m_extent2.v };
292 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
294 return m_extent0.size() * m_extent1.size() * m_extent2.size();
297 constexpr ARCCORE_HOST_DEVICE MDIndexType getIndices(Int32 i)
const
299 Int32 i2 = impl::fastmod(i, m_extent2.v);
300 Int32 fac = m_extent2.v;
301 Int32 i1 = impl::fastmod(i / fac, m_extent1.v);
304 return { i0, i1, i2 };
307 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
308 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
309 constexpr ARCCORE_HOST_DEVICE Int32 extent2()
const {
return m_extent2.v; };
314 std::array<Int32, ExtentsType::nb_dynamic> x = {};
317 x[i++] = m_extent0.v;
319 x[i++] = m_extent1.v;
321 x[i++] = m_extent2.v;
322 return DynamicDimsType(x);
330 m_extent0.v = extents[0];
332 m_extent1.v = extents[1];
334 m_extent2.v = extents[2];
343 m_extent0.v = dims[i++];
345 m_extent1.v = dims[i++];
347 m_extent2.v = dims[i++];
350 constexpr std::array<Int32, 2> _removeFirstExtent()
const
352 return { m_extent1.v, m_extent2.v };
355 ARCCORE_HOST_DEVICE
void _checkIndex(MDIndexType idx)
const
358 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
359 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
360 ARCCORE_CHECK_AT(idx.id2(), m_extent2.v);
365 impl::ExtentValue<X0> m_extent0;
366 impl::ExtentValue<X1> m_extent1;
367 impl::ExtentValue<X2> m_extent2;
375template <
typename IndexType_, Int32 X0, Int32 X1, Int32 X2, Int32 X3>
382 using DynamicDimsType =
typename ExtentsType::DynamicDimsType;
384 using IndexType ARCANE_DEPRECATED_REASON(
"Use 'MDIndexType' instead") = ArrayIndex<4>;
392 template <Int32 I>
constexpr ARCCORE_HOST_DEVICE Int32 constExtent()
const
394 static_assert(I >= 0 && I < 4,
"Invalid value for I (0<=I<4)");
404 constexpr ARCCORE_HOST_DEVICE std::array<Int32, 4> asStdArray()
const
406 return { m_extent0.v, m_extent1.v, m_extent2.v, m_extent3.v };
409 constexpr ARCCORE_HOST_DEVICE Int64 totalNbElement()
const
411 return m_extent0.size() * m_extent1.size() * m_extent2.size() * m_extent3.size();
414 constexpr ARCCORE_HOST_DEVICE MDIndexType getIndices(Int32 i)
const
417 Int32 i3 = impl::fastmod(i, m_extent3.v);
418 Int32 fac = m_extent3.v;
419 Int32 i2 = impl::fastmod(i / fac, m_extent2.v);
421 Int32 i1 = impl::fastmod(i / fac, m_extent1.v);
424 return { i0, i1, i2, i3 };
427 constexpr ARCCORE_HOST_DEVICE Int32 extent0()
const {
return m_extent0.v; };
428 constexpr ARCCORE_HOST_DEVICE Int32 extent1()
const {
return m_extent1.v; };
429 constexpr ARCCORE_HOST_DEVICE Int32 extent2()
const {
return m_extent2.v; };
430 constexpr ARCCORE_HOST_DEVICE Int32 extent3()
const {
return m_extent3.v; };
435 std::array<Int32, ExtentsType::nb_dynamic> x = {};
438 x[i++] = m_extent0.v;
440 x[i++] = m_extent1.v;
442 x[i++] = m_extent2.v;
444 x[i++] = m_extent3.v;
445 return DynamicDimsType(x);
453 m_extent0.v = extents[0];
455 m_extent1.v = extents[1];
457 m_extent2.v = extents[2];
459 m_extent3.v = extents[3];
468 m_extent0.v = dims[i++];
470 m_extent1.v = dims[i++];
472 m_extent2.v = dims[i++];
474 m_extent3.v = dims[i++];
477 constexpr std::array<Int32, 3> _removeFirstExtent()
const
479 return { m_extent1.v, m_extent2.v, m_extent3.v };
482 ARCCORE_HOST_DEVICE
void _checkIndex(MDIndexType idx)
const
485 ARCCORE_CHECK_AT(idx.id0(), m_extent0.v);
486 ARCCORE_CHECK_AT(idx.id1(), m_extent1.v);
487 ARCCORE_CHECK_AT(idx.id2(), m_extent2.v);
488 ARCCORE_CHECK_AT(idx.id3(), m_extent3.v);
493 impl::ExtentValue<X0> m_extent0;
494 impl::ExtentValue<X1> m_extent1;
495 impl::ExtentValue<X2> m_extent2;
496 impl::ExtentValue<X3> m_extent3;