www.mooseframework.org
Checkpoint.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "FileOutput.h"
14 #include "AutoCheckpointAction.h"
15 
16 #include <deque>
17 #include <filesystem>
18 
28 enum CheckpointType : unsigned short
29 {
33 };
34 
36 
41 {
43  std::string checkpoint;
44 
46  std::vector<std::filesystem::path> restart;
47 };
48 
58 class Checkpoint : public FileOutput
59 {
60 
61  friend class AutoCheckpointAction;
62 
63 public:
65 
71 
75  virtual std::string filename() override;
76 
81  std::string directory() const;
82 
85 
86 protected:
91  virtual void output() override;
92 
94  virtual bool shouldOutput() override;
95 
96 private:
98 
101 
103  unsigned int _num_files;
104 
106  const std::string _suffix;
107 
109  std::deque<CheckpointFileNames> _file_names;
110 };
Checkpoint(const InputParameters &parameters)
Class constructor.
Definition: Checkpoint.C:61
A structure for storing the various output files associated with checkpoint output.
Definition: Checkpoint.h:40
CheckpointType
Enumerated type for determining what type of checkpoint this is.
Definition: Checkpoint.h:28
Stores the stateful material properties computed by materials.
std::string checkpoint
Filename for CheckpointIO file (the mesh)
Definition: Checkpoint.h:43
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void updateCheckpointFiles(CheckpointFileNames file_struct)
Definition: Checkpoint.C:206
const std::string _suffix
Directory suffix.
Definition: Checkpoint.h:106
virtual bool shouldOutput() override
Determines if the checkpoint should write out to a file.
Definition: Checkpoint.C:127
virtual std::string filename() override
Returns the base filename for the checkpoint files.
Definition: Checkpoint.C:110
CheckpointType _checkpoint_type
Determines if this checkpoint is an autosave, and what kind of autosave it is.
Definition: Checkpoint.h:100
virtual void output() override
Outputs a checkpoint file.
Definition: Checkpoint.C:169
Writes out three things:
Definition: Checkpoint.h:58
std::vector< std::filesystem::path > restart
Filenames for restartable data.
Definition: Checkpoint.h:46
std::deque< CheckpointFileNames > _file_names
Vector of checkpoint filename structures.
Definition: Checkpoint.h:109
const InputParameters & parameters() const
Get the parameters of the object.
An outputter with filename support.
Definition: FileOutput.h:20
std::string directory() const
Retrieve the checkpoint output directory.
Definition: Checkpoint.C:121
static InputParameters validParams()
Definition: Checkpoint.C:31
void setAutosaveFlag(CheckpointType flag)
Sets the autosave flag manually if the object has already been initialized.
Definition: Checkpoint.h:84
unsigned int _num_files
Max no. of output files to store.
Definition: Checkpoint.h:103