16#include "arcane/mesh/ItemConnectivityMng.h"
17#include "arcane/mesh/ItemConnectivitySynchronizer.h"
30 std::map<IItemConnectivity*, IItemConnectivitySynchronizer*>::iterator
ite = m_synchronizers.find(connectivity);
32 if (
ite == m_synchronizers.end()){
34 m_synchronizers[connectivity] = synchronizer;
40 m_synchronizers.erase(
ite);
41 m_synchronizers[connectivity] = synchronizer;
49void ItemConnectivityMng::
68 m_trace_mng->warning() <<
"Connectivity " << connectivity_name <<
" already registered.";
74void ItemConnectivityMng::
90void ItemConnectivityMng::
101void ItemConnectivityMng::
109void ItemConnectivityMng::
110getSourceFamilyModifiedItems(IIncrementalItemConnectivity* connectivity, Int32ArrayView& added_items, Int32ArrayView& removed_items)
112 ConnectivityState& connectivity_state = _findConnectivity(connectivity->name());
113 FamilyState& family_state = _findFamily(connectivity->sourceFamily()->fullName());
114 _getModifiedItems(connectivity_state.m_state_with_source_family,family_state,added_items,removed_items);
120void ItemConnectivityMng::
121getTargetFamilyModifiedItems(IIncrementalItemConnectivity* connectivity, Int32ArrayView& added_items, Int32ArrayView& removed_items)
123 ConnectivityState& connectivity_state = _findConnectivity(connectivity->name());
124 FamilyState& family_state = _findFamily(connectivity->targetFamily()->fullName());
125 _getModifiedItems(connectivity_state.m_state_with_target_family,family_state,added_items,removed_items);
130void ItemConnectivityMng::
131_getModifiedItems(ConnectivityStateData& connectivity_state, FamilyState& family_state,
132 Int32ArrayView& added_items, Int32ArrayView& removed_items)
134 if (connectivity_state.m_last_family_state == family_state.m_state)
137 Integer first_added_item_index = connectivity_state.m_last_added_item_index +1;
138 Integer nb_added_items = family_state.m_added_items.size()-first_added_item_index;
139 auto unfiltered_added_items = family_state.m_added_items.subView(first_added_item_index,nb_added_items);
141 family_state.m_current_added_items.clear();
142 family_state.m_current_added_items.resize(nb_added_items);
144 std::copy_if(unfiltered_added_items.begin(),unfiltered_added_items.end(),
145 family_state.m_current_added_items.begin(),
146 [&true_size](
Int32 const& item_lid){
147 auto do_copy = (item_lid != NULL_ITEM_LOCAL_ID);
148 if (do_copy) ++true_size;
151 family_state.m_current_added_items.resize(true_size);
152 added_items = family_state.m_current_added_items.view();
154 Integer first_removed_item_index = connectivity_state.m_last_removed_item_index +1;
155 Integer nb_removed_items = family_state.m_removed_items.size()-first_removed_item_index;
156 removed_items = family_state.m_removed_items.subView(first_removed_item_index,nb_removed_items);
162void ItemConnectivityMng::
172void ItemConnectivityMng::
185void ItemConnectivityMng::
195Integer ItemConnectivityMng::
196_lastUpdateSourceFamilyState(
const String& connectivity_name)
198 return _findConnectivity(connectivity_name).m_state_with_source_family.m_last_family_state;
205_lastUpdateTargetFamilyState(
const String& connectivity_name)
207 return _findConnectivity(connectivity_name).m_state_with_target_family.m_last_family_state;
214_familyState(
const String& family_full_name)
216 return _findFamily(family_full_name).m_state;
222ConnectivityState& ItemConnectivityMng::
223_findConnectivity(
const String& connectivity_name)
225 ConnectivityStateMap::iterator connectivity_state_iterator = m_connectivity_states.find(connectivity_name);
226 if (connectivity_state_iterator == m_connectivity_states.end())
227 throw FatalErrorException(String::format(
228 "Cannot find connectivity {0}. Use registerConnectivity(connectivity) first",connectivity_name));
229 return connectivity_state_iterator->second;
235FamilyState& ItemConnectivityMng::
236_findFamily(
const String& family_full_name)
238 FamilyStateMap::iterator family_state_iterator = m_family_states.find(family_full_name);
239 if (family_state_iterator == m_family_states.end())
240 throw FatalErrorException(String::format(
241 "Cannot find family {0}. Use registerConnectivity(connectivity) first",family_full_name));
242 return family_state_iterator->second;
248void ItemConnectivityMng::
255 for (Arcane::Integer i = 0; i <
family_state.m_added_items.size(); ++i)
257 if (
family_state.m_added_items[i] != NULL_ITEM_LOCAL_ID)
261 else family_state.m_added_items[i] = NULL_ITEM_LOCAL_ID;
Interface pour gérer une connectivité incrémentale.
virtual String name() const =0
Nom de la connectivité
virtual IItemFamily * targetFamily() const =0
Famille cible.
virtual IItemFamily * sourceFamily() const =0
Famille source.
Interface pour gérer une connectivité.
virtual IItemFamily * targetFamily() const =0
Famille cible.
virtual IItemFamily * sourceFamily() const =0
Famille source.
virtual const String & name() const =0
Nom de la connectivité
Interface d'une famille d'entités.
virtual String fullName() const =0
Nom complet de la famille (avec celui du maillage)
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
Chaîne de caractères unicode.
Int32 Integer
Type représentant un entier.