Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemSharedInfo.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* ItemSharedInfo.cc (C) 2000-2023 */
9/* */
10/* Informations communes à plusieurs entités. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/ItemSharedInfo.h"
15
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/FatalErrorException.h"
18
19#include "arcane/IMesh.h"
20#include "arcane/IItemFamily.h"
21#include "arcane/ItemInternal.h"
22#include "arcane/ItemInfoListView.h"
23#include "arcane/Item.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
35
36// TODO: A terme il faudra pouvoir changer cela pour utiliser une valeur
37// allouée dynamiquement ce qui permettra à cette instance d'être utilisée
38// sur GPU.
39ItemSharedInfo* ItemSharedInfo::nullItemSharedInfoPointer = &ItemSharedInfo::nullItemSharedInfo;
40
41namespace
42{
43// Suppose NULL_ITEM_UNIQUE_ID == (-1) et NULL_ITEM_LOCAL_ID == (-1)
44// Cree un pseudo-tableau qui pourra etre indexé avec NULL_ITEM_LOCAL_ID
45// pour la maille nulle.
46Int64 null_int64_buf[2] = { NULL_ITEM_UNIQUE_ID, NULL_ITEM_UNIQUE_ID };
47Int64ArrayView null_unique_ids(1,null_int64_buf + 1);
48
49Int32 null_parent_items_buf[2] = { NULL_ITEM_ID, NULL_ITEM_ID };
50Int32ArrayView null_parent_item_ids(1,null_parent_items_buf+1);
51
52Int32 null_owners_buf[2] = { A_NULL_RANK, A_NULL_RANK };
53Int32ArrayView null_owners(1,null_owners_buf);
54
55Int32 null_flags_buf[2] = { 0, 0 };
56Int32ArrayView null_flags(1,null_flags_buf+1);
57
58Int16 null_type_ids_buf[2] = { IT_NullType, IT_NullType };
59Int16ArrayView null_type_ids(1,null_type_ids_buf + 1);
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65ItemSharedInfo::
66ItemSharedInfo()
67: m_connectivity(&ItemInternalConnectivityList::nullInstance)
68, m_unique_ids(null_unique_ids)
69, m_parent_item_ids(null_parent_item_ids)
70, m_owners(null_owners)
71, m_flags(null_flags)
72, m_type_ids(null_type_ids)
73{
74 _init(IK_Unknown);
75}
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
80ItemSharedInfo::
81ItemSharedInfo(IItemFamily* family,MeshItemInternalList* items,ItemInternalConnectivityList* connectivity)
82: m_items(items)
83, m_connectivity(connectivity)
84, m_item_family(family)
85, m_item_type_mng(family->mesh()->itemTypeMng())
86, m_item_kind(family->itemKind())
87{
88 _init(m_item_kind);
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94void ItemSharedInfo::
95print(std::ostream& o) const
96{
97 o << " This: " << this
98 << " NbParent; " << m_nb_parent
99 << " Items: " << m_items
100 << " Connectivity: " << m_connectivity
101 << " Family: " << m_item_family->fullName();
102}
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107void ItemSharedInfo::
108_init(eItemKind ik)
109{
110 if (ik==IK_Node || ik==IK_Edge || ik==IK_Face || ik==IK_Cell){
111 IItemFamily* base_family = m_item_family;
112 m_nb_parent = 0;
113 if (base_family)
114 m_nb_parent = base_family->parentFamilyDepth();
115 ARCANE_ASSERT((m_nb_parent<=1),("More than one parent level: not implemented"));
116 }
117}
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122ItemInternal* ItemSharedInfo::
123_parent(Int32 id) const
124{
125 // En pointant vers le bon champ du MeshItemInternalList dans le maillage parent
126 // TODO GG: on pourrait conserver une fois pour toute l'instance de 'ItemInfoListView'
127 return ItemCompatibility::_itemInternal(m_items->mesh->itemFamily(m_item_kind)->parentFamily()->itemInfoListView()[id]);
128}
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
133void ItemSharedInfo::
134setNode(Int32,Int32,Int32) const
135{
136 ARCANE_FATAL("This method is no longer valid");
137}
138
139void ItemSharedInfo::
140setEdge(Int32,Int32,Int32) const
141{
142 ARCANE_FATAL("This method is no longer valid");
143}
144
145void ItemSharedInfo::
146setFace(Int32,Int32,Int32) const
147{
148 ARCANE_FATAL("This method is no longer valid");
149}
150
151void ItemSharedInfo::
152setCell(Int32,Int32,Int32) const
153{
154 ARCANE_FATAL("This method is no longer valid");
155}
156
157void ItemSharedInfo::
158setHParent(Int32,Int32,Int32) const
159{
160 ARCANE_FATAL("This method is no longer valid");
161}
162
163void ItemSharedInfo::
164setHChild(Int32,Int32,Int32) const
165{
166 ARCANE_FATAL("This method is no longer valid");
167}
168
169ItemInternal* ItemSharedInfo::
170parent(Integer,Integer) const
171{
172 ARCANE_FATAL("This method is no longer valid");
173}
174
175void ItemSharedInfo::
176setParent(Integer,Integer,Integer) const
177{
178 ARCANE_FATAL("This method is no longer valid");
179}
180
181Int32 ItemSharedInfo::
182owner(Int32) const
183{
184 ARCANE_FATAL("This method is no longer valid");
185}
186
187void ItemSharedInfo::
188setOwner(Int32,Int32) const
189{
190 ARCANE_FATAL("This method is no longer valid");
191}
192
193Int32 ItemSharedInfo::
194flags(Int32) const
195{
196 ARCANE_FATAL("This method is no longer valid");
197}
198
199void ItemSharedInfo::
200setFlags(Int32,Int32) const
201{
202 ARCANE_FATAL("This method is no longer valid");
203}
204
205void ItemSharedInfo::
206_setInfos(Int32*)
207{
208 ARCANE_FATAL("This method is no longer valid");
209}
210
211/*---------------------------------------------------------------------------*/
212/*---------------------------------------------------------------------------*/
213
214void ItemSharedInfo::
215_setParentV2(Int32 local_id,[[maybe_unused]] Integer aindex,Int32 parent_local_id)
216{
217 ARCANE_ASSERT((aindex==0),("Only one parent access implemented"));
218 m_parent_item_ids[local_id] = parent_local_id;
219}
220
221/*---------------------------------------------------------------------------*/
222/*---------------------------------------------------------------------------*/
223
224Int32* ItemSharedInfo::
225_parentPtr(Int32 local_id)
226{
227 // GG: ATTENTION: Cela ne fonctionne que si on a au plus un parent.
228 return m_parent_item_ids.ptrAt(local_id);
229}
230
231/*---------------------------------------------------------------------------*/
232/*---------------------------------------------------------------------------*/
233
234ItemTypeInfo* ItemSharedInfo::
235typeInfoFromId(Int32 type_id) const
236{
237 return m_item_type_mng->typeFromId(type_id);
238}
239
240/*---------------------------------------------------------------------------*/
241/*---------------------------------------------------------------------------*/
242
243Int32 ItemSharedInfo::
244typeId() const
245{
246 ARCANE_FATAL("This method is no longer valid");
247}
248
249/*---------------------------------------------------------------------------*/
250/*---------------------------------------------------------------------------*/
251
252ItemInternalVectorView ItemSharedInfo::
253nodes(Int32) const
254{
255 return ItemInternalVectorView();
256}
257
258ItemInternalVectorView ItemSharedInfo::
259edges(Int32) const
260{
261 return ItemInternalVectorView();
262}
263
264ItemInternalVectorView ItemSharedInfo::
265faces(Int32) const
266{
267 return ItemInternalVectorView();
268}
269
270ItemInternalVectorView ItemSharedInfo::
271cells(Int32) const
272{
273 return ItemInternalVectorView();
274}
275
276ItemInternalVectorView ItemSharedInfo::
277hChildren(Int32) const
278{
279 return ItemInternalVectorView();
280}
281
282/*---------------------------------------------------------------------------*/
283/*---------------------------------------------------------------------------*/
284
285void ItemSharedInfo::
286updateMeshItemInternalList()
287{
288 m_connectivity->updateMeshItemInternalList();
289}
290
291/*---------------------------------------------------------------------------*/
292/*---------------------------------------------------------------------------*/
293
294} // End namespace Arcane
295
296/*---------------------------------------------------------------------------*/
297/*---------------------------------------------------------------------------*/
298
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Structure interne d'une entité de maillage.
static ItemSharedInfo nullItemSharedInfo
Pour l'entité nulle.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ArrayView< Int16 > Int16ArrayView
Equivalent C d'un tableau à une dimension d'entiers 16 bits.
Definition UtilsTypes.h:613
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:609
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:611