Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
StandaloneSubDomain.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/* StandaloneSubDomain.cc (C) 2000-2023 */
9/* */
10/* Implémentation autonome d'un sous-domaine. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/launcher/StandaloneSubDomain.h"
15
16#include "arcane/utils/Ref.h"
17#include "arcane/utils/ITraceMng.h"
18#include "arcane/utils/FatalErrorException.h"
19
20#include "arcane/impl/ArcaneSimpleExecutor.h"
21
22#include "arcane/core/ISubDomain.h"
23
24#include "arcane/launcher/ArcaneLauncher.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane
30{
31
33{
34 public:
35
36 Impl() = default;
37 ~Impl()
38 {
39 StandaloneSubDomain::_notifyRemoveStandaloneSubDomain();
40 }
41
42 void init(const String& case_file_name)
43 {
44 int r = m_simple_exec.initialize();
45 if (r != 0)
46 ARCANE_FATAL("Error during initialization r={0}", r);
47 m_sub_domain = m_simple_exec.createSubDomain(case_file_name);
48 m_trace_mng = makeRef(m_sub_domain->traceMng());
49 }
50
51 public:
52
53 ArcaneSimpleExecutor m_simple_exec;
54 ISubDomain* m_sub_domain = nullptr;
55 Ref<ITraceMng> m_trace_mng;
56};
57
58/*---------------------------------------------------------------------------*/
59/*---------------------------------------------------------------------------*/
60
65
66/*---------------------------------------------------------------------------*/
67/*---------------------------------------------------------------------------*/
68
69void StandaloneSubDomain::
70_checkIsInitialized()
71{
72 if (m_p.get())
73 return;
74 ARCANE_FATAL("Instance of 'StandaloneSubDomain' is not initialized.\n"
75 "You have to call ArcaneLauncher::createStandaloneSubDomain()\n"
76 "to get a valid instance");
77}
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
84{
85 _checkIsInitialized();
86 return m_p->m_trace_mng.get();
87}
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
91
94{
95 _checkIsInitialized();
96 return m_p->m_sub_domain;
97}
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102void StandaloneSubDomain::
103_initUniqueInstance(const String& case_file_name)
104{
105 m_p = makeRef(new Impl());
106 m_p->init(case_file_name);
107}
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
111
112bool StandaloneSubDomain::
113_isValid()
114{
115 return m_p.get();
116}
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121void StandaloneSubDomain::
122_notifyRemoveStandaloneSubDomain()
123{
124 ArcaneLauncher::_notifyRemoveStandaloneSubDomain();
125}
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130} // End namespace Arcane
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Classe permettant d'exécuter directement du code sans passer par la boucle en temps.
virtual ITraceMng * traceMng() const =0
Gestionnaire de traces.
Interface du gestionnaire d'un sous-domaine.
Definition ISubDomain.h:74
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
ITraceMng * traceMng()
Gestionnaire de trace associé.
StandaloneSubDomain()
Constructeur non initialisé.
ISubDomain * subDomain()
Sous-domaine.
Interface du gestionnaire de traces.
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-