www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Resurrector Class Reference

Class for doing restart. More...

#include <Resurrector.h>

Inheritance diagram for Resurrector:
[legend]

Public Member Functions

 Resurrector (FEProblemBase &fe_problem)
 
virtual ~Resurrector ()=default
 
void setRestartFile (const std::string &file_base)
 Set the file base name from which we will restart. More...
 
void setRestartSuffix (const std::string &file_ext)
 Set the file extension from which we will restart libMesh equation systems. More...
 
void restartFromFile ()
 Perform a restart from a file. More...
 
void restartRestartableData ()
 

Protected Member Functions

PerfID registerTimedSection (const std::string &section_name, const unsigned int level)
 Call to register a named section for timing. More...
 

Protected Attributes

FEProblemBase_fe_problem
 Reference to a FEProblemBase being restarted. More...
 
std::string _restart_file_base
 name of the file that we restart from More...
 
std::string _restart_file_suffix
 name of the file extension that we restart from More...
 
RestartableDataIO _restartable
 Restartable Data. More...
 
PerfID _restart_from_file_timer
 Timers. More...
 
PerfID _restart_restartable_data_timer
 
const InputParameters_pg_params
 Params. More...
 
PerfGraph_perf_graph
 The performance graph to add to. More...
 
std::string _prefix
 A prefix to use for all sections. More...
 

Static Protected Attributes

static const std::string MAT_PROP_EXT
 
static const std::string RESTARTABLE_DATA_EXT
 

Detailed Description

Class for doing restart.

It takes care of writing and reading the restart files.

Definition at line 28 of file Resurrector.h.

Constructor & Destructor Documentation

◆ Resurrector()

Resurrector::Resurrector ( FEProblemBase fe_problem)

Definition at line 23 of file Resurrector.C.

24  : PerfGraphInterface(fe_problem.getMooseApp().perfGraph(), "Resurrector"),
25  _fe_problem(fe_problem),
26  _restart_file_suffix("xdr"),
28  _restart_from_file_timer(registerTimedSection("restartFromFile", 3)),
29  _restart_restartable_data_timer(registerTimedSection("restartRestartableData", 3))
30 {
31 }
PerfID registerTimedSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
PerfID _restart_from_file_timer
Timers.
Definition: Resurrector.h:68
std::string _restart_file_suffix
name of the file extension that we restart from
Definition: Resurrector.h:62
FEProblemBase & _fe_problem
Reference to a FEProblemBase being restarted.
Definition: Resurrector.h:56
MooseApp & getMooseApp() const
Get the MooseApp this object is associated with.
Definition: MooseObject.h:86
RestartableDataIO _restartable
Restartable Data.
Definition: Resurrector.h:65
PerfGraphInterface(const MooseObject *moose_object)
For objects that are MooseObjects with a default prefix of type()
PerfID _restart_restartable_data_timer
Definition: Resurrector.h:69
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:97

◆ ~Resurrector()

virtual Resurrector::~Resurrector ( )
virtualdefault

Member Function Documentation

◆ registerTimedSection()

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
)
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 50 of file PerfGraphInterface.C.

51 {
52  if (_prefix != "")
53  return _perf_graph.registerSection(_prefix + "::" + section_name, level);
54  else
55  return _perf_graph.registerSection(section_name, level);
56 }
PerfGraph & _perf_graph
The performance graph to add to.
std::string _prefix
A prefix to use for all sections.
PerfID registerSection(const std::string &section_name, unsigned int level)
Registers a named section of code.
Definition: PerfGraph.C:41

◆ restartFromFile()

void Resurrector::restartFromFile ( )

Perform a restart from a file.

Definition at line 46 of file Resurrector.C.

47 {
48  TIME_SECTION(_restart_from_file_timer);
49 
50  std::string file_name(_restart_file_base + '.' + _restart_file_suffix);
53  unsigned int read_flags = EquationSystems::READ_DATA;
55  read_flags |= EquationSystems::READ_ADDITIONAL_DATA;
56 
57  // Set libHilbert renumbering flag to false. We don't support
58  // N-to-M restarts regardless, and if we're *never* going to do
59  // N-to-M restarts then libHilbert is just unnecessary computation
60  // and communication.
61  const bool renumber = false;
62 
63  // DECODE or READ based on suffix.
64  // MOOSE doesn't currently use partition-agnostic renumbering, since
65  // it can break restarts when multiple nodes are at the same point
66  _fe_problem.es().read(file_name, read_flags, renumber);
67 
69 }
PerfID _restart_from_file_timer
Timers.
Definition: Resurrector.h:68
NonlinearSystemBase & getNonlinearSystemBase()
std::string _restart_file_suffix
name of the file extension that we restart from
Definition: Resurrector.h:62
virtual EquationSystems & es() override
virtual void update()
Update the system (doing libMesh magic)
Definition: SystemBase.C:939
bool checkFileReadable(const std::string &filename, bool check_line_endings=false, bool throw_on_unreadable=true)
Checks to see if a file is readable (exists and permissions)
Definition: MooseUtils.C:145
void readRestartableDataHeader(std::string base_file_name)
Read restartable data header to verify that we are restarting on the correct number of processors and...
FEProblemBase & _fe_problem
Reference to a FEProblemBase being restarted.
Definition: Resurrector.h:56
static const std::string RESTARTABLE_DATA_EXT
Definition: Resurrector.h:72
RestartableDataIO _restartable
Restartable Data.
Definition: Resurrector.h:65
std::string _restart_file_base
name of the file that we restart from
Definition: Resurrector.h:59
bool skipAdditionalRestartData() const
Whether or not to skip loading the additional data when restarting.

