Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IVariableSynchronizer.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/* IVariableSynchronizer.h (C) 2000-2024 */
9/* */
10/* Interface of a variable synchronization service. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13#ifndef ARCANE_CORE_IVARIABLESYNCHRONIZER_H
14#define ARCANE_CORE_IVARIABLESYNCHRONIZER_H
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29/*!
30 * \brief Interface of a variable synchronization service.
31 *
32 * This class is managed by Arcane and is generally not necessary
33 * to use directly. If you want to synchronize a variable,
34 * you just need to call the VariableRef::synchronize() method.
35 *
36 * An instance of this class is created via
37 * IParallelMng::createVariableSynchronizer(). An instance is associated
38 * with an entity group. You must call the compute() function
39 * to calculate the synchronization information. If the entities are
40 * compacted, you must call changeLocalIds().
41 */
42class ARCANE_CORE_EXPORT IVariableSynchronizer
43{
44 public:
45
46 virtual ~IVariableSynchronizer() {}
47
48 public:
49
50 //! Associated parallel manager
51 virtual IParallelMng* parallelMng() = 0;
52
53 /*!
54 * \brief Entity group used for synchronization.
55 *
56 * The current implementation only supports the group
57 * of all entities of a family.
58 */
59 virtual const ItemGroup& itemGroup() = 0;
60
61 /*!
62 * \brief Recalculates the synchronization information.
63 *
64 * This operation is collective.
65 *
66 * This function must be called if the entities in itemGroup() change
67 * owner or if the group itself evolves.
68 * TODO: call this function automatically if needed.
69 */
70 virtual void compute() = 0;
71
72 //! Called when the local IDs of the entities are modified.
73 virtual void changeLocalIds(Int32ConstArrayView old_to_new_ids) = 0;
74
75 //! Synchronizes the variable \a var in blocking mode
76 virtual void synchronize(IVariable* var) = 0;
77
78 // TODO: make pure virtual (December 2024)
79 /*!
80 * \brief Synchronizes the variable \a var on the entities \a local_ids in blocking mode
81 *
82 * Only the entities listed in \a local_ids will be synchronized. Note:
83 * an entity present in this list on one subdomain must be present
84 * in this list for any other subdomain that owns this entity.
85 */
86 virtual void synchronize(IVariable* var, Int32ConstArrayView local_ids);
87
88 /*!
89 * \brief Synchronizes the variables \a vars in blocking mode.
90 *
91 * All variables must belong to the same family
92 * and this entity group.
93 */
94 virtual void synchronize(VariableCollection vars) = 0;
95
96 // TODO: make pure virtual (December 2024)
97 /*!
98 * \brief Synchronizes the variables \a vars in blocking mode.
99 *
100 * All variables must belong to the same family
101 * and this entity group.
102 *
103 * Only the entities listed in \a local_ids will be synchronized. Note:
104 * an entity present in this list on one subdomain must be present
105 * in this list for any other subdomain that owns this entity.
106 */
107 virtual void synchronize(VariableCollection vars, Int32ConstArrayView local_ids);
108
109 /*!
110 * \brief Ranks of subdomains with which communication occurs.
111 */
113
114 /*!
115 * \brief List of local IDs of entities shared with a subdomain.
116 *
117 * The rank of the subdomain is that of communicatingRanks()[index].
118 */
120
121 /*!
122 * \brief List of local IDs of ghost entities with a subdomain.
123 *
124 * The rank of the subdomain is that of communicatingRanks()[index].
125 */
127
128 /*!
129 * \brief Synchronizes the data \a data.
130 *
131 * The data \a data must be associated with a variable for which
132 * it is valid to call \a synchronize(). This method is internal
133 * to Arcane.
134 */
135 virtual void synchronizeData(IData* data) = 0;
136
137 /*!
138 * \brief Event sent at the beginning and end of synchronization.
139 *
140 * This event is sent during calls to the methods
141 * synchronize(IVariable* var)
142 * and synchronize(VariableCollection vars). If you wish to be notified
143 * of synchronizations for all instances of IVariableSynchronizer,
144 * you must use IVariableMng::synchronizerMng().
145 */
147};
148
149/*---------------------------------------------------------------------------*/
150/*---------------------------------------------------------------------------*/
151
152} // namespace Arcane
153
154/*---------------------------------------------------------------------------*/
155/*---------------------------------------------------------------------------*/
156
157#endif
Declarations of Arcane's general types.
Interface of a data item.
Definition IData.h:34
Interface of the parallelism manager for a subdomain.
Interface of a variable synchronization service.
virtual Int32ConstArrayView ghostItems(Int32 index)=0
List of local IDs of ghost entities with a subdomain.
virtual Int32ConstArrayView communicatingRanks()=0
Ranks of subdomains with which communication occurs.
virtual void changeLocalIds(Int32ConstArrayView old_to_new_ids)=0
Called when the local IDs of the entities are modified.
virtual const ItemGroup & itemGroup()=0
Entity group used for synchronization.
virtual void compute()=0
Recalculates the synchronization information.
virtual IParallelMng * parallelMng()=0
Associated parallel manager.
virtual Int32ConstArrayView sharedItems(Int32 index)=0
List of local IDs of entities shared with a subdomain.
virtual EventObservable< const VariableSynchronizerEventArgs & > & onSynchronized()=0
Event sent at the beginning and end of synchronization.
virtual void synchronizeData(IData *data)=0
Synchronizes the data data.
virtual void synchronize(VariableCollection vars)=0
Synchronizes the variables vars in blocking mode.
virtual void synchronize(IVariable *var)=0
Synchronizes the variable var in blocking mode.
Interface of a variable.
Definition IVariable.h:40
Mesh entity group.
Definition ItemGroup.h:51
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
std::int32_t Int32
Signed integer type of 32 bits.