Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ICheckpointMng.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/* ICheckpointMng.h (C) 2000-2025 */
9/* */
10/* Interface of the checkpoint information manager. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ICHECKPOINTMNG_H
13#define ARCANE_CORE_ICHECKPOINTMNG_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Interface of the checkpoint information manager.
30 *
31 * This manager handles checkpoint information, namely the saved times, the
32 * services used, and other information necessary for recovery. It does not
33 * directly manage the writing or reading, which are delegated to an
34 * ICheckpointReader or ICheckpointWriter.
35 *
36 * Reading a checkpoint causes the modification of all variables and meshes.
37 */
38class ARCANE_CORE_EXPORT ICheckpointMng
39{
40 public:
41
42 virtual ~ICheckpointMng() = default; //!< Frees resources.
43
44 public:
45
46 /*!
47 * \brief Reads a checkpoint.
48 *
49 * This operation is collective.
50 *
51 * \deprecated Use readDefaultCheckpoint() instead
52 */
53 ARCANE_DEPRECATED_122 virtual void readCheckpoint() = 0;
54
55 /*!
56 * \brief Reads a checkpoint.
57 *
58 * Reads a checkpoint from the \a reader.
59 */
60 virtual void readCheckpoint(ICheckpointReader* reader) = 0;
61
62 /*!
63 * \brief Reads a checkpoint.
64 *
65 * Reads a checkpoint whose reading information is in \a infos.
66 *
67 * \deprecated Instead, use the following code:
68 * \code
69 * ICheckpointMng* cm = ...;
70 * Span<const Byte> buffer;
71 * CheckpointInfo checkpoint_info = cm->readChekpointInfo(buffer);
72 * cm->readChekpoint(checkpoint_info);
73 * \endcode
74 */
75 virtual ARCANE_DEPRECATED_2018 void readCheckpoint(ByteConstArrayView infos) = 0;
76
77 /*!
78 * \brief Reads checkpoint information.
79 *
80 * Reads the information of a checkpoint contained in the \a infos buffer.
81 * \a buf_name contains the name of the buffer used in displays in case of an error.
82 */
83 virtual CheckpointInfo readCheckpointInfo(Span<const Byte> infos, const String& buf_name) = 0;
84
85 /*!
86 * \brief Reads a checkpoint.
87 *
88 * Reads a checkpoint whose information is in \a checkpoint_infos.
89 */
90 virtual void readCheckpoint(const CheckpointInfo& checkpoint_info) = 0;
91
92 /*!
93 * \brief Reads a default checkpoint
94 *
95 * This operation is collective.
96 *
97 * In the default implementation, the information for resumption is stored in
98 * a file named 'checkpoint_info.xml' located in the case's export directory
99 * (ISubDomain::exportDirectory()).
100 *
101 * \deprecated Instead, use the following code:
102 * \code
103 * ICheckpointMng* cm = ...;
104 * CheckpointInfo checkpoint_info = cm->readDefaultChekpointInfo();
105 * cm->readChekpoint(checkpoint_info);
106 * \endcode
107 */
108 virtual ARCANE_DEPRECATED_2018 void readDefaultCheckpoint() = 0;
109
110 /*!
111 * \brief Reads default checkpoint information.
112 *
113 * This operation is collective.
114 *
115 * In the default implementation, the information for resumption is stored
116 * in a file named 'checkpoint_info.xml' located in the case's export
117 * directory (ISubDomain::exportDirectory()).
118 *
119 * After reading the information, it is possible to call
120 * readCheckpoint(const CheckpointInfo& checkpoint_info) to read the checkpoint.
121 */
123
124 /*!
125 * \brief Writes a default checkpoint using the \a writer.
126 *
127 * This operation is collective.
128 *
129 * \deprecated Use writeDefaultCheckpoint() instead.
130 */
131 ARCANE_DEPRECATED_122 virtual void writeCheckpoint(ICheckpointWriter* writer) = 0;
132
133 /*!
134 * \brief Writes a checkpoint using the \a writer.
135 *
136 * This operation is collective.
137 *
138 * The information required to read it back is stored in the \a infos array
139 * passed as an argument. It is then possible to read a checkpoint back via
140 * readCheckpoint(ByteConstArrayView).
141 *
142 * The default implementation stores in infos an XML file containing, among
143 * other things, the name of the corresponding reader, the number of subdomains, ...
144 */
145 virtual void writeCheckpoint(ICheckpointWriter* writer, ByteArray& infos) = 0;
146
147 /*!
148 * \brief Writes a checkpoint using the \a writer.
149 *
150 * This operation is collective.
151 *
152 * This is a standard checkpoint that can be read back via readDefaultCheckpoint().
153 *
154 * \sa readDefaultCheckpoint
155 */
156 virtual void writeDefaultCheckpoint(ICheckpointWriter* writer) = 0;
157
158 /*!
159 * \brief Write observable.
160 *
161 * Observers registered in this observable are called before writing a checkpoint.
162 */
164
165 /*!
166 * \brief Read observable.
167 *
168 * Observers registered in this observable are called after a complete checkpoint read.
169 */
171};
172
173/*---------------------------------------------------------------------------*/
174/*---------------------------------------------------------------------------*/
175
176} // namespace Arcane
177
178/*---------------------------------------------------------------------------*/
179/*---------------------------------------------------------------------------*/
180
181#endif
Declarations of Arcane's general types.
Information about a checkpoint.
Interface of the checkpoint information manager.
virtual IObservable * writeObservable()=0
Write observable.
virtual ARCANE_DEPRECATED_2018 void readCheckpoint(ByteConstArrayView infos)=0
Reads a checkpoint.
virtual ~ICheckpointMng()=default
Frees resources.
virtual ARCANE_DEPRECATED_122 void readCheckpoint()=0
Reads a checkpoint.
virtual CheckpointInfo readCheckpointInfo(Span< const Byte > infos, const String &buf_name)=0
Reads checkpoint information.
virtual ARCANE_DEPRECATED_2018 void readDefaultCheckpoint()=0
Reads a default checkpoint.
virtual ARCANE_DEPRECATED_122 void writeCheckpoint(ICheckpointWriter *writer)=0
Writes a default checkpoint using the writer.
virtual void readCheckpoint(const CheckpointInfo &checkpoint_info)=0
Reads a checkpoint.
virtual void readCheckpoint(ICheckpointReader *reader)=0
Reads a checkpoint.
virtual CheckpointInfo readDefaultCheckpointInfo()=0
Reads default checkpoint information.
virtual IObservable * readObservable()=0
Read observable.
virtual void writeDefaultCheckpoint(ICheckpointWriter *writer)=0
Writes a checkpoint using the writer.
virtual void writeCheckpoint(ICheckpointWriter *writer, ByteArray &infos)=0
Writes a checkpoint using the writer.
Interface for the protection/recovery reading service.
Interface of the checkpoint/recovery write service.
View of an array of elements of type T.
Definition Span.h:635
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
Definition UtilsTypes.h:121
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
Definition UtilsTypes.h:476