Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MeshExchange.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* MeshExchange.h (C) 2000-2025 */
9/* */
10/* Exchange of mesh entities between subdomains. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_MESHEXCHANGE_H
13#define ARCANE_MESH_MESHEXCHANGE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18
20
21#include "arcane/mesh/MeshGlobal.h"
22
23#include <set>
24#include <map>
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane
30{
31class IMesh;
32class IParallelMng;
33class IItemFamily;
34} // namespace Arcane
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39namespace Arcane::mesh
40{
41
42/*---------------------------------------------------------------------------*/
43/*---------------------------------------------------------------------------*/
47class MeshExchange
48: public TraceAccessor
49{
50 private:
51
52 template <typename T>
54
55 template <typename T>
57
58 public:
59
60 MeshExchange(IMesh* mesh);
61 ~MeshExchange();
62
63 public:
64
66 void computeInfos();
67
68 public:
69
70 ARCCORE_DEPRECATED_2020("Do not use this method. Try to get ISubDomain from another way")
71 ISubDomain* subDomain() const;
72
73 IMesh* mesh() const { return m_mesh; }
74
77
78 private:
79
81 IParallelMng* m_parallel_mng;
82 Int32 m_nb_rank;
83 Int32 m_rank;
84 IItemFamily* m_cell_family;
85
88 void _addTreeCellToSend(ArrayView<std::set<Int32>> items_to_send,
89 Int32 local_id, Int32 cell_local_id, CellInfoListView cells);
90 void _addTreeItemToSend(Int32 cell_local_id, CellInfoListView cells);
91 void _addItemToSend2(ArrayView<std::set<Int32>> items_to_send,
92 Int32 item_local_id, Int32 cell_local_id);
93 void _familyTree(Int32Array& family, Cell item, const bool reset = true) const;
94 void _computeItemsToSend2();
95
96 void _computeMeshConnectivityInfos(Int32ConstArrayView cells_new_owner);
97 void _computeGraphConnectivityInfos();
98 void _exchangeCellDataInfos(Int32ConstArrayView cells_new_owner, bool use_active_cells);
99 void _computeItemsToSend(bool send_dof = false);
100 void _addItemToSend(ArrayView<std::set<Int32>> items_to_send,
101 Int32 item_local_id, Int32 cell_local_id,
102 bool use_itemfamily_network = false);
103
104 // Version based on ItemFamilyNetwork
106 void _exchangeCellDataInfos3();
107 void _computeItemsToSend3();
108 //void _addItemToSend3(ArrayView< std::set<Int32> > items_to_send,
109 // Int32 item_local_id,Int32 cell_local_id){}
110 void _propagatesToChildConnectivities(IItemFamily* family);
111 void _propagatesToChildDependencies(IItemFamily* family);
112 void _addDestRank(const Item& item, IItemFamily* item_family, const Integer new_owner);
113 void _addDestRank(const Item& item, IItemFamily* item_family, const Item& followed_item,
114 IItemFamily* followed_item_family); // add all the followed items destination rank to item
115 void _allocData(IItemFamily* family);
116 void _addGraphConnectivityToNewConnectivityInfo();
117
118 public:
119
120 std::map<IItemFamily*, UniqueArray<std::set<Int32>>*> m_items_to_send;
121
122 private:
123
124 IncrementalUnorderedMultiArray<Int32>* m_neighbour_cells_owner;
125 IncrementalUnorderedMultiArray<Int32>* m_neighbour_cells_new_owner;
126 DynamicMultiArray<Int32>* m_neighbour_extra_cells_owner;
127 DynamicMultiArray<Int32>* m_neighbour_extra_cells_new_owner;
128
131 void _setItemsToSend(IItemFamily* family);
132 void _printItemToSend(IItemFamily* family); // Debug print SDC
133 void _printItemToRemove(IItemFamily* family); // Debug print SDC
134
135 void _markRemovableItems(bool with_cell_family = true);
136 void _markRemovableDoFs();
137 void _markRemovableParticles();
138 void _markRemovableCells(Int32ConstArrayView cells_new_owner, bool use_active_cells);
139
140 // using ItemDestRankArray = IncrementalUnorderedMultiArray<Int32>; // l'un ou l'autre ?
141 using ItemDestRankArray = DynamicMultiArray<Int32>;
142 using ItemDestRankMap = std::map<IItemFamily*, ItemDestRankArray*>;
143 using ItemDestRankMapArray = UniqueArray<ItemDestRankMap>;
144 ItemDestRankMap m_item_dest_ranks_map; // [family][item] = [item_destination_ranks]
145 ItemDestRankMapArray m_ghost_item_dest_ranks_map; //[rank][family][item]
146
147 void _debugPrint();
148
149 // Check subitems dest_ranks contain parent dest_rank (even after exchangeDataInfo...)
150 void _checkSubItemsDestRanks();
151 void _exchangeGhostItemDataInfos();
152 Integer _getSubdomainIndexInCommunicatingRanks(Integer rank, Int32ConstArrayView communicating_ranks);
153};
154
155/*---------------------------------------------------------------------------*/
156/*---------------------------------------------------------------------------*/
157
158} // End namespace Arcane::mesh
159
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163#endif
Declarations of Arcane's general types.
Modifiable view of an array of type T.
View of cell information.
Cell of a mesh.
Definition Item.h:1300
Constant view of an array of type T.
Interface of an entity family.
Definition IItemFamily.h:83
Interface of the parallelism manager for a subdomain.
Interface of the subdomain manager.
Definition ISubDomain.h:75
Base class for a mesh element.
Definition Item.h:84
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
ConstArrayView< std::set< Int32 > > getItemsToSend(IItemFamily *family) const
List of entities to send by subdomain for the family family.
void computeInfos()
Compute the info.
ArrayView< std::set< Int32 > > _getItemsToSend(IItemFamily *family)
List of entities to send by subdomain for the family family.
void _printItemToSend(IItemFamily *family)
Using ItemFamilyNetwork.
void _computeMeshConnectivityInfos2(Int32ConstArrayView cells_new_owner)
AMR.
void _computeMeshConnectivityInfos3()
AMR OFF.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
std::int32_t Int32
Signed integer type of 32 bits.