◆ restartRestartableData()

void Resurrector::restartRestartableData ( )

Definition at line 72 of file Resurrector.C.

73 {
74  TIME_SECTION(_restart_restartable_data_timer);
75 
78 }
std::set< std::string > & getRecoverableData()
Return a reference to the recoverable data object.
Definition: MooseApp.h:485
FEProblemBase & _fe_problem
Reference to a FEProblemBase being restarted.
Definition: Resurrector.h:56
const RestartableDatas & getRestartableData()
Return reference to the restatable data object.
Definition: MooseApp.h:479
void readRestartableData(const RestartableDatas &restartable_datas, const std::set< std::string > &_recoverable_data)
Read the restartable data.
MooseApp & getMooseApp() const
Get the MooseApp this object is associated with.
Definition: MooseObject.h:86
RestartableDataIO _restartable
Restartable Data.
Definition: Resurrector.h:65
PerfID _restart_restartable_data_timer
Definition: Resurrector.h:69

◆ setRestartFile()

void Resurrector::setRestartFile ( const std::string &  file_base)

Set the file base name from which we will restart.

Parameters
file_baseThe file base name of a restart file

Definition at line 34 of file Resurrector.C.

35 {
36  _restart_file_base = file_base;
37 }
std::string _restart_file_base
name of the file that we restart from
Definition: Resurrector.h:59

◆ setRestartSuffix()

void Resurrector::setRestartSuffix ( const std::string &  file_ext)

Set the file extension from which we will restart libMesh equation systems.

The default suffix is "xdr".

Parameters
file_extThe file extension of a restart file

Definition at line 40 of file Resurrector.C.

41 {
42  _restart_file_suffix = file_ext;
43 }
std::string _restart_file_suffix
name of the file extension that we restart from
Definition: Resurrector.h:62

Member Data Documentation

◆ _fe_problem

FEProblemBase& Resurrector::_fe_problem
protected

Reference to a FEProblemBase being restarted.

Definition at line 56 of file Resurrector.h.

Referenced by restartFromFile(), and restartRestartableData().

◆ _perf_graph

PerfGraph& PerfGraphInterface::_perf_graph
protectedinherited

The performance graph to add to.

Definition at line 66 of file PerfGraphInterface.h.

Referenced by PerfGraphData::getValue(), and PerfGraphInterface::registerTimedSection().

◆ _pg_params

const InputParameters* PerfGraphInterface::_pg_params
protectedinherited

Params.

Definition at line 63 of file PerfGraphInterface.h.

◆ _prefix

std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 69 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::registerTimedSection().

◆ _restart_file_base

std::string Resurrector::_restart_file_base
protected

name of the file that we restart from

Definition at line 59 of file Resurrector.h.

Referenced by restartFromFile(), and setRestartFile().

◆ _restart_file_suffix

std::string Resurrector::_restart_file_suffix
protected

name of the file extension that we restart from

Definition at line 62 of file Resurrector.h.

Referenced by restartFromFile(), and setRestartSuffix().

◆ _restart_from_file_timer

PerfID Resurrector::_restart_from_file_timer
protected

Timers.

Definition at line 68 of file Resurrector.h.

Referenced by restartFromFile().

◆ _restart_restartable_data_timer

PerfID Resurrector::_restart_restartable_data_timer
protected

Definition at line 69 of file Resurrector.h.

Referenced by restartRestartableData().

◆ _restartable

RestartableDataIO Resurrector::_restartable
protected

Restartable Data.

Definition at line 65 of file Resurrector.h.

Referenced by restartFromFile(), and restartRestartableData().

◆ MAT_PROP_EXT

const std::string Resurrector::MAT_PROP_EXT
staticprotected

Definition at line 71 of file Resurrector.h.

◆ RESTARTABLE_DATA_EXT

const std::string Resurrector::RESTARTABLE_DATA_EXT
staticprotected

Definition at line 72 of file Resurrector.h.

Referenced by restartFromFile().


The documentation for this class was generated from the following files: