Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PublicRestartable Class Reference

A class which creates public interface functions for declaring and getting restartable data. More...

#include <PublicRestartable.h>

Inheritance diagram for PublicRestartable:
[legend]

Public Member Functions

 PublicRestartable (MooseApp &moose_app, const std::string &name, const std::string &system_name, THREAD_ID tid, const bool read_only=false, const RestartableDataMapName &metaname="")
 This class constructor is used for non-Moose-based objects like interfaces. More...
 
template<typename T , typename... Args>
T & declareRestartableData (const std::string &data_name, Args &&... args)
 Declare a piece of data as "restartable" and initialize it. More...
 
template<typename T , typename... Args>
const T & getRestartableData (const std::string &data_name) const
 Declare a piece of data as "restartable" and initialize it Similar to declareRestartableData but returns a const reference to the object. More...
 

Protected Member Functions

ManagedValue< T > declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
T & declareRecoverableData (const std::string &data_name, Args &&... args)
 
T & declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
T & declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 

Protected Attributes

MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 

Detailed Description

A class which creates public interface functions for declaring and getting restartable data.

This is needed for objects which need to store Restartable as a data member instead of inheriting from it.

Definition at line 20 of file PublicRestartable.h.

Constructor & Destructor Documentation

◆ PublicRestartable()

PublicRestartable::PublicRestartable ( MooseApp moose_app,
const std::string &  name,
const std::string &  system_name,
THREAD_ID  tid,
const bool  read_only = false,
const RestartableDataMapName metaname = "" 
)
inline

This class constructor is used for non-Moose-based objects like interfaces.

A name for the storage as well as a system name must be passed in along with the thread ID explicitly.

Parameters
moose_appReference to the application
nameThe name which is used when constructing the full-names of the restartable data. It is used with the following logic: system_name/name/data_name. (e.g. UserObjects/diffusion_kernel/coefficient). In most of the cases this is the name of the moose object.
system_nameThe name of the system where this object belongs to.
tidThe thread ID.
read_onlySwitch to restrict the data for read-only.
metanameThe name of the datamap where the restartable objects should be registered to.

Definition at line 36 of file PublicRestartable.h.

42  : Restartable(moose_app, name, system_name, tid, read_only, metaname)
43  {
44  }
const std::string name
Definition: Setup.h:20
Restartable(const MooseObject *moose_object, const std::string &system_name)

Member Function Documentation

◆ declareRestartableData()

template<typename T , typename... Args>
T& PublicRestartable::declareRestartableData ( const std::string &  data_name,
Args &&...  args 
)
inline

Declare a piece of data as "restartable" and initialize it.

This means that in the event of a restart this piece of data will be restored back to its previous value.

NOTE: This returns a reference! Make sure you store it in a reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
argsArguments to forward to the constructor of the data

Definition at line 58 of file PublicRestartable.h.

Referenced by RestartableModelInterface::declareModelData().

59  {
60  return Restartable::declareRestartableData<T>(data_name, std::forward<Args>(args)...);
61  }

◆ getRestartableData()

template<typename T , typename... Args>
const T& PublicRestartable::getRestartableData ( const std::string &  data_name) const
inline

Declare a piece of data as "restartable" and initialize it Similar to declareRestartableData but returns a const reference to the object.

Forwarded arguments are not allowed in this case because we assume that the object is restarted and we won't need different constructors to initialize it.

NOTE: This returns a const reference! Make sure you store it in a const reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)

Definition at line 74 of file PublicRestartable.h.

Referenced by RestartableModelInterface::getModelData().

75  {
76  return Restartable::getRestartableData<T>(data_name);
77  }

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