Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IItemFamilyExchanger.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/* IItemFamilyExchanger.h (C) 2000-2025 */
9/* */
10/* Exchange of family entities between sub-domains. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IITEMFAMILYEXCHANGER_H
13#define ARCANE_CORE_IITEMFAMILYEXCHANGER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/List.h"
18#include "arcane/utils/TraceAccessor.h"
19
20#include "arcane/core/VariableCollection.h"
21
22#include "arcane/mesh/MeshGlobal.h"
23
24#include <set>
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane
30{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40/*!
41 * \internal
42 * \brief Exchange of entities and their characteristics for a given family
43
44 This class manages the exchange of entities between sub-domains. It is
45 used, for example, during a redistribution. Generally, this class
46 is not used directly (except to specify the entities to exchange)
47 but via the IMeshExchanger interface.
48
49 The user of this class must start by specifying the list of entities to
50 send to each sub-domain via the setExchangeItems() method.
51
52 Entity exchange is done in several steps as indicated in IMeshExchanger.
53
54 The actual serialization of entities takes place in three successive phases:
55 entities, groups, and variables. Deserialization is done in the same order.
56 Indeed, it is necessary to know the groups to deserialize the variables, and
57 to know the entities to deserialize the groups.
58
59 When cells or particles are sent, you must call the readAndAllocItems()
60 method to create them, before calling readGroups() and then readVariables().
61*/
62class ARCANE_CORE_EXPORT IItemFamilyExchanger
63{
64 public:
65
66 virtual ~IItemFamilyExchanger() {}
67
68 public:
69
70 /*!
71 * \internal
72 * \brief Determines the list of entities to exchange.
73
74 * \warning This method must only be used for particle families.
75
76 This operation uses the itemsOwner() variable and the owner() field of each
77 entity to determine who each entity must be sent to. Therefore, this
78 operation must be called before DynamicMesh::_setOwnerFromVariable() is
79 called.
80 *
81 * \todo To be removed
82 */
83 virtual void computeExchangeItems() = 0;
84
85 //! Positions the list of entities to exchange.
86 virtual void setExchangeItems(ConstArrayView<std::set<Int32>> items_to_send) = 0;
87
88 /*!
89 * \brief Determines the information necessary for the exchanges.
90 * \retval true if there is nothing to exchange
91 * \retval false otherwise.
92 */
93 virtual bool computeExchangeInfos() = 0;
94
95 //! Prepares the sending structures
96 virtual void prepareToSend() = 0;
97 virtual void releaseBuffer() = 0;
98
99 /*!
100 * \brief After receiving messages, reads and creates the transferred entities.
101 *
102 * This method does nothing for entities other than cells and particles,
103 * for legacy management.
104 * With the ItemFamilyNetwork family graph, this method creates the items and
105 * their dependencies (i.e., descendant connectivities).
106 * This involves separating the processing of sub-items (sub-meshes) and
107 * relations (ascending connectivities or dofs), which cannot be processed
108 * until all items are created.
109 *
110 * \warning Before calling this method, you must be certain that entities no longer
111 * belonging to this sub-domain have been destroyed
112 */
113 virtual void readAndAllocItems() = 0;
114 virtual void readAndAllocSubMeshItems() = 0;
115 virtual void readAndAllocItemRelations() = 0;
116
117 //! After receiving messages, reads the groups
118 virtual void readGroups() = 0;
119
120 //! After receiving messages, reads the variable values
121 virtual void readVariables() = 0;
122
123 /*!
124 * \internal
125 * \brief Removes the sent entities.
126 *
127 * This operation must only be performed for entities that do not depend on
128 * another entity. For example, it is impossible to directly delete nodes,
129 * because certain cells that are not sent may rely on them.
130 *
131 * \warning This operation is only valid for particles without the concept of
132 * ghost particles.
133 * \todo To be removed
134 */
135 virtual void removeSentItems() = 0;
136
137 //! Sends the exchange messages
138 virtual void processExchange() = 0;
139
140 /*!
141 * \brief Finalizes the exchange.
142 *
143 * Performs the final updates following an exchange. This method is called
144 * when all entities and variables have been exchanged.
145 */
146 virtual void finalizeExchange() = 0;
147
148 //! Associated family
149 virtual IItemFamily* itemFamily() = 0;
150
151 //! Sets the options used during entity exchange
152 virtual void setParallelExchangerOption(const ParallelExchangerOptions& options) = 0;
153};
154
155/*---------------------------------------------------------------------------*/
156/*---------------------------------------------------------------------------*/
157
158} // End namespace Arcane
159
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163#endif
Constant view of an array of type T.
virtual void setParallelExchangerOption(const ParallelExchangerOptions &options)=0
Sets the options used during entity exchange.
virtual void processExchange()=0
Sends the exchange messages.
virtual void prepareToSend()=0
Prepares the sending structures.
virtual void readVariables()=0
After receiving messages, reads the variable values.
virtual void readGroups()=0
After receiving messages, reads the groups.
virtual IItemFamily * itemFamily()=0
Associated family.
virtual void finalizeExchange()=0
Finalizes the exchange.
virtual bool computeExchangeInfos()=0
Determines the information necessary for the exchanges.
virtual void setExchangeItems(ConstArrayView< std::set< Int32 > > items_to_send)=0
Positions the list of entities to exchange.
virtual void readAndAllocItems()=0
After receiving messages, reads and creates the transferred entities.
Interface of an entity family.
Definition IItemFamily.h:83
Options for IParallelMng::processExchange().
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --