14#include "arcane/utils/Iterator.h"
15#include "arcane/utils/ScopedPtr.h"
16#include "arcane/utils/ApplicationInfo.h"
17#include "arcane/utils/ITraceMng.h"
18#include "arcane/utils/List.h"
19#include "arcane/utils/OStringStream.h"
20#include "arcane/utils/FatalErrorException.h"
22#include "arcane/impl/TimeLoopReader.h"
24#include "arcane/core/IApplication.h"
25#include "arcane/core/IXmlDocumentHolder.h"
26#include "arcane/core/IIOMng.h"
27#include "arcane/core/ISubDomain.h"
28#include "arcane/core/XmlNode.h"
29#include "arcane/core/XmlNodeList.h"
30#include "arcane/core/XmlNodeIterator.h"
31#include "arcane/core/ICaseDocument.h"
32#include "arcane/core/ArcaneException.h"
33#include "arcane/core/ITimeLoopMng.h"
34#include "arcane/core/ITimeLoop.h"
35#include "arcane/core/IMainFactory.h"
36#include "arcane/core/SequentialSection.h"
37#include "arcane/core/TimeLoopEntryPointInfo.h"
38#include "arcane/core/TimeLoopSingletonServiceInfo.h"
39#include "arcane/impl/ConfigurationReader.h"
79 if (!time_loop_elem.
null())
80 value = time_loop_elem.
value();
84 value =
"ArcaneEmptyLoop";
86 m_time_loop_name = value;
87 info() <<
"Using the time loop <" << m_time_loop_name <<
">";
91 error() << ex <<
'\n';
110 if (!config_doc.
get())
112 XmlNode root_elem = config_doc->documentNode().documentElement();
127 String ustr_modules(
"modules");
131 info() <<
"CHECK GLOBAL SINGLETON SERVICES";
132 for (
const auto& i : global_singleton_elems) {
133 info() <<
"CHECK GLOBAL SINGLETON SERVICES 2 " << i.name();
135 for (
const auto& j_node : i) {
136 if (j_node.name() ==
"service") {
137 bool is_required = (j_node.attrValue(
"need") ==
"required");
138 info() <<
"GLOBAL SINGLETON SERVICE name=" << j_node.attrValue(ustr_name) <<
" is_required?=" << is_required;
144 for (
const auto& i : timeloops) {
145 optional_modules_list.
clear();
146 required_modules_list.
clear();
147 user_classes.
clear();
148 singleton_services.
clone(global_singleton_services);
150 String name = i.attrValue(ustr_name);
157 for (
const auto& j_node : timeloop_node) {
158 String elem_name = j_node.name();
159 String elem_value = j_node.value();
161 if (elem_name == ustr_modules) {
163 if (k->name() ==
"module") {
164 if (k->attrValue(
"need") ==
"required")
165 required_modules_list.add(k->attrValue(ustr_name));
167 optional_modules_list.add(k->attrValue(ustr_name));
170 else if (elem_name ==
"singleton-services") {
172 if (k->name() ==
"service") {
173 bool is_required = (k->attrValue(
"need") ==
"required");
178 else if (elem_name ==
"entry-points") {
179 entry_points.
clear();
182 if (k_node.
name() !=
"entry-point")
188 String cwhere = j_node.attrValue(
"where");
191 s() <<
"Incorrect value for the attribute \"where\" (time loop ";
192 s() << name <<
"): \"" << cwhere <<
"\".\n";
193 s() <<
"Available values are: "
206 else if (elem_name ==
"title") {
209 else if (elem_name ==
"description") {
212 else if (elem_name ==
"userclass") {
213 user_classes.add(elem_value);
215 else if (elem_name ==
"configuration") {
226 m_time_loops.add(time_loop);
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
void clear()
Removes all elements from the collection.
Configuration file readers.
void addValuesFromXmlNode(const XmlNode &element, Integer priority)
Adds values to the configuration.
Base class for an exception.
virtual XmlNode timeloopElement()=0
Returns the element containing the time loop choice.
Factory for Arcane classes.
virtual ITimeLoop * createTimeLoop(IApplication *sm, const String &name)=0
Creates a time loop named name.
Interface of the subdomain manager.
virtual ICaseDocument * caseDocument()=0
Case XML document.
virtual ITimeLoopMng * timeLoopMng()=0
Returns the time loop manager.
Interface for the time loop manager.
virtual void registerTimeLoop(ITimeLoop *time_loop)=0
Registration and selection of the time loop.
virtual void setUsedTimeLoop(const String &name)=0
Positions the time loop to be executed. Selects the time loop named name as the one to be executed....
Interface of a time loop.
virtual void setUserClasses(const StringCollection &)=0
Returns the list of classes associated with the time loop.
static const char * WRestore
called to restore variables during a rollback
virtual void setRequiredModulesName(const StringCollection &)=0
Sets the list of required modules.
static const char * WOnMeshChanged
called after a mesh change
virtual void setTitle(const String &)=0
Sets the title of the time loop.
virtual void setSingletonServices(const TimeLoopSingletonServiceInfoCollection &c)=0
Sets the list of singleton services.
static const char * WExit
called upon termination of the code.
virtual IConfiguration * configuration()=0
Configuration options.
static const char * WOnMeshRefinement
called after mesh refinement
virtual void setDescription(const String &)=0
Sets the description of the time loop.
virtual void setOptionalModulesName(const StringCollection &)=0
Sets the list of optional modules.
static const char * WBuild
called when reading the dataset
static const char * WComputeLoop
called during the calculation loop
virtual void setEntryPoints(const String &where, const TimeLoopEntryPointInfoCollection &)=0
Sets the list of names of entry points for the call point where.
static const char * WInit
called during initialization, initialization of a restart, or a new case
Exception when an internal error occurs.
Implementation of a collection of elements in vector form.
void clone(const Collection< T > &base)
Clone the collection base.
ListEnumeratorT< ITimeLoop * > Enumerator
Output stream linked to a String.
T * get() const
Returns the object referenced by the instance.
Encapsulation of an automatically destructing pointer.
Section of code to be executed sequentially.
Unicode character string.
bool null() const
Returns true if the string is null.
Info about a time loop entry point.
TimeLoopReader(IApplication *sm)
Creates an instance associated with the manager sm.
void setUsedTimeLoop(ISubDomain *sd)
Positions the used time loop in the manager sd.
void readTimeLoops()
Performs the reading of available time loops.
void registerTimeLoops(ISubDomain *sd)
Registers the list of time loops in the manager sd.
~TimeLoopReader()
Frees resources.
IApplication * m_application
Supervisor.
Info of a time loop singleton service.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
TraceMessage info() const
Flow for an information message.
TraceMessage error() const
Flow for an error message.
ITraceMng * traceMng() const
Trace manager.
List of nodes of a DOM tree.
String attrValue(const String &name, bool throw_exception=false) const
Value of attribute name.
XmlNode child(const String &name) const
Child node of this node with name name.
String value() const
Node value.
XmlNodeList children(const String &name) const
Set of child nodes of this node having the name name.
bool null() const
True if the node is null.
ConstIterT< XmlNode > const_iter
Type of a constant iterator over the entire array.
String name() const
Node name.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
List< String > StringList
Unicode string list.