Arcane
4.1.12.0
User documentation
Loading...
Searching...
No Matches
SequentialSection.h
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
//-----------------------------------------------------------------------------
3
// Copyright 2000-2026 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
/* SequentialSection.h (C) 2000-2025 */
9
/* */
10
/* Section of code to be executed sequentially. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_CORE_SEQUENTIALSECTION_H
13
#define ARCANE_CORE_SEQUENTIALSECTION_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/utils/ParallelFatalErrorException.h"
18
19
/*---------------------------------------------------------------------------*/
20
/*---------------------------------------------------------------------------*/
21
22
namespace
Arcane
23
{
24
25
/*---------------------------------------------------------------------------*/
26
/*---------------------------------------------------------------------------*/
27
28
/*!
29
* \brief Section of code to be executed sequentially.
30
*
31
* An instance of this class allows a part of the code to run
32
* as if the code were sequential. The code within the lifetime
33
* of this object is first executed on proc 0, and then, if everything is
34
* okay on the others. This allows checking it once when the code executed
35
* is the same everywhere (for example, reading the dataset) and displaying
36
* messages only once in case of an error.
37
*
38
* Since potential errors are only displayed by a single
39
* subdomain, this class should only be used when you are certain that all
40
* subdomains perform the same processing, otherwise errors will not be
41
* recognized.
42
*
43
* Furthermore, since all subdomains block until the first
44
* subdomain has finished executing the code, you must not call the
45
* parallelism manager in this section.
46
*
47
* In case of an error, an exception of type ExParallelFatalError is
48
* sent in the destructor.
49
* \code
50
* {
51
* SequentialSection ss(pm);
52
* ... // Code executed sequentially.
53
* ss.setError(true);
54
* }
55
* \endcode
56
*
57
*/
58
class
ARCANE_CORE_EXPORT SequentialSection
59
{
60
public
:
61
62
explicit
SequentialSection(
IParallelMng
*);
63
explicit
SequentialSection(
ISubDomain
*);
64
~SequentialSection() ARCANE_NOEXCEPT_FALSE;
65
66
public
:
67
68
void
setError(
bool
is_error);
69
70
private
:
71
72
IParallelMng
* m_parallel_mng =
nullptr
;
73
bool
m_has_error =
false
;
74
75
void
_init();
76
void
_sendError();
77
};
78
79
/*---------------------------------------------------------------------------*/
80
/*---------------------------------------------------------------------------*/
81
82
}
// namespace Arcane
83
84
/*---------------------------------------------------------------------------*/
85
/*---------------------------------------------------------------------------*/
86
87
#endif
Arcane::IParallelMng
Interface of the parallelism manager for a subdomain.
Definition
IParallelMng.h:53
Arcane::ISubDomain
Interface of the subdomain manager.
Definition
ISubDomain.h:75
Arcane
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition
AbstractCaseDocumentVisitor.cc:21
arcane
core
SequentialSection.h
Generated on
for Arcane by
1.16.1