Arcane  v3.15.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
DynamicMeshIncrementalBuilder.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* DynamicMeshIncrementalBuilder.h (C) 2000-2025 */
9/* */
10/* Construction d'un maillage de manière incrémentale. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_DYNAMICMESHINCREMENTALBUILDER_H
13#define ARCANE_MESH_DYNAMICMESHINCREMENTALBUILDER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/HashTableMap.h"
18#include "arcane/utils/TraceAccessor.h"
19
20#include "arcane/core/IItemFamilyNetwork.h"
22#include "arcane/core/ItemInternal.h"
23
24#include "arcane/mesh/DynamicMeshKindInfos.h"
25#include "arcane/mesh/ItemData.h"
26#include "arcane/mesh/FullItemInfo.h"
27
28#include <list>
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33namespace Arcane
34{
35class SerializeBuffer;
36}
37
38namespace Arcane::mesh
39{
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
44class DynamicMesh;
45class OneMeshItemAdder;
46class GhostLayerBuilder;
47class FaceUniqueIdBuilder;
48class EdgeUniqueIdBuilder;
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
56: public TraceAccessor
57{
58 public:
59
63
64 public:
65
66 // Ajout de liste d'items du maillage et graphe
67
69 Integer sub_domain_id,Int32ArrayView cells,
70 bool allow_build_face = true);
71 void addCells2(Integer nb_cell,Int64ConstArrayView cell_infos,
72 Integer sub_domain_id,Int32ArrayView cells,
73 bool allow_build_face = true);
75 Integer sub_domain_id,Int32ArrayView cells,
76 bool allow_build_face = true);
78 Integer sub_domain_id,Int32ArrayView faces);
80 Integer sub_domain_id,Int32ArrayView faces);
81 void addFaces3(Integer nb_face,Int64ConstArrayView face_infos,
82 Integer sub_domain_id,Int32ArrayView faces);
84 Integer sub_domain_id,Int32ArrayView edges);
86 Integer sub_domain_id,Int32ArrayView edges);
87 void addEdges3(Integer nb_edge,Int64ConstArrayView edge_infos,
88 Integer sub_domain_id,Int32ArrayView edges);
90 Integer sub_domain_id,Int32ArrayView nodes);
92 Integer sub_domain_id,Int32ArrayView nodes);
93
96 void addRelations(ItemDataList& item_relation_list);
97
99
101 void addParentCells(const ItemVectorView & items);
103 void addParentItems(const ItemVectorView & items, const eItemKind submesh_kind);
107 Int32 sub_domain_id,Int32ArrayView cells,
108 bool allow_build_face);
110 void addGhostLayers(bool is_allocate);
113
114 void removeGhostCells();
115 void removeNeedRemoveMarkedCells();
116
117 public:
118
120
121 void readFromDump();
122
124
125 void setConnectivity(Integer c);
126
129
130 public:
131
132 void printInfos();
133 void printStats(Int32 level = TraceMessage::DEFAULT_LEVEL);
134
135 public:
136
137 ItemInternalMap& itemsMap(eItemKind ik);
138 DynamicMesh* mesh() { return m_mesh; }
139 bool isVerbose() const { return m_verbose; }
140 bool hasEdge() const { return m_has_edge; }
141
142 OneMeshItemAdder* oneMeshItemAdder() const { return m_one_mesh_item_adder; }
143
144 private:
145
146 struct NodeInFace;
147
149 {
150 NodeInFacePtr(const Int64& node_uid) : m_ptr(std::make_shared<NodeInFace>(node_uid)){}
151 bool operator< (const NodeInFacePtr& a) const {return (*m_ptr) < (*a.m_ptr);}
152 NodeInFace* operator->() {return m_ptr.operator->();}
153 const NodeInFace* operator->() const {return m_ptr.operator->();}
154 bool operator==(const NodeInFacePtr& a) const {return (*m_ptr) == (*a.m_ptr);}
155 std::shared_ptr<NodeInFace> m_ptr;
156 };
157
159 {
160// typedef std::shared_ptr<NodeInFace> NodeInFacePtr;
161// typedef std::set<NodeInFacePtr, std::function<bool(const NodeInFacePtr&, const NodeInFacePtr&)>> NodeInFaceSet; // Does not work bad function call exception (gcc 4.7.2 pb ?). Need to define NodeInFacePtr class
162// typedef std::set<NodeInFacePtr> NodeInFaceSet;
163 typedef std::list<NodeInFacePtr> NodeInFaceSet;
164
165 NodeInFace(const Int64& node_uid)
166 : m_uid(node_uid)
167 , m_face_uid(NULL_ITEM_ID){}
168// , m_next_node_set([](const NodeInFacePtr& a, const NodeInFacePtr& b){return (*a) < (*b);}){} // Does not work (gcc 4.7.2 pb ?). Need to define NodeInFacePtr class
169
170 friend bool operator<(const NodeInFace& a,const NodeInFace & nif)
171 {
172 return a.m_uid < nif.m_uid;
173 }
174 friend bool operator==(const NodeInFace& a,const NodeInFace& b)
175 {
176 return a.m_uid == b.m_uid;
177 }
178
179 Int64 faceUid() const {return m_face_uid;}
180 void setFaceUid(Int64 face_uid) {m_face_uid = face_uid;}
181
182 const NodeInFaceSet& nextNodeSet() const {return m_next_node_set;}
183 NodeInFaceSet& nextNodeSet() {return m_next_node_set;}
184// void setNextNode(const NodeInFacePtr & next_node) {m_next_node_set.push_back(next_node);}
185
186 void print(){
187 std::cout << "Node " << m_uid << " has set " << & m_next_node_set << " containing nodes : " << std:: endl;
188 for (auto node : m_next_node_set)
189 {
190 node->print();
191 }
192 }
193
194 public://for DEBUG
195// private:
196 Int64 m_uid;
197 Int64 m_face_uid;
198 NodeInFaceSet m_next_node_set;
199 };
200// typedef NodeInFace::NodeInFacePtr NodeInFacePtr;
201 typedef NodeInFace::NodeInFaceSet NodeInFaceSet;
202
203 private:
204
205 void _printCellFaceInfos(ItemInternal* cell,const String& str);
206
207 void _removeNeedRemoveMarkedItems(ItemInternalMap& map, UniqueArray<Int32>& items_local_id);
208
209 void _fillFaceInfo(Integer& nb_face, Integer nb_cell,Int64Array& faces_infos, Int64ConstArrayView cells_infos, std::map<Int64,Int64SharedArray>& cell_to_face_connectivity_info);
210 void _fillEdgeInfo(Integer& nb_edge, Integer nb_face,Int64Array& edges_infos, Int64ConstArrayView faces_infos, std::map<std::pair<Int64,Int64>, Int64>& edge_uid_map);
211 void _fillNodeInfo(Integer& nb_node, Integer nb_face,Int64Array& nodes_infos, Int64ConstArrayView faces_infos);
212 void _fillNodeInfoFromEdge(Integer& nb_node, Integer nb_edge,Int64Array& nodes_infos, Int64ConstArrayView edges_infos);
213
214 void _fillCellInfo2(Integer nb_cell,Int64ConstArrayView cells_infos,Int64Array& cell_infos2, Integer& nb_face, Int64Array& faces_infos, Int64Array& node_uids, bool allow_build_face);
215 void _fillFaceInfo2(Integer nb_face,Int64ConstArrayView faces_infos,Int64ArrayView face_info2, Int64Array& node_uids);
217
218 void _fillEdgeNewInfoNew(Integer nb_edge,Int64ConstArrayView edges_infos,Int64ArrayView edge_new_infos);
220 void _fillCellNewInfoNew(Integer nb_cell,Int64ConstArrayView cells_infos,Int64Array& cell_infos2, const std::map<Int64,Int64SharedArray>& cell_to_face_connectivity_info, const std::map<std::pair<Int64,Int64>, Int64>& edge_uid_map);
221 void _fillFaceNewInfoNew(Integer nb_face,Int64ConstArrayView faces_infos,Int64Array& face_infos2, const std::map<std::pair<Int64,Int64>, Int64>& edge_uid_map);
222 void _fillItemInfo2(ItemDataList& item_data_list, Int64ConstArrayView cells_infos);
223
234 void _initEmptyRelationInfo(Int64Array& source_relation_info, std::map<Int64, Int64SharedArray>& source_to_target_uids, Int64ConstArrayView source_item_uids_and_types,
235 Integer approx_relation_size,
237 void _appendInitializedRelationInfo(Int64Array& source_relation_info, std::map<Int64, Int64SharedArray>& source_to_target_uids, Int64ConstArrayView source_item_uids_and_types,
238 Integer approx_relation_size,
240
241 Int64 _findFaceUniqueId(Int64ConstArrayView work_face_sorted_nodes, NodeInFaceSet& face_nodes_set);
242 Int64 _findFaceInFaceNodesSet(const NodeInFaceSet& face_nodes_set,Integer index,Int64ConstArrayView face_nodes, NodeInFacePtr node);
243 void _addFaceNodes(NodeInFaceSet& face_nodes_set, Int64ConstArrayView face_nodes, Int64 face_uid);
244 void _addFaceInFaceNodesSet(NodeInFaceSet& face_nodes_set,Integer index,Int64ConstArrayView face_nodes, NodeInFacePtr node, Int64 face_uid);
245 NodeInFacePtr& _insertNode(NodeInFaceSet& face_nodes_set, Int64 inserted_node_uid);
246 void _addItemsOrRelations(ItemDataList& info_list, IItemFamilyNetwork::eSchedulingOrder family_graph_traversal_order);
247
248 private:
249
251 ItemTypeMng* m_item_type_mng = nullptr;
252
253 Integer m_connectivity = 0;
254 bool m_has_edge = false;
255
258
259 bool m_verbose = false;
260
264 FaceUniqueIdBuilder* m_face_unique_id_builder = nullptr;
265 EdgeUniqueIdBuilder* m_edge_unique_id_builder = nullptr;
266
267 Int64 m_face_uid_pool = 0;
268 Int64 m_edge_uid_pool = 0;
269};
270
271/*---------------------------------------------------------------------------*/
272/*---------------------------------------------------------------------------*/
273
274} // End namespace Arcane::mesh
275
276/*---------------------------------------------------------------------------*/
277/*---------------------------------------------------------------------------*/
278
279#endif
Déclarations des types généraux de Arcane.
Tableau d'items de types quelconques.
Maille d'un maillage.
Definition Item.h:1191
Interface d'une famille d'entités.
Structure interne d'une entité de maillage.
Gestionnaire des types d'entités de maillage.
Definition ItemTypeMng.h:66
Vue sur un vecteur d'entités.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:149
Construction d'un maillage de manière incrémentale.
void addNodes2(Int64ConstArrayView nodes_uid, Integer sub_domain_id, Int32ArrayView nodes)
Ajoute des noeuds au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fam...
void computeFacesUniqueIds()
Calcul les numéros uniques de chaque face.
void setConnectivity(Integer c)
Définit la connectivité active pour le maillage associé
void addParentCells(const ItemVectorView &items)
Ajout au maillage courant d'item venant d'un maillage parent.
void addCells(Integer nb_cell, Int64ConstArrayView cell_infos, Integer sub_domain_id, Int32ArrayView cells, bool allow_build_face=true)
Ajoute des mailles au maillage actuel.
void addParentItems(const ItemVectorView &items, const eItemKind submesh_kind)
Ajout au maillage courant d'item venant d'un maillage parent.
OneMeshItemAdder * m_one_mesh_item_adder
Outils de construction du maillage.
Int64 m_face_uid_pool
Numéro du uniqueId() utilisé pour générer les faces.
void resetAfterDeallocate()
Remise à zéro des structures pour pouvoir faire à nouveau une allocation.
void addGhostChildFromParent(Array< Int64 > &ghost_cell_to_refine)
AMR.
void addEdges2(Integer nb_edge, Int64ConstArrayView edge_infos, Integer sub_domain_id, Int32ArrayView edges)
Ajoute des arêtes au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fam...
Int64 m_edge_uid_pool
Numéro du uniqueId() utilisé pour générer les edges.
void addItems(ItemDataList &item_info_list)
Ajout générique d'items d'un ensemble de famille pour lesquelles on fournit un ItemData.
void addNodes(Int64ConstArrayView nodes_uid, Integer sub_domain_id, Int32ArrayView nodes)
Ajoute des noeuds au maillage actuel.
void addFaces(Integer nb_face, Int64ConstArrayView face_infos, Integer sub_domain_id, Int32ArrayView faces)
Ajoute des faces au maillage actuel.
void addEdges(Integer nb_edge, Int64ConstArrayView edge_infos, Integer sub_domain_id, Int32ArrayView edges)
Ajoute des arêtes au maillage actuel.
GhostLayerBuilder * m_ghost_layer_builder
Outil pour construire les éléments fantômes.
void addHChildrenCells(Cell hParent_cell, Integer nb_cell, Int64ConstArrayView cells_infos, Int32 sub_domain_id, Int32ArrayView cells, bool allow_build_face)
Ajoute des mailles au maillage actuel.
bool m_has_edge
Info sur la présence d'arête (accèlere l'accès à la connectivité générale)
void addFamilyItems(ItemData &item_info)
Ajout générique d'items d'une famille, décrite par son ItemInfo.
void removeNeedRemoveMarkedItems()
Supprime les items fantômes.
void addCells3(Integer nb_cell, Int64ConstArrayView cell_infos, Integer sub_domain_id, Int32ArrayView cells, bool allow_build_face=true)
Ajoute des mailles au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fa...
void addFaces2(Integer nb_face, Int64ConstArrayView face_infos, Integer sub_domain_id, Int32ArrayView faces)
Ajoute des faces au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fami...
Integer m_connectivity
Info de connectivité du maillage courant.
Implémentation d'un maillage.
Definition DynamicMesh.h:97
Construction des couches fantômes.
Construction des couches fantômes.
Construction des couches fantômes.
Tableau associatif de ItemInternal.
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
eItemKind
Genre d'entité de maillage.