14#include "arcane/impl/ArcaneSimpleExecutor.h"
16#include "arcane/utils/NotImplementedException.h"
17#include "arcane/utils/FatalErrorException.h"
18#include "arcane/utils/TraceClassConfig.h"
19#include "arcane/utils/ITraceMng.h"
20#include "arcane/utils/ApplicationInfo.h"
22#include "arcane/Parallel.h"
24#include "arcane/impl/ArcaneMain.h"
25#include "arcane/impl/MainFactory.h"
26#include "arcane/impl/internal/ArcaneMainExecInfo.h"
28#include "arcane/SubDomainBuildInfo.h"
29#include "arcane/ISession.h"
30#include "arcane/ICodeService.h"
31#include "arcane/IApplication.h"
32#include "arcane/IParallelSuperMng.h"
33#include "arcane/IParallelMng.h"
34#include "arcane/ITimeStats.h"
35#include "arcane/IIOMng.h"
42extern "C++" ARCANE_IMPL_EXPORT Ref<ICodeService>
43createArcaneCodeService(IApplication* app);
68 ~Impl()
noexcept(
false)
75 m_arcane_main->finalize();
78 delete m_main_factory;
85 bool m_has_minimal_verbosity_level =
false;
86 bool m_has_output_level =
false;
99 auto&
build_info = m_p->m_application_build_info;
113ArcaneSimpleExecutor::
114~ArcaneSimpleExecutor()
122void ArcaneSimpleExecutor::
125 if (!m_p->m_arcane_main)
126 ARCANE_FATAL(
"This instance is not initialized. Call initialize() method");
138 auto&
build_info = m_p->m_application_build_info;
140 m_p->m_has_minimal_verbosity_level = (
build_info.minimalVerbosityLevel()!=Trace::UNSPECIFIED_VERBOSITY_LEVEL);
141 m_p->m_has_output_level = (
build_info.outputLevel()!=Trace::UNSPECIFIED_VERBOSITY_LEVEL);
143 if (!m_p->m_has_minimal_verbosity_level)
145 if (!m_p->m_has_output_level)
152int ArcaneSimpleExecutor::
155 if (m_p->m_arcane_main)
160 m_p->m_main_factory = factory;
170int ArcaneSimpleExecutor::
173 if (!m_p->m_arcane_main)
177 IArcaneMain* am = m_p->m_arcane_main->arcaneMainClass();
178 bool clean_abort =
false;
179 bool is_print =
true;
186ApplicationBuildInfo& ArcaneSimpleExecutor::
187applicationBuildInfo()
189 return m_p->m_application_build_info;
195const ApplicationBuildInfo& ArcaneSimpleExecutor::
196applicationBuildInfo()
const
198 return m_p->m_application_build_info;
204ISubDomain* ArcaneSimpleExecutor::
205createSubDomain(
const String& case_file_name)
208 IApplication* app = m_p->m_arcane_main->arcaneMainClass()->
application();
210 if (!m_p->m_has_minimal_verbosity_level)
212 if (!m_p->m_has_output_level)
213 tr->setStandardOutputVerbosityLevel(Trace::DEFAULT_VERBOSITY_LEVEL);
214 IMainFactory* main_factory = app->mainFactory();
216 Ref<ICodeService> code_service = createArcaneCodeService(app);
217 ISession* session(code_service->createSession());
218 IParallelSuperMng* psm = app->parallelSuperMng();
219 Ref<IParallelMng> world_pm = psm->internalCreateWorldParallelMng(0);
221 SubDomainBuildInfo sdbi(world_pm,0);
222 UniqueArray<Byte> case_bytes;
223 bool has_case_file = !case_file_name.empty();
225 bool is_bad = app->ioMng()->collectiveRead(case_file_name,case_bytes);
227 ARCANE_FATAL(
"Can not read case file '{0}'",case_file_name);
228 sdbi.setCaseFileName(case_file_name);
229 sdbi.setCaseBytes(case_bytes);
230 tr->info() <<
"Create sub domain with case file '" << case_file_name <<
"'";
233 sdbi.setCaseFileName(String());
237 ITimeStats* time_stat = main_factory->createTimeStats(world_pm->timerMng(),tr,
"Stats");
238 time_stat->beginGatherStats();
239 m_p->m_time_stats_list.add(time_stat);
240 world_pm->setTimeStats(time_stat);
242 ISubDomain* sub_domain(session->createSubDomain(sdbi));
244 code_service->initCase(sub_domain,
false);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Informations pour construire une instance de IApplication.
Informations sur une application.
int initialize()
Création de l'instance 'IArcaneMain'.
Classe de gestion de l'exécution.
static void arcaneInitialize()
Initialise Arcane.
static void arcaneFinalize()
Termine l'utilisation Arcane.
static int callFunctorWithCatchedException(IFunctor *functor, IArcaneMain *amain, bool *clean_abort, bool is_print=true)
Appelle le fonctor functor en récupérant les éventuelles exceptions.
static ApplicationInfo & defaultApplicationInfo()
Infos par défaut de l'application.
IArcaneMain * createArcaneMain(const ApplicationInfo &app_info) override
Crée une instance de IArcaneMain.
void _setDefaultVerbosityLevel(Integer level)
Positionne le niveau des traces à level si elles ne sont pas positionnées.
Arguments de la ligne de commande.
Interface de la classe de gestion du code.
virtual IApplication * application() const =0
Application.
Interface gérant les statistiques sur les temps d'exécution.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Manufacture des classes d'Arcane.
virtual void setVerbosityLevel(Int32 level)=0
Positionne le niveau de verbosité des sorties.
Chaîne de caractères unicode.
ITraceMng * traceMng() const
Gestionnaire de trace.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.