Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
NullVariableSynchronizer.cc
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/* NullVariableSynchronizer.cc (C) 2000-2024 */
9/* */
10/* Synchronization of variables in sequential mode. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/Event.h"
15
16#include "arcane/core/IVariableSynchronizer.h"
17#include "arcane/core/VariableSynchronizerEventArgs.h"
18#include "arcane/core/ItemGroup.h"
19#include "arcane/core/VariableCollection.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
37class NullVariableSynchronizer
39{
40 public:
41
42 NullVariableSynchronizer(IParallelMng* pm, const ItemGroup& group)
43 : m_parallel_mng(pm)
44 , m_item_group(group)
45 {
46 }
47
48 public:
49
51 {
52 return m_parallel_mng;
53 }
54
55 const ItemGroup& itemGroup() override { return m_item_group; }
56 void compute() override {}
57 void changeLocalIds(Int32ConstArrayView old_to_new_ids) override
58 {
59 ARCANE_UNUSED(old_to_new_ids);
60 }
61 void synchronize(IVariable* var) override
62 {
63 ARCANE_UNUSED(var);
64 if (m_on_synchronized.hasObservers()) {
65 VariableSynchronizerEventArgs args(var, this, 0.0);
66 m_on_synchronized.notify(args);
67 }
68 }
69 void synchronize(IVariable* var, Int32ConstArrayView local_ids) override
70 {
71 ARCANE_UNUSED(local_ids);
72 synchronize(var);
73 }
74 void synchronize(VariableCollection vars) override
75 {
76 ARCANE_UNUSED(vars);
77 if (m_on_synchronized.hasObservers()) {
78 VariableSynchronizerEventArgs args(vars, this, 0.0);
79 m_on_synchronized.notify(args);
80 }
81 }
82 void synchronize(VariableCollection vars, Int32ConstArrayView local_ids) override
83 {
84 ARCANE_UNUSED(local_ids);
85 synchronize(vars);
86 }
91
93 {
94 ARCANE_UNUSED(index);
95 return Int32ConstArrayView();
96 }
97
99 {
100 ARCANE_UNUSED(index);
101 return Int32ConstArrayView();
102 }
103 void synchronizeData(IData* data) override
104 {
105 ARCANE_UNUSED(data);
106 }
107
109 {
110 return m_on_synchronized;
111 }
112
113 private:
114
115 IParallelMng* m_parallel_mng;
116 ItemGroup m_item_group;
118};
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123extern "C++" IVariableSynchronizer*
124createNullVariableSynchronizer(IParallelMng* pm, const ItemGroup& group)
125{
126 return new NullVariableSynchronizer(pm, group);
127}
128
129/*---------------------------------------------------------------------------*/
130/*---------------------------------------------------------------------------*/
131
132} // namespace Arcane
133
134/*---------------------------------------------------------------------------*/
135/*---------------------------------------------------------------------------*/
File containing event management mechanisms.
Interface of a data item.
Definition IData.h:34
Interface of the parallelism manager for a subdomain.
Interface of a variable synchronization service.
Interface of a variable.
Definition IVariable.h:40
Mesh entity group.
Definition ItemGroup.h:51
void synchronize(IVariable *var) override
Synchronizes the variable var in blocking mode.
void synchronize(IVariable *var, Int32ConstArrayView local_ids) override
Synchronizes the variable var on the entities local_ids in blocking mode.
Int32ConstArrayView sharedItems(Int32 index) override
List of local IDs of entities shared with a subdomain.
void synchronize(VariableCollection vars) override
Synchronizes the variables vars in blocking mode.
IParallelMng * parallelMng() override
Associated parallel manager.
const ItemGroup & itemGroup() override
Entity group used for synchronization.
void synchronize(VariableCollection vars, Int32ConstArrayView local_ids) override
Synchronizes the variables vars in blocking mode.
EventObservable< const VariableSynchronizerEventArgs & > & onSynchronized() override
Event sent at the beginning and end of synchronization.
void compute() override
Recalculates the synchronization information.
void synchronizeData(IData *data) override
Synchronizes the data data.
void changeLocalIds(Int32ConstArrayView old_to_new_ids) override
Called when the local IDs of the entities are modified.
Int32ConstArrayView ghostItems(Int32 index) override
List of local IDs of ghost entities with a subdomain.
Int32ConstArrayView communicatingRanks() override
Ranks of subdomains with which communication occurs.
Arguments for the event notifying a variable synchronization.
-- 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.