Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
TimeLoop.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* TimeLoop.cc (C) 2000-2014 */
9/* */
10/* Boucle en temps. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/List.h"
17#include "arcane/utils/String.h"
18
19#include "arcane/TimeLoop.h"
20#include "arcane/TimeLoopEntryPointInfo.h"
21#include "arcane/TimeLoopSingletonServiceInfo.h"
22#include "arcane/Configuration.h"
23#include "arcane/IApplication.h"
24
25#include <map>
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30ARCANE_BEGIN_NAMESPACE
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35const char* ITimeLoop::WComputeLoop = "compute-loop";
36const char* ITimeLoop::WBuild = "build";
37const char* ITimeLoop::WInit = "init";
38const char* ITimeLoop::WRestore = "restore";
39const char* ITimeLoop::WOnMeshChanged = "on-mesh-changed";
40const char* ITimeLoop::WOnMeshRefinement = "on-mesh-refinement";
41const char* ITimeLoop::WExit = "exit";
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
45
46typedef List<TimeLoopEntryPointInfo> TimeLoopEntryPointInfoList;
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50/*!
51 * \internal
52 * \brief Boucle en temps.
53 */
55{
56 public:
57
58 typedef std::map<String,List< TimeLoopEntryPointInfo > > EntryPointInfoMap;
59
60 public:
61
62 TimeLoopPrivate(IApplication * mng, const String & name);
63 ~TimeLoopPrivate(){ delete m_configuration; }
64
65 public:
66
67 IApplication* m_application; //!< Application
68 String m_name; //!< Nom informatique
69 String m_title; //!< Titre
70 String m_description; //!< Description
71 bool m_is_old; //! Vrai si boucle en temps au vieux format
73 StringList m_optional_modules_name;
74 StringList m_user_classes; //!< Liste des classes utilisateurs.
75 EntryPointInfoMap m_entry_points;
76 List<TimeLoopSingletonServiceInfo> m_singleton_services;
77 IConfiguration* m_configuration;
78};
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83extern "C++" ARCANE_CORE_EXPORT ITimeLoop*
84arcaneCreateTimeLoop(IApplication* app,const String& name)
85{
86 ITimeLoop * tm = new TimeLoop(app,name);
87 tm->build();
88 return tm;
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94TimeLoopPrivate::
95TimeLoopPrivate(IApplication* app,const String& name)
96: m_application(app)
97, m_name(name)
98, m_is_old(false)
99, m_configuration(0)
100{
101}
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106TimeLoop::
107TimeLoop(IApplication* app,const String& name)
108: m_p(new TimeLoopPrivate(app,name))
109{
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115TimeLoop::
116~TimeLoop()
117{
118 delete m_p;
119}
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
123
125build()
126{
127 m_p->m_configuration = m_p->m_application->configurationMng()->createConfiguration();
128}
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
135{
136 m_p->m_required_modules_name.clone(names);
137}
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
144{
145 m_p->m_optional_modules_name.clone(names);
146}
147
148/*---------------------------------------------------------------------------*/
149/*---------------------------------------------------------------------------*/
150
152entryPoints(const String& where) const
153{
154 TimeLoopPrivate::EntryPointInfoMap::const_iterator it = m_p->m_entry_points.find(where);
155 if (it==m_p->m_entry_points.end()){
157 }
158 return it->second;
159}
160
161/*---------------------------------------------------------------------------*/
162/*---------------------------------------------------------------------------*/
163
165setEntryPoints(const String& where,
167{
168 TimeLoopEntryPointInfoList entry_points;
169 entry_points.clone(calls);
170 m_p->m_entry_points.insert(TimeLoopPrivate::EntryPointInfoMap::value_type(where,entry_points));
171}
172
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
177setUserClasses(const StringCollection& user_classes)
178{
179 m_p->m_user_classes.clone(user_classes);
180}
181
182/*---------------------------------------------------------------------------*/
183/*---------------------------------------------------------------------------*/
184
186application() const
187{
188 return m_p->m_application;
189}
190
192name() const
193{
194 return m_p->m_name;
195}
196
198title() const
199{
200 return m_p->m_title;
201}
202
204setTitle(const String& title)
205{
206 m_p->m_title = title;
207}
208
209bool TimeLoop::
210isOldFormat() const
211{
212 return m_p->m_is_old;
213}
214
215void TimeLoop::
216setOldFormat(bool is_old)
217{
218 m_p->m_is_old = is_old;
219}
220
222description() const
223{
224 return m_p->m_description;
225}
226
228setDescription(const String& description)
229{
231}
232
238
241{
242 return m_p->m_optional_modules_name;
243}
244
246userClasses() const
247{
248 return m_p->m_user_classes;
249}
250
251/*---------------------------------------------------------------------------*/
252/*---------------------------------------------------------------------------*/
253
255singletonServices() const
256{
257 return m_p->m_singleton_services;
258}
259
260/*---------------------------------------------------------------------------*/
261/*---------------------------------------------------------------------------*/
262
265{
266 m_p->m_singleton_services.clone(c);
267}
268
269/*---------------------------------------------------------------------------*/
270/*---------------------------------------------------------------------------*/
271
274{
275 return m_p->m_configuration;
276}
277
278/*---------------------------------------------------------------------------*/
279/*---------------------------------------------------------------------------*/
280
281ARCANE_END_NAMESPACE
282
283/*---------------------------------------------------------------------------*/
284/*---------------------------------------------------------------------------*/
Interface de l'application.
virtual IConfigurationMng * configurationMng() const =0
Gestionnaire des configurations d'exécution.
virtual IConfiguration * createConfiguration()=0
Créé une nouvelle configuration.
Interface d'une configuration.
Interface d'une boucle en temps.
Definition ITimeLoop.h:41
virtual void build()=0
Construit la boucle en temps.
void clone(const Collection< T > &base)
Clone la collection base.
Definition List.h:280
String m_description
Description.
Definition TimeLoop.cc:70
String m_title
Titre.
Definition TimeLoop.cc:69
StringList m_required_modules_name
Vrai si boucle en temps au vieux format.
Definition TimeLoop.cc:72
IApplication * m_application
Application.
Definition TimeLoop.cc:67
String m_name
Nom informatique.
Definition TimeLoop.cc:68
StringList m_user_classes
Liste des classes utilisateurs.
Definition TimeLoop.cc:74
virtual void setEntryPoints(const String &where, const TimeLoopEntryPointInfoCollection &calls)
Positionne la liste des noms des points d'entrée pour le point d'appel where.
Definition TimeLoop.cc:165
virtual String title() const
Titre de la boucle en temps.
Definition TimeLoop.cc:198
virtual String description() const
Description de la boucle en temps.
Definition TimeLoop.cc:222
virtual void setDescription(const String &description)
Positionne la description de la boucle en temps.
Definition TimeLoop.cc:228
virtual void setTitle(const String &title)
Positionne le titre de la boucle en temps.
Definition TimeLoop.cc:204
virtual StringCollection userClasses() const
Liste des classes utilisateurs associées à la boucle en temps.
Definition TimeLoop.cc:246
virtual TimeLoopEntryPointInfoCollection entryPoints(const String &where) const
Liste des noms des points d'entrée pour le point d'appel where.
Definition TimeLoop.cc:152
virtual void setSingletonServices(const TimeLoopSingletonServiceInfoCollection &c)
Positionne la liste des services singletons.
Definition TimeLoop.cc:264
virtual void setOptionalModulesName(const StringCollection &names)
Positionne la liste des des modules facultatifs.
Definition TimeLoop.cc:143
virtual String name() const
Nom de la boucle en temps.
Definition TimeLoop.cc:192
virtual void setRequiredModulesName(const StringCollection &names)
Positionne la liste des des modules obligatoires.
Definition TimeLoop.cc:134
virtual IConfiguration * configuration()
Options de configuration.
Definition TimeLoop.cc:273
virtual StringCollection optionalModulesName() const
Liste des noms des modules facultatifs.
Definition TimeLoop.cc:240
virtual void build()
Construit la boucle en temps.
Definition TimeLoop.cc:125
virtual void setUserClasses(const StringCollection &user_classes)
Retourne la liste des classes associées à la boucle en temps.
Definition TimeLoop.cc:177
virtual TimeLoopSingletonServiceInfoCollection singletonServices() const
Liste services singletons.
Definition TimeLoop.cc:255
virtual IApplication * application() const
Application.
Definition TimeLoop.cc:186
virtual StringCollection requiredModulesName() const
Liste des noms des modules obligatoires.
Definition TimeLoop.cc:234
Chaîne de caractères unicode.