14#include "arcane/utils/FatalErrorException.h"
15#include "arcane/utils/ITraceMng.h"
17#include "arcane/ISubDomain.h"
18#include "arcane/IMesh.h"
19#include "arcane/IMeshSubMeshTransition.h"
20#include "arcane/VariableTypes.h"
22#include "arcane/mesh/ItemSharedInfoList.h"
23#include "arcane/mesh/ItemFamily.h"
36ItemSharedInfoWithType::
37ItemSharedInfoWithType(ItemSharedInfo* shared_info,ItemTypeInfo* item_type)
38: m_shared_info(shared_info)
39, m_type_id(item_type->typeId())
43ItemSharedInfoWithType::
44ItemSharedInfoWithType(ItemSharedInfo* shared_info,ItemTypeInfo* item_type,Int32ConstArrayView buffer)
45: m_shared_info(shared_info)
46, m_type_id(item_type->typeId())
65 Int32 buf_size = buffer.size();
67 ARCANE_FATAL(
"Invalid buf size '{0}'. This is probably because your checkpoint is from a version of Arcane which is too old (before 3.6)",
70 m_nb_reference = buffer[3];
76void ItemSharedInfoWithType::
77serializeWrite(Int32ArrayView buffer)
79 buffer[0] = m_type_id;
84 buffer[3] = m_nb_reference;
113 cout <<
"Compare:\nTHIS=";
117 cout <<
"\nVAL=" << compare(
b);
126 return m_type<
b.m_type;
129 void print(std::ostream& o)
const
131 o <<
" Type=" << m_type;
138bool ItemSharedInfoList::ItemNumElements::m_debug =
false;
172, m_item_kind(family->itemKind())
174, m_infos_map(
new ItemSharedInfoMap())
191 delete m_item_shared_infos_buffer;
197void ItemSharedInfoList::
200 Integer n = m_item_shared_infos.size();
201 info(4) <<
"ItemSharedInfoList: write: " << m_family->
name()
202 <<
" count=" << n <<
" changed=" << m_list_changed;
203 log() <<
"ItemSharedInfoList: write: " << m_family->
name()
204 <<
" count=" << n <<
" changed=" << m_list_changed;
208 m_list_changed =
false;
210 Integer
element_size = ItemSharedInfoWithType::serializeSize();
212 for( Integer i=0; i<n; ++i ){
213 m_item_shared_infos[i]->serializeWrite(m_variables->m_infos_values[i]);
225void ItemSharedInfoList::
228 Integer element_size = ItemSharedInfoWithType::serializeSize();
229 Integer n = m_variables->m_infos_values.
dim1Size();
230 info() <<
"ItemSharedInfoList: read: " << m_family->
name() <<
" count=" << n;
235 Integer stored_size = m_variables->m_infos_values[0].size();
236 if (stored_size==ItemSharedInfoWithType::serializeSize()){
238 else if (stored_size!=element_size){
242 if (stored_size!=13 && stored_size!=9)
243 ARCANE_FATAL(
"Incoherence of saved data (most probably due to a"
244 " difference of versions between the protection and the executable."
245 " stored_size={0} element_size={1} count={2}",
246 stored_size,element_size,n);
251 m_item_shared_infos.clear();
252 m_infos_map->clear();
257 for( Integer i=0; i<n; ++i )
261 for( Integer i=0; i<n; ++i ){
264 ItemTypeInfo* it = itm->typeFromId(buffer[0]);
265 ItemSharedInfoWithType* isi = m_item_shared_infos[i];
266 *isi = ItemSharedInfoWithType(m_common_item_shared_info,it,buffer);
268 ItemNumElements ine(it->typeId());
269 std::pair<ItemSharedInfoMap::iterator,bool> old = m_infos_map->insert(std::make_pair(ine,isi));
274 ItemNumElements::m_debug =
true;
275 bool compare = m_infos_map->find(ine)!=m_infos_map->end();
276 fatal() <<
"INTERNAL: ItemSharedInfoList::readfromDump(): SharedInfo already present family=" << m_family->
name()
278 <<
" type=" << it->typeId()
279 <<
" compare=" << compare
280 <<
"\nNEW_INE=(" << ine <<
")"
281 <<
"\nOLD_INE=(" << old.first->first <<
")"
282 <<
"\nNEW_ISI=(" << *isi <<
")"
283 <<
"\nOLD_ISI=(" << *old.first->second <<
")";
296 info() <<
"ItemSharedInfoList: check valid family=" << m_family->
name()
298 <<
" list=" << m_item_shared_infos.size()
299 <<
" free=" << m_free_item_shared_infos.size()
300 <<
" changed=" << m_list_changed;
304 for( Integer i=0, n=m_item_shared_infos.size(); i<n; ++i ){
306 if (item->index()!=i){
307 error() <<
"The index (" << item->index() <<
") from the list 'ItemSharedInfo' "
308 <<
"of the family " << m_family->
name() <<
" is not "
309 <<
"coherent with its internal value (" << i <<
")";
324 ItemSharedInfoMap::const_iterator i = m_infos_map->find(
ine);
325 if (i!=m_infos_map->end())
332 std::pair<ItemSharedInfoMap::iterator,bool>
old = m_infos_map->insert(std::make_pair(
ine,
isi));
339 ItemNumElements::m_debug =
true;
340 bool compare = m_infos_map->find(
ine)!=m_infos_map->end();
341 fatal() <<
"INTERNE: ItemSharedInfoList::findSharedInfo() SharedInfo déjà présent\n"
343 <<
" type=" << type->
typeId()
344 <<
" compare=" << compare
345 <<
"\nNEW_INE=(" <<
ine <<
")"
346 <<
"\nOLD_INE=(" <<
old.first->first <<
")"
347 <<
"\nNEW_ISI=(" << *
isi <<
")"
348 <<
"\nOLD_ISI=(" << *
old.first->second <<
")";
357void ItemSharedInfoList::
360 info() <<
"--- ItemSharedInfos: family=" << m_family->
name();
361 for( ConstIterT<ItemSharedInfoMap> i(*m_infos_map); i(); ++i ){
362 info() <<
"INE: " << i->first;
363 info() <<
"ISI: " << *i->second;
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
virtual ItemTypeMng * itemTypeMng() const =0
Gestionnaire de types d'entités associé
Structure interne partagée d'une entité de maillage.
Infos sur un type d'entité du maillage.
Int16 typeId() const
Numéro du type.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Tampon pour allocation multiple.
Paramètres nécessaires à la construction d'une variable.
virtual void resize(Integer new_size)
Réalloue le nombre d'éléments de la première dimension du tableau.
IMesh * mesh() const override
Maillage associé
String name() const override
Nom de la famille.
Integer m_nb_item_shared_info
Nombre d'objets alloués.
~ItemSharedInfoList()
Libère les ressources.
void checkValid()
Vérifie si les structures internes de l'instance sont valides.
Classe temporaire pour conserver un ItemSharedInfo et un type d'entité.
constexpr Integer dim1Size() const
Nombre d'éléments de la première dimension.
Chaîne de caractères unicode.
Classe d'accès aux traces.
TraceMessage log() const
Flot pour un message de log.
TraceMessage error() const
Flot pour un message d'erreur.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage fatal() const
Flot pour un message d'erreur fatale.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.