14#include "arcane/mesh/ItemConnectivity.h"
15#include "arcane/mesh/ExtraGhostItemsManager.h"
27void ItemConnectivity::
30 ItemVectorView from_items = _sourceFamily()->allItems().own().view();
31 ItemVectorView to_items = _targetFamily()->allItems().own().view();
32 ARCANE_ASSERT((from_items.size() == to_items.size()),
33 (
"Connected families must have the same number of items "))
34 m_item_property.resize(_sourceFamily(),NULL_ITEM_LOCAL_ID);
38 m_item_property[iitem] = to_items[i++].localId();
45void ItemArrayConnectivity::
48 ItemVectorView from_items = _sourceFamily()->allItems().own().view();
49 ItemVectorView to_items = _targetFamily()->allItems().own().view();
50 ARCANE_ASSERT((from_items.size()*m_nb_dof_per_item == to_items.size()),
51 (
"Incorrect connected family size. Should be FromFamily.own.size * nb_element_per_item"))
52 m_item_property.resize(_sourceFamily(),m_nb_dof_per_item,NULL_ITEM_LOCAL_ID);
55 for (Integer j = 0; j < m_nb_dof_per_item ; ++j)
56 m_item_property[iitem][j] = to_items[i++].localId();
63void ItemMultiArrayConnectivity::
64compute(IntegerConstArrayView nb_dof_per_item)
66 ItemVectorView from_items = _sourceFamily()->allItems().own().view();
67 DoFVectorView to_items = _targetFamily()->allItems().own().view();
68 Integer total_nb_dof_per_item = 0;
69 for (Integer i = 0; i < nb_dof_per_item.size(); ++i)
70 total_nb_dof_per_item += nb_dof_per_item[i];
72 ARCANE_ASSERT((total_nb_dof_per_item == to_items.size()),
73 (
"Incorrect connected family size. Should be equal to the sum of array nb_element_per_item elements"))
75 m_item_property.resize(_sourceFamily(),nb_dof_per_item,NULL_ITEM_LOCAL_ID);
79 for (Integer j = 0; j < nb_dof_per_item[iitem->localId()]; ++j)
80 m_item_property[iitem][j] = to_items[i++].localId();
87void ItemConnectivity::
90 ARCANE_ASSERT((from_items.
size() == to_items.
size()),(
"from_items and to_items arrays must have the same size to update connectivity"))
92 m_item_property.resize(_sourceFamily(),NULL_ITEM_LOCAL_ID);
93 ItemVectorView from_items_view = _sourceFamily()->view(from_items);
94 for (
Integer i = 0; i < from_items_view.
size(); ++i)
95 m_item_property[from_items_view[i]] = to_items[i];
101void ItemArrayConnectivity::
104 ARCANE_ASSERT((from_items.
size() == to_items.
size()),(
"from_items and to_items arrays must have the same size to update connectivity"))
106 m_item_property.resize(_sourceFamily(),m_nb_dof_per_item, NULL_ITEM_LOCAL_ID);
108 std::set<Int32> from_items_set;
109 ItemVectorView from_items_view = _sourceFamily()->view(from_items);
111 if (! from_items_set.insert(from_items[i]).second)
112 ++to_items_index[from_items[i]];
113 m_item_property[from_items_view[i]][to_items_index[from_items[i]]] = to_items[i];
120void ItemMultiArrayConnectivity::
123 ARCANE_ASSERT((from_items.
size() == to_items.
size()),
124 (
"from_items and to_items arrays must have the same size to update connectivity"))
129 nb_connected_element_per_item.
resize(_sourceFamily()->maxLocalId(),0);
133 nb_connected_element_per_item[from_items[i]] = 0;
135 ++nb_connected_element_per_item[from_items[i]];
136 m_item_property.
resize(_sourceFamily(),nb_connected_element_per_item,NULL_ITEM_LOCAL_ID);
140 std::set<Int32> from_items_set;
141 ItemVectorView from_items_view = _sourceFamily()->view(from_items);
143 if (! from_items_set.insert(from_items[i]).second)
144 ++to_items_index[from_items[i]];
145 m_item_property[from_items_view[i]][to_items_index[from_items[i]]] = to_items[i];
152void ItemConnectivity::
155 m_item_property.resize(_sourceFamily(), NULL_ITEM_LOCAL_ID);
158 if (m_item_property[item] != NULL_ITEM_LOCAL_ID)
159 m_item_property[item] = old_to_new_ids[m_item_property[item]];
166void ItemArrayConnectivity::
171 for (
Integer i = 0; i < m_nb_dof_per_item; ++i)
173 if (m_item_property[item][i] != NULL_ITEM_LOCAL_ID)
174 m_item_property[item][i] = old_to_new_ids[m_item_property[item][i]];
182void ItemMultiArrayConnectivity::
187 for (
Integer i = 0; i < m_item_property.dim2Sizes()[item.localId()]; ++i)
189 if (m_item_property[item][i] != NULL_ITEM_LOCAL_ID)
190 m_item_property[item][i] = old_to_new_ids[m_item_property[item][i]];
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Vue sur un vecteur d'entités.
Int32 size() const
Nombre d'éléments du vecteur.
ItemVectorViewT< DoF > DoFVectorView
Vue sur un vecteur de degre de liberte.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
SharedArray< Integer > IntegerSharedArray
Tableau dynamique à une dimension d'entiers.