12#ifndef ARCANE_UTILS_ARRAYSHAPE_H
13#define ARCANE_UTILS_ARRAYSHAPE_H
18#include "arcane/utils/ArrayView.h"
41class ARCANE_UTILS_EXPORT ArrayShape
45 static constexpr int MAX_NB_DIMENSION = 8;
47 ArrayShape() =
default;
65 for (
Int32 i = 0, n = m_nb_dim; i < n; ++i)
66 v *= (
Int64)m_dims[i];
71 void setNbDimension(
Int32 nb_value);
79 friend std::ostream& operator<<(std::ostream& o,
const ArrayShape& s)
84 friend bool operator==(
const ArrayShape& s1,
const ArrayShape& s2)
86 return _isEqual(s1, s2);
88 friend bool operator!=(
const ArrayShape& s1,
const ArrayShape& s2)
90 return !_isEqual(s1, s2);
96 std::array<Int32, MAX_NB_DIMENSION> m_dims = {};
100 void _set(SmallSpan<const Int32> v);
101 static bool _isEqual(
const ArrayShape& s1,
const ArrayShape& s2);
102 void _print(std::ostream& o)
const;
Arcane configuration file.
Int32 dimension(Int32 index) const
Number of elements in the index-th dimension.
void setDimension(Int32 index, Int32 value)
Sets the value of the index-th dimension to value.
Int32 nbDimension() const
Rank of the shape.
SmallSpan< const Int32 > dimensions() const
Values of each dimension.
Int64 totalNbElement() const
Total number of elements.
View of an array of elements of type T.
View of an array of elements of type T.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.