Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
CheckpointService.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/* CheckpointService.h (C) 2000-2025 */
9/* */
10/* Protection/recovery service. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_CHECKPOINTSERVICE_H
13#define ARCANE_CORE_CHECKPOINTSERVICE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18#include "arcane/utils/Array.h"
19
20#include "arcane/core/BasicService.h"
21#include "arcane/core/ICheckpointReader.h"
22#include "arcane/core/ICheckpointWriter.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33class ISubDomain;
34class VersionInfo;
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40/*!
41 * \internal
42 * \brief Protection/recovery service.
43 */
44class ARCANE_CORE_EXPORT CheckpointService
45: public BasicService
46, public ICheckpointWriter
47, public ICheckpointReader
48{
49 public:
50
51 class Impl;
52
53 public:
54
55 explicit CheckpointService(const ServiceBuildInfo& sbi);
56
57 public:
58
59 void build() override {}
60
61 public:
62
63 void setFileName(const String& file_name) override { m_file_name = file_name; }
64 String fileName() const override { return m_file_name; }
65 void setCheckpointTimes(RealConstArrayView times) override;
66 void setCurrentTimeAndIndex(Real current_time, Integer current_index) override;
67
68 RealConstArrayView checkpointTimes() const override { return m_checkpoint_times; }
69 //! Metadata for the reader associated with this writer
70 String readerMetaData() const override { return m_reader_meta_data; }
71 void setReaderMetaData(const String& s) override { m_reader_meta_data = s; }
72 void setBaseDirectoryName(const String& dirname) override { m_base_directory_name = dirname; }
73 String baseDirectoryName() const override { return m_base_directory_name; }
74
75 Integer currentIndex() const { return m_current_index; }
76 Real currentTime() const { return m_current_time; }
77
78 private:
79
80 String m_file_name;
81 UniqueArray<Real> m_checkpoint_times;
82 Real m_current_time = -1.0;
83 Integer m_current_index = -1;
84 String m_reader_meta_data;
85 String m_base_directory_name;
86};
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
90
91} // namespace Arcane
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96#endif
String readerMetaData() const override
Metadata for the reader associated with this writer.
void setBaseDirectoryName(const String &dirname) override
Sets the name of the checkpoint base directory.
String baseDirectoryName() const override
Name of the checkpoint base directory.
void setReaderMetaData(const String &s) override
Metadata associated with this reader.
void setFileName(const String &file_name) override
Sets the name of the checkpoint file.
RealConstArrayView checkpointTimes() const override
Checkpoint times.
String fileName() const override
Name of the checkpoint file.
void build() override
Build-level construction of the service.
Interface for the protection/recovery reading service.
Interface of the checkpoint/recovery write service.
Interface of the subdomain manager.
Definition ISubDomain.h:75
Structure containing the information to create a service.
Information about a version.
Definition VersionInfo.h:47
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
double Real
Type representing a real number.
ConstArrayView< Real > RealConstArrayView
C equivalent of a 1D array of reals.
Definition UtilsTypes.h:488