Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemSharedInfoList.h
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/* ItemSharedInfoList.h (C) 2000-2022 */
9/* */
10/* Liste de 'ItemSharedInfo'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_ITEMSHAREDINFOLIST_H
13#define ARCANE_MESH_ITEMSHAREDINFOLIST_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/String.h"
19#include "arcane/utils/HashTableMap.h"
20
21#include "arcane/ItemGroup.h"
22#include "arcane/ItemInternal.h"
23#include "arcane/VariableTypedef.h"
24
25#include "arcane/mesh/MeshGlobal.h"
26
27#include <map>
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane::mesh
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38class ItemFamily;
39
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
51{
52 friend class ItemSharedInfoList;
53 static const Int32 NULL_INDEX = ItemSharedInfo::NULL_INDEX;
54
55 public:
56
58
59 private:
60
63
64 public:
65
66 ItemSharedInfo* sharedInfo() { return m_shared_info; }
67 ItemTypeId itemTypeId() { return this->m_type_id; }
68 Int32 index() const { return m_index; }
69 void setIndex(Int32 aindex) { m_index = aindex; }
70 Int32 nbReference() const { return m_nb_reference; }
71 void addReference(){ ++m_nb_reference; }
72 void removeReference(){ --m_nb_reference; }
73 void serializeWrite(Int32ArrayView buffer);
74 static Integer serializeSize() { return 6; }
75
76 public:
77
78 friend std::ostream& operator<<(std::ostream& o,const ItemSharedInfoWithType& isi)
79 {
80 isi.m_shared_info->print(o);
81 return o;
82 }
83
84 private:
85
86 ItemSharedInfo* m_shared_info = nullptr;
87 ItemTypeId m_type_id;
88 Int32 m_index = NULL_INDEX;
89 Int32 m_nb_reference = 0;
90};
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
101: public TraceAccessor
102{
103 public:
104
105 class ItemNumElements;
106 class Variables;
107 typedef std::map<ItemNumElements,ItemSharedInfoWithType*> ItemSharedInfoMap;
108
109 public:
110
114
115 public:
116
117 ConstArrayView<ItemSharedInfoWithType*> itemSharedInfos() const { return m_item_shared_infos; }
118 ArrayView<ItemSharedInfoWithType*> itemSharedInfos() { return m_item_shared_infos; }
119
120 private:
121
122 ItemSharedInfoWithType* allocOne()
123 {
124 bool need_alloc = false;
125 ItemSharedInfoWithType* next = _allocOne(need_alloc);
126 return next;
127 }
128
129 ItemSharedInfoWithType* allocOne(bool& need_alloc)
130 {
131 ItemSharedInfoWithType* next = _allocOne(need_alloc);
132 return next;
133 }
134
135 void removeOne(ItemSharedInfoWithType* item)
136 {
137 m_list_changed = true;
138 m_free_item_shared_infos.add(item);
140 }
141
142 public:
143
145 void checkValid();
146
147 Integer nbItemSharedInfo() const { return m_nb_item_shared_info; }
148
149 void prepareForDump();
150 void readFromDump();
151
152 void dumpSharedInfos();
153
155 bool hasChanged() { return m_list_changed; }
156
157 public:
158
159 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
160 Integer maxNodePerItem() const { return 0; }
161 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
162 Integer maxEdgePerItem() const { return 0; }
163 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
164 Integer maxFacePerItem() const { return 0; }
165 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
166 Integer maxCellPerItem() const { return 0; }
167 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
168 Integer maxLocalNodePerItemType() const { return 0; }
169 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
170 Integer maxLocalEdgePerItemType() const { return 0; }
171 ARCANE_DEPRECATED_REASON("Y2022: This method always return 0")
172 Integer maxLocalFacePerItemType() const { return 0; }
173
174 public:
175
176 ItemSharedInfoWithType* findSharedInfo(ItemTypeInfo* type);
177
178 private:
179
180 ItemSharedInfoWithType* _allocOne(bool& need_alloc)
181 {
182 ItemSharedInfoWithType* new_item = 0;
183 Integer nb_free = m_free_item_shared_infos.size();
184 m_list_changed = true;
185 if (nb_free!=0){
186 new_item = m_free_item_shared_infos.back();
187 m_free_item_shared_infos.popBack();
188 need_alloc = false;
189 }
190 else{
191 new_item = m_item_shared_infos_buffer->allocOne();
192 new_item->setIndex(m_item_shared_infos.size());
193 m_item_shared_infos.add(new_item);
194 need_alloc = true;
195 }
197 return new_item;
198 }
199
200 private:
201
202 ItemFamily* m_family = nullptr;
203 ItemSharedInfo* m_common_item_shared_info = nullptr;
205 eItemKind m_item_kind = IK_Unknown;
206 UniqueArray<ItemSharedInfoWithType*> m_item_shared_infos;
207 UniqueArray<ItemSharedInfoWithType*> m_free_item_shared_infos;
208 MultiBufferT<ItemSharedInfoWithType>* m_item_shared_infos_buffer;
209 ItemSharedInfoMap* m_infos_map = nullptr;
210 Variables* m_variables = nullptr;
211 bool m_list_changed = false;
212};
213
214/*---------------------------------------------------------------------------*/
215/*---------------------------------------------------------------------------*/
216
217} // End namespace Arcane::mesh
218
219/*---------------------------------------------------------------------------*/
220/*---------------------------------------------------------------------------*/
221
222#endif
Structure interne partagée d'une entité de maillage.
static ItemSharedInfo nullItemSharedInfo
Pour l'entité nulle.
Type d'une entité (Item).
Definition ItemTypeId.h:32
Infos sur un type d'entité du maillage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Famille d'entités.
Definition ItemFamily.h:76
Infos de maillage pour un genre donné d'entité.
bool hasChanged()
Indique si la liste a changée depuis le dernier appel à prepareForDump()
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é.
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
eItemKind
Genre d'entité de maillage.
@ IK_Unknown
Entité de maillage de genre inconnu ou non initialisé
Int32 Integer
Type représentant un entier.