Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
VariableSynchronizerEventArgs.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* VariableSynchronizerEventArgs.cc (C) 2000-2023 */
9/* */
10/* Arguments des évènements générés par IVariableSynchronizer. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/VariableSynchronizerEventArgs.h"
15#include "arcane/VariableCollection.h"
16
17/*---------------------------------------------------------------------------*/
18/*---------------------------------------------------------------------------*/
19
20namespace Arcane
21{
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26VariableSynchronizerEventArgs::
27VariableSynchronizerEventArgs(IVariable* var,IVariableSynchronizer* vs,
28 Real elapsed_time, State state)
29: m_var_syncer(vs)
30{
31 initialize(var);
32 m_state = state;
33 m_elapsed_time = elapsed_time;
34}
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39VariableSynchronizerEventArgs::
40VariableSynchronizerEventArgs(VariableCollection vars,IVariableSynchronizer* vs,
41 Real elapsed_time, State state)
42: m_var_syncer(vs)
43{
44 initialize(vars);
45 m_state = state;
46 m_elapsed_time = elapsed_time;
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52VariableSynchronizerEventArgs::
53VariableSynchronizerEventArgs(IVariable* var,IVariableSynchronizer* vs)
54: m_var_syncer(vs)
55{
56 initialize(var);
57}
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62VariableSynchronizerEventArgs::
63VariableSynchronizerEventArgs(VariableCollection vars,IVariableSynchronizer* vs)
64: m_var_syncer(vs)
65{
66 initialize(vars);
67}
68
69/*---------------------------------------------------------------------------*/
70/*---------------------------------------------------------------------------*/
71
72//! Liste des variables synchronisées.
73ConstArrayView<IVariable*> VariableSynchronizerEventArgs::
74variables() const
75{
76 return m_variables.view();
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82void VariableSynchronizerEventArgs::
83initialize(const VariableCollection& vars)
84{
85 _reset();
86 m_variables.reserve(vars.count());
87 m_compare_status_list.reserve(vars.count());
88 for( VariableCollectionEnumerator v(vars); ++v; ){
89 m_variables.add(*v);
90 m_compare_status_list.add(CompareStatus::Unknown);
91 }
92}
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
97void VariableSynchronizerEventArgs::
98initialize(IVariable* var)
99{
100 _reset();
101 m_variables.add(var);
102 m_compare_status_list.add(CompareStatus::Unknown);
103}
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108void VariableSynchronizerEventArgs::
109_reset()
110{
111 m_elapsed_time = 0.0;
112 m_state = State::BeginSynchronize;
113 m_variables.clear();
114 m_compare_status_list.clear();
115}
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120}
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
Collection de variables.
Vue constante d'un tableau de type T.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-