43 template <
class AbstractFamily>
50 Integer size()
const {
return m_data.size();}
52 template<
class AbstractItem>
53 DataType& operator[](
const AbstractItem item) {
return m_data[item.localId()];}
55 template<
class AbstractItem>
56 DataType operator[](
const AbstractItem item)
const {
return m_data[item.localId()];}
60 std::cout <<
"== CONNECTIVITY ITEM PROPERTY CONTAINS " << std::endl;
61 for (Arcane::Integer i = 0; i < m_data.size();++i)
63 std::cout <<
"\""<< m_data[i] <<
"\"" << std::endl;
65 std::cout << std::endl;
68 ConstArrayView<DataType> view() {
return m_data.constView();}
70 void updateSupport(Int32ConstArrayView new_to_old_ids)
72 if (new_to_old_ids.size() == 0)
74 UniqueArray<DataType> old_data(m_data);
75 Integer new_size = new_to_old_ids.size();
76 m_data.resize(new_size);
79 Integer max_size = *(std::max_element(new_to_old_ids.begin(), new_to_old_ids.end())) + 1;
80 if (max_size > old_data.size())
81 old_data.resize(max_size, m_default_value);
82 for (Integer i = 0; i < new_size; ++i) {
83 m_data[i] = old_data[new_to_old_ids[i]];
87 void copy(
const ItemScalarProperty<DataType>& item_property_from)
89 m_data.copy(item_property_from.m_data);
90 m_default_value = item_property_from.m_default_value;
96 SharedArray<DataType> m_data;
97 DataType m_default_value;
113 template <
class AbstractFamily>
128 if (dim2_new_size > dim2_old_size)
130 for (Arcane::Integer i = 0; i < dim1_old_size; ++i)
132 for (Integer j = dim2_old_size; j < dim2_new_size;++j) m_data[i][j] = default_value;
137 Integer dim1Size()
const {
return m_data.dim1Size();}
138 Integer dim2Size()
const {
return m_data.dim2Size();}
140 template<
class AbstractItem>
141 ArrayView<DataType> operator[](AbstractItem item) {
return m_data[item.localId()]; }
143 template<
class AbstractItem>
144 ConstArrayView<DataType> operator[](AbstractItem item)
const {
return m_data[item.localId()]; }
146 void updateSupport(Int32ConstArrayView new_to_old_ids)
148 if (new_to_old_ids.size() == 0)
150 UniqueArray2<DataType> old_data(m_data);
151 Integer new_dim1_size = new_to_old_ids.size();
152 Integer dim2_size = m_data.dim2Size();
153 m_data.resize(new_dim1_size);
156 auto max_dim1_size = *(std::max_element(new_to_old_ids.begin(), new_to_old_ids.end())) + 1;
157 old_data.resize(max_dim1_size);
158 for (Integer i = 0; i < new_dim1_size; ++i) {
159 for (Integer j = 0; j < dim2_size; ++j)
160 m_data[i][j] = old_data[new_to_old_ids[i]][j];
164 void copy(
const ItemArrayProperty<DataType>& item_property_from)
166 m_data.copy(item_property_from.m_data);
171 UniqueArray2<DataType> m_data;
190 template <
class AbstractFamily>
196 (
"In item property resize : nb_element_per_item must have size IItemFamilyy::maxLocalId"))
212 for (Arcane::Integer i = 0; i < dim1_old_size; ++i)
214 for (Arcane::Integer j = dim2_old_sizes[i]; j < dim2_new_sizes[i]; ++j)
216 m_data[i][j] = default_value;
221 Integer dim1Size()
const {
return m_data.dim1Size();}
224 template<
class AbstractItem>
225 ArrayView<DataType> operator[](
const AbstractItem item) {
return m_data[item.localId()];}
227 template<
class AbstractItem>
228 ConstArrayView<DataType> operator[](
const AbstractItem item)
const {
return m_data[item.localId()];}
230 void updateSupport(Int32ConstArrayView new_to_old_ids)
232 if (new_to_old_ids.size() == 0)
234 UniqueMultiArray2<DataType> old_data(m_data);
235 Integer new_dim1_size = new_to_old_ids.size();
238 Integer max_dim1_size = *(std::max_element(new_to_old_ids.begin(), new_to_old_ids.end())) + 1;
240 dim2_sizes.resize(max_dim1_size, 1);
241 old_data.resize(dim2_sizes);
244 for (Integer i = 0; i < new_dim1_size; ++i) {
245 new_dim2_sizes[i] = dim2_sizes[new_to_old_ids[i]];
247 m_data.resize(new_dim2_sizes);
248 for (Integer i = 0; i < new_dim1_size; ++i) {
249 for (Integer j = 0; j < new_dim2_sizes[i]; ++j)
250 m_data[i][j] = old_data[new_to_old_ids[i]][j];
254 void copy(
const ItemMultiArrayProperty<DataType>& item_property_from)
256 m_data = item_property_from.m_data.constView();
262 SharedMultiArray2<DataType> m_data;