A class for creating restricted objects. More...
#include <Restartable.h>
Classes | |
class | ManagedValue |
Wrapper class for restartable data that is "managed. More... | |
Public Member Functions | |
Restartable (const MooseObject *moose_object, const std::string &system_name) | |
Class constructor. More... | |
Restartable (const MooseObject *moose_object, const std::string &system_name, THREAD_ID tid) | |
Class constructor. More... | |
Restartable (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... | |
Protected Member Functions | |
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> | |
ManagedValue< T > | declareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args) |
Declares a piece of "managed" restartable data 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... | |
template<typename T , typename... Args> | |
T & | declareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args) |
Declare a piece of data as "restartable" and initialize it. More... | |
template<typename T , typename... Args> | |
T & | declareRecoverableData (const std::string &data_name, Args &&... args) |
Declare a piece of data as "recoverable" and initialize it. More... | |
template<typename T , typename... Args> | |
T & | declareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args) |
Declare a piece of data as "restartable". More... | |
template<typename T , typename... Args> | |
T & | declareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args) |
Declare a piece of data as "restartable". More... | |
std::string | restartableName (const std::string &data_name) const |
Gets the name of a piece of restartable data given a data name, adding the system name and object name prefix. More... | |
Protected Attributes | |
MooseApp & | _restartable_app |
Reference to the application. More... | |
const std::string | _restartable_system_name |
The system name this object is in. More... | |
const THREAD_ID | _restartable_tid |
The thread ID for this object. More... | |
const bool | _restartable_read_only |
Flag for toggling read only status (see ReporterData) More... | |
Private Member Functions | |
RestartableDataValue & | registerRestartableDataOnApp (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const |
Helper function for actually registering the restartable data. More... | |
void | registerRestartableNameWithFilterOnApp (const std::string &name, Moose::RESTARTABLE_FILTER filter) |
Helper function for actually registering the restartable data. More... | |
template<typename T , typename... Args> | |
RestartableData< T > & | declareRestartableDataHelper (const std::string &data_name, void *context, Args &&... args) const |
Helper function for declaring restartable data. More... | |
Private Attributes | |
const RestartableDataMapName | _metaname |
Restartable metadata name. More... | |
std::string | _restartable_name |
The name of the object. More... | |
A class for creating restricted objects.
Definition at line 28 of file Restartable.h.
Restartable::Restartable | ( | const MooseObject * | moose_object, |
const std::string & | system_name | ||
) |
Class constructor.
moose_object | The MooseObject that this interface is being implemented on. |
system_name | The name of the MOOSE system. ie "Kernel", "BCs", etc. Should roughly correspond to the section in the input file so errors are easy to understand. |
This method will forward the thread id if it exists in the moose_object parameters. Delegates to the "MooseApp &" constructor.
Definition at line 18 of file Restartable.C.
Restartable::Restartable | ( | const MooseObject * | moose_object, |
const std::string & | system_name, | ||
THREAD_ID | tid | ||
) |
Class constructor.
Similar to the other class constructor but also accepts an individual thread ID. If this method is used, no thread ID in the parameters object is used. Delegates to the "MooseApp &" constructor.
Definition at line 28 of file Restartable.C.
Restartable::Restartable | ( | 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.
A name for the storage as well as a system name must be passed in along with the thread ID explicitly.
moose_app | Reference to the application |
name | The 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_name | The name of the system where this object belongs to. |
tid | The thread ID. |
read_only | Switch to restrict the data for read-only. |
metaname | The name of the datamap where the restartable objects should be registered to. |
Definition at line 35 of file Restartable.C.
|
protected |
Declares a piece of "managed" restartable data and initialize it.
Here, "managed" restartable data means that the caller can destruct this data upon destruction of the return value of this method. Therefore, this ManagedValue<T> wrapper should survive after the final calls to dataStore() for it. That is... at the very end.
This is needed for objects whose destruction ordering is important, and enables natural c++ destruction in reverse construction order of the object that declares it.
See delcareRestartableData and declareRestartableDataWithContext for more information.
Definition at line 276 of file Restartable.h.
|
protected |
Declare a piece of data as "recoverable" 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 data will NOT be restored on Restart!
NOTE: This returns a reference! Make sure you store it in a reference!
data_name | The name of the data (usually just use the same name as the member variable) |
args | Arguments to forward to the constructor of the data |
Definition at line 351 of file Restartable.h.
|
protected |
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!
data_name | The name of the data (usually just use the same name as the member variable) |
args | Arguments to forward to the constructor of the data |
Definition at line 269 of file Restartable.h.
|
private |
Helper function for declaring restartable data.
We use this function to reduce code duplication when returning const/nonconst references to the data.
data_name | The name of the data (usually just use the same name as the member variable) |
context | Context pointer that will be passed to the load and store functions |
args | Arguments to forward to the constructor of the data |
Definition at line 303 of file Restartable.h.
|
protected |
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!
data_name | The name of the data (usually just use the same name as the member variable) |
context | Context pointer that will be passed to the load and store functions |
args | Arguments to forward to the constructor of the data |
Definition at line 294 of file Restartable.h.
|
protected |
Declare a piece of data as "restartable".
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!
data_name | The name of the data (usually just use the same name as the member variable) |
object_name | A supplied name for the object that is declaring this data. |
args | Arguments to forward to the constructor of the data |
Definition at line 323 of file Restartable.h.
|
protected |
Declare a piece of data as "restartable".
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!
data_name | The name of the data (usually just use the same name as the member variable) |
object_name | A supplied name for the object that is declaring this data. |
context | Context pointer that will be passed to the load and store functions |
args | Arguments to forward to the constructor of the data |
Definition at line 333 of file Restartable.h.
|
protected |
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!
data_name | The name of the data (usually just use the same name as the member variable) |
Definition at line 287 of file Restartable.h.
|
private |
Helper function for actually registering the restartable data.
Definition at line 51 of file Restartable.C.
Referenced by declareRestartableDataHelper().
|
private |
Helper function for actually registering the restartable data.
Definition at line 59 of file Restartable.C.
Referenced by declareRecoverableData().
|
protected |
Gets the name of a piece of restartable data given a data name, adding the system name and object name prefix.
This should only be used in this interface and in testing.
Definition at line 66 of file Restartable.C.
Referenced by declareRecoverableData(), and declareRestartableDataHelper().
|
private |
Restartable metadata name.
Definition at line 240 of file Restartable.h.
Referenced by registerRestartableDataOnApp().
|
protected |
Reference to the application.
Definition at line 227 of file Restartable.h.
Referenced by registerRestartableDataOnApp(), and registerRestartableNameWithFilterOnApp().
|
private |
The name of the object.
Definition at line 243 of file Restartable.h.
Referenced by declareRestartableDataWithObjectNameWithContext(), and restartableName().
|
protected |
Flag for toggling read only status (see ReporterData)
Definition at line 236 of file Restartable.h.
Referenced by registerRestartableDataOnApp().
|
protected |
The system name this object is in.
Definition at line 230 of file Restartable.h.
Referenced by restartableName().
|
protected |
The thread ID for this object.
Definition at line 233 of file Restartable.h.
Referenced by declareRestartableDataHelper().