Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IMeshExchanger.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/* IMeshExchanger.h (C) 2000-2022 */
9/* */
10/* Mesh exchange management between subdomains. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_IMESHEXCHANGER_H
13#define ARCANE_IMESHEXCHANGER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28class IPrimaryMesh;
29class IItemFamily;
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35/*!
36 * \brief Management of a mesh exchange between subdomains.
37 *
38 * An exchange takes place in several phases, which must be executed
39 * in the order dictated by the ePhase enumeration.
40 *
41 */
42class ARCANE_CORE_EXPORT IMeshExchanger
43{
44 public:
45
46 //! Indicates the different phases of the exchange
47 enum class ePhase
48 {
49 Init = 0,
50 ComputeInfos,
51 ProcessExchange,
52 RemoveItems,
53 AllocateItems,
54 UpdateItemGroups,
55 UpdateVariables,
56 Finalize,
57 Ended
58 };
59
60 public:
61
62 virtual ~IMeshExchanger() {} //<! Releases resources
63
64 public:
65
66 /*!
67 * \brief Calculates the information to send/receive from other subdomains.
68 *
69 * This operation is collective.
70 *
71 * The calculation of information to send is done by knowing the new
72 * owner of each entity. This information is stored in
73 * the IItemFamily::itemsNewOwner() variable. For example, a cell
74 * will be migrated if the new owner is different from the current owner
75 * (which is given by Item::owner()).
76 *
77 * After calling this method, each mesh entity is modified as follows:
78 * - the Item::owner() field indicates the new owner.
79 * - the entities that will be deleted after the exchange are marked by the flag
80 * ItemFlags::II_NeedRemove (except for now for particles
81 * without the concept of ghosts, but this is temporary).
82 *
83 * Returns true if there is no exchange to perform.
84 *
85 * \pre phase()==ePhase::ComputeInfos
86 * \post phase()==ePhase::ProcessExchange
87 */
88 virtual bool computeExchangeInfos() = 0;
89
90 /*!
91 * \brief Performs the exchange of information between subdomains.
92 *
93 * This operation is collective.
94 *
95 * This operation makes no modification to the mesh. It simply
96 * sends and receives the necessary information for
97 * mesh update.
98 *
99 * \pre phase()==ePhase::ProcessExchange
100 * \post phase()==ePhase::RemoveItems
101 */
102 virtual void processExchange() = 0;
103
104 /*!
105 * \brief Deletes from this subdomain the entities that should no longer
106 * be there following the exchange.
107 *
108 * All entities marked with the ItemFlags::II_NeedRemove flag
109 * are deleted.
110 *
111 * \pre phase()==ePhase::RemoveItems
112 * \post phase()==ePhase::AllocateItems
113 */
114 virtual void removeNeededItems() = 0;
115
116 /*!
117 * \brief Allocates the entities received from other subdomains.
118 *
119 * This operation is collective.
120 *
121 * \pre phase()==ePhase::AllocateItems
122 * \post phase()==ePhase::UpdateItemGroups
123 */
124 virtual void allocateReceivedItems() = 0;
125
126 /*!
127 * \brief Update of entity groups
128 *
129 * This operation is collective.
130 *
131 * \pre phase()==ePhase::UpdateItemGroups
132 * \post phase()==ePhase::UpdateVariables
133 */
134 virtual void updateItemGroups() = 0;
135
136 /*!
137 * \brief Update of variables
138 *
139 * This operation is collective.
140 *
141 * \pre phase()==ePhase::UpdateVariables
142 * \post phase()==ePhase::Finalize
143 */
144 virtual void updateVariables() = 0;
145
146 /*!
147 * \brief Finalizes the exchanges.
148 *
149 * This operation is collective.
150 *
151 * This method performs the last necessary operations during
152 * the exchange.
153 *
154 * \pre phase()==ePhase::Finalize
155 * \post phase()==ePhase::Ended
156 */
157 virtual void finalizeExchange() = 0;
158
159 //! Mesh associated with this exchanger.
160 virtual IPrimaryMesh* mesh() const = 0;
161
162 //! Exchanger associated with the \a family. Throws an exception if not found.
164
165 //! Phase of the exchange we are currently in.
166 virtual ePhase phase() const = 0;
167};
168
169/*---------------------------------------------------------------------------*/
170/*---------------------------------------------------------------------------*/
171
172} // End namespace Arcane
173
174/*---------------------------------------------------------------------------*/
175/*---------------------------------------------------------------------------*/
176
177#endif
Arcane configuration file.
Interface of an entity family.
Definition IItemFamily.h:83
Management of a mesh exchange between subdomains.
virtual void removeNeededItems()=0
Deletes from this subdomain the entities that should no longer be there following the exchange.
virtual void allocateReceivedItems()=0
Allocates the entities received from other subdomains.
virtual ePhase phase() const =0
Phase of the exchange we are currently in.
virtual void processExchange()=0
Performs the exchange of information between subdomains.
virtual void finalizeExchange()=0
Finalizes the exchanges.
virtual void updateVariables()=0
Update of variables.
virtual bool computeExchangeInfos()=0
Calculates the information to send/receive from other subdomains.
virtual IPrimaryMesh * mesh() const =0
Mesh associated with this exchanger.
virtual IItemFamilyExchanger * findExchanger(IItemFamily *family)=0
Exchanger associated with the family. Throws an exception if not found.
virtual void updateItemGroups()=0
Update of entity groups.
ePhase
Indicates the different phases of the exchange.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --