Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemData.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ItemData.cc (C) 2000-2021 */
9/* */
10/* Class gathering item data : ids and connectivities */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ITraceMng.h"
15#include "arcane/utils/CheckedConvert.h"
16
17#include "arcane/IParallelMng.h"
18#include "arcane/MeshPartInfo.h"
19
20#include "arcane/mesh/ItemData.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::mesh
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31void ItemData::
32serialize(ISerializer* buffer)
33{
34 switch(buffer->mode()){
35 case ISerializer::ModeReserve:
36 {
37 buffer->reserve(m_item_family->name());
38 buffer->reserve(itemKindName(m_item_family->itemKind()));
39 buffer->reserve(DT_Int64,2); // nb_items + item_infos.size
40 buffer->reserveSpan(DT_Int32,m_nb_items);// m_owners
41 buffer->reserveSpan(DT_Int64,m_item_infos.size());
42 }
43 break;
45 {
46 buffer->put(m_item_family->name());
47 buffer->put(itemKindName(m_item_family->itemKind()));
48 buffer->putInt64(m_nb_items);
49 buffer->putInt64(m_item_infos.size());
50 buffer->putSpan(m_item_owners);
51 buffer->putSpan(m_item_infos);
52 }
53 break;
55 {
56 deserialize(buffer,m_item_family->mesh());
57 }
58 break;
59 }
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65void ItemData::
66deserialize(ISerializer* buffer, IMesh* mesh)
67{
68 _deserialize(buffer,mesh);
69 // use internal lids array
70 _internal_item_lids.resize(m_nb_items);
71 m_item_lids = _internal_item_lids;
72}
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77void ItemData::
78deserialize(ISerializer* buffer, IMesh* mesh, Int32Array& item_lids)
79{
80 _deserialize(buffer,mesh);
81 item_lids.resize(m_nb_items);
82 m_item_lids = item_lids;
83}
84
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89void ItemData::
90_deserialize(ISerializer* buffer, IMesh* mesh)
91{
92 ARCANE_ASSERT((buffer->mode() == ISerializer::ModeGet),
93 ("Impossible to deserialize a buffer not in ModeGet. In ItemData::deserialize.Exiting"))
94 String family_name;
95 buffer->get(family_name);
96 String item_kind_name;
97 buffer->get(item_kind_name);
98 std::istringstream iss(item_kind_name.localstr());
99 eItemKind family_kind;
100 iss >> family_kind;
101 m_item_family = mesh->findItemFamily(family_kind,family_name,false);
102 m_item_family_modifier = mesh->findItemFamilyModifier(family_kind,family_name);
103 m_nb_items = CheckedConvert::toInt32(buffer->getInt64());
104 m_item_owners.resize(m_nb_items);
105 m_item_infos.resize(buffer->getInt64());
106 buffer->getSpan(m_item_owners);
107 buffer->getSpan(m_item_infos);
108 m_subdomain_id = mesh->meshPartInfo().partRank();
109// mesh->traceMng()->debug() << " DESERIALIZE " << m_item_owners;
110// mesh->traceMng()->debug() << " DESERIALIZE " << m_item_infos;
111}
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115} // End namespace Arcane::mesh
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
eItemKind
Genre d'entité de maillage.
const char * itemKindName(eItemKind kind)
Nom du genre d'entité.
Array< Int32 > Int32Array
Tableau dynamique à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:327
@ DT_Int32
Donnée de type entier 32 bits.
Definition DataTypes.h:43
@ DT_Int64
Donnée de type entier 64 bits.
Definition DataTypes.h:44