www.mooseframework.org
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Restartable Class Reference

A class for creating restricted objects. More...

#include <Restartable.h>

Inheritance diagram for Restartable:
[legend]

Public Member Functions

 Restartable (const InputParameters &parameters, std::string system_name, SubProblem *subproblem=NULL)
 Class constructor Populates the SubProblem and MooseMesh pointers. More...
 
 Restartable (const std::string &name, std::string system_name, SubProblem &subproblem, THREAD_ID tid=0)
 Constructor for objects that don't have "parameters". More...
 
virtual ~Restartable ()=default
 Emtpy destructor. More...
 

Protected Member Functions

template<typename T >
T & declareRestartableData (std::string data_name)
 Declare a piece of data as "restartable". More...
 
template<typename T >
T & declareRestartableData (std::string data_name, const T &init_value)
 Declare a piece of data as "restartable" and initialize it. More...
 
template<typename T >
T & declareRestartableDataWithContext (std::string data_name, void *context)
 Declare a piece of data as "restartable". More...
 
template<typename T >
T & declareRestartableDataWithContext (std::string data_name, const T &init_value, void *context)
 Declare a piece of data as "restartable" and initialize it. More...
 

Private Member Functions

template<typename T >
T & declareRestartableDataWithObjectName (std::string data_name, std::string object_name)
 Note: This is only used internally in MOOSE. More...
 
template<typename T >
T & declareRestartableDataWithObjectNameWithContext (std::string data_name, std::string object_name, void *context)
 Note: This is only used internally in MOOSE. More...
 
template<typename T >
T & declareRecoverableData (std::string data_name)
 NOTE: These are used internally in MOOSE. More...
 
template<typename T >
T & declareRecoverableData (std::string data_name, const T &init_value)
 NOTE: These are used internally in MOOSE. More...
 
void registerRestartableDataOnSubProblem (std::string name, RestartableDataValue *data, THREAD_ID tid)
 Helper function so we don't have to include SubProblem in the header. More...
 
void registerRecoverableDataOnSubProblem (std::string name)
 Helper function so we don't have to include SubProblem in the header. More...
 

Private Attributes

std::string _restartable_name
 The name of the object. More...
 
const InputParameters_restartable_params
 The object's parameters. More...
 
std::string _restartable_system_name
 The system name this object is in. More...
 
THREAD_ID _restartable_tid
 The thread ID for this object. More...
 
SubProblem_restartable_subproblem
 Pointer to the SubProblem class. More...
 

Friends

class PostprocessorData
 For access to registerRestartableDataOnSubProblem() More...
 
class VectorPostprocessorData
 
class NearestNodeLocator
 
class ReportableData
 
class FileOutput
 
class FEProblemBase
 
class Transient
 
class TableOutput
 
class TransientMultiApp
 

Detailed Description

A class for creating restricted objects.

See also
BlockRestartable BoundaryRestartable

Definition at line 31 of file Restartable.h.

Constructor & Destructor Documentation

Restartable::Restartable ( const InputParameters parameters,
std::string  system_name,
SubProblem subproblem = NULL 
)

Class constructor Populates the SubProblem and MooseMesh pointers.

Parameters
parametersThe InputParameters for the object.
system_nameThe 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.
subproblemAn optional method for inputting the SubProblem object, this is used by FEProblemBase, othersize the SubProblem comes from the parameters

Definition at line 20 of file Restartable.C.

23  : _restartable_name(parameters.get<std::string>("_object_name")),
24  _restartable_params(&parameters),
25  _restartable_system_name(system_name),
26  _restartable_tid(parameters.isParamValid("_tid") ? parameters.get<THREAD_ID>("_tid") : 0)
27 {
28  _restartable_subproblem = parameters.isParamValid("_subproblem")
29  ? parameters.get<SubProblem *>("_subproblem")
30  : (parameters.isParamValid("_fe_problem_base")
31  ? parameters.get<FEProblemBase *>("_fe_problem_base")
32  : (parameters.isParamValid("_fe_problem")
33  ? parameters.get<FEProblem *>("_fe_problem")
34  : subproblem));
35 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
const InputParameters * _restartable_params
The object&#39;s parameters.
Definition: Restartable.h:199
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Definition: FEProblem.h:30
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
unsigned int THREAD_ID
Definition: MooseTypes.h:79
Restartable::Restartable ( const std::string &  name,
std::string  system_name,
SubProblem subproblem,
THREAD_ID  tid = 0 
)

Constructor for objects that don't have "parameters".

Parameters
nameThe name of the object
system_nameThe 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.
subproblemA reference to the subproblem for this object
tidOptional thread id (will default to zero)

Definition at line 37 of file Restartable.C.

41  : _restartable_name(name),
42  _restartable_system_name(system_name),
43  _restartable_tid(tid),
44  _restartable_subproblem(&fe_problem)
45 {
46 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
virtual Restartable::~Restartable ( )
virtualdefault

Emtpy destructor.

Member Function Documentation

template<typename T >
T & Restartable::declareRecoverableData ( std::string  data_name)
private

NOTE: These are used internally in MOOSE.

NOT FOR PUBLIC CONSUMPTION!

Declare a piece of data as "recoverable". This means that in the event of a recovery 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!

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

Definition at line 296 of file Restartable.h.

297 {
299  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
300 
301  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
302 
304 
305  return declareRestartableDataWithContext<T>(data_name, NULL);
306 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRecoverableDataOnSubProblem(std::string name)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:57
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
template<typename T >
T & Restartable::declareRecoverableData ( std::string  data_name,
const T &  init_value 
)
private

NOTE: These are used internally in MOOSE.

NOT FOR PUBLIC CONSUMPTION!

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 data will NOT be restored on Restart!

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)
init_valueThe initial value of the data

Definition at line 310 of file Restartable.h.

311 {
313  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
314 
315  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
316 
318 
319  return declareRestartableDataWithContext<T>(data_name, init_value, NULL);
320 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRecoverableDataOnSubProblem(std::string name)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:57
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
template<typename T >
T & Restartable::declareRestartableData ( std::string  data_name)
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!

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

Definition at line 224 of file Restartable.h.

225 {
226  return declareRestartableDataWithContext<T>(data_name, NULL);
227 }
template<typename T >
T & Restartable::declareRestartableData ( std::string  data_name,
const T &  init_value 
)
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!

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

Definition at line 231 of file Restartable.h.

232 {
233  return declareRestartableDataWithContext<T>(data_name, init_value, NULL);
234 }
template<typename T >
T & Restartable::declareRestartableDataWithContext ( std::string  data_name,
void *  context 
)
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!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
contextContext pointer that will be passed to the load and store functions

Definition at line 238 of file Restartable.h.

239 {
241  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
242 
243  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
244  RestartableData<T> * data_ptr = new RestartableData<T>(full_name, context);
245 
247 
248  return data_ptr->get();
249 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRestartableDataOnSubProblem(std::string name, RestartableDataValue *data, THREAD_ID tid)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:49
Concrete definition of a parameter value for a specified type.
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
template<typename T >
T & Restartable::declareRestartableDataWithContext ( std::string  data_name,
const T &  init_value,
void *  context 
)
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!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
init_valueThe initial value of the data
contextContext pointer that will be passed to the load and store functions

Definition at line 253 of file Restartable.h.

256 {
258  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
259 
260  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
261  RestartableData<T> * data_ptr = new RestartableData<T>(full_name, context);
262 
263  data_ptr->set() = init_value;
264 
266 
267  return data_ptr->get();
268 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRestartableDataOnSubProblem(std::string name, RestartableDataValue *data, THREAD_ID tid)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:49
Concrete definition of a parameter value for a specified type.
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
template<typename T >
T & Restartable::declareRestartableDataWithObjectName ( std::string  data_name,
std::string  object_name 
)
private

Note: This is only used internally in MOOSE.

DO NOT use this function!

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!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
object_nameA supplied name for the object that is declaring this data.

Definition at line 272 of file Restartable.h.

273 {
274  return declareRestartableDataWithObjectNameWithContext<T>(data_name, object_name, NULL);
275 }
template<typename T >
T & Restartable::declareRestartableDataWithObjectNameWithContext ( std::string  data_name,
std::string  object_name,
void *  context 
)
private

Note: This is only used internally in MOOSE.

DO NOT use this function!

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!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
object_nameA supplied name for the object that is declaring this data.
contextContext pointer that will be passed to the load and store functions

Definition at line 279 of file Restartable.h.

282 {
283  std::string old_name = _restartable_name;
284 
285  _restartable_name = object_name;
286 
287  T & value = declareRestartableDataWithContext<T>(data_name, context);
288 
289  _restartable_name = old_name;
290 
291  return value;
292 }
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void Restartable::registerRecoverableDataOnSubProblem ( std::string  name)
private

Helper function so we don't have to include SubProblem in the header.

Definition at line 57 of file Restartable.C.

Referenced by declareRecoverableData().

58 {
60 }
virtual void registerRecoverableData(std::string name)
NOTE: This is an internal function meant for MOOSE use only!
Definition: SubProblem.C:426
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
void Restartable::registerRestartableDataOnSubProblem ( std::string  name,
RestartableDataValue data,
THREAD_ID  tid 
)
private

Helper function so we don't have to include SubProblem in the header.

Definition at line 49 of file Restartable.C.

Referenced by declareRestartableDataWithContext().

52 {
54 }
virtual void registerRestartableData(std::string name, RestartableDataValue *data, THREAD_ID tid)
Register a piece of restartable data.
Definition: SubProblem.C:420
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208

Friends And Related Function Documentation

friend class FEProblemBase
friend

Definition at line 216 of file Restartable.h.

friend class FileOutput
friend

Definition at line 215 of file Restartable.h.

friend class NearestNodeLocator
friend

Definition at line 213 of file Restartable.h.

friend class PostprocessorData
friend

For access to registerRestartableDataOnSubProblem()

Definition at line 211 of file Restartable.h.

friend class ReportableData
friend

Definition at line 214 of file Restartable.h.

friend class TableOutput
friend

Definition at line 218 of file Restartable.h.

friend class Transient
friend

Definition at line 217 of file Restartable.h.

friend class TransientMultiApp
friend

Definition at line 219 of file Restartable.h.

friend class VectorPostprocessorData
friend

Definition at line 212 of file Restartable.h.

Member Data Documentation

std::string Restartable::_restartable_name
private
const InputParameters* Restartable::_restartable_params
private

The object's parameters.

Definition at line 199 of file Restartable.h.

SubProblem* Restartable::_restartable_subproblem
private
std::string Restartable::_restartable_system_name
private

The system name this object is in.

Definition at line 202 of file Restartable.h.

Referenced by declareRecoverableData(), and declareRestartableDataWithContext().

THREAD_ID Restartable::_restartable_tid
private

The thread ID for this object.

Definition at line 205 of file Restartable.h.

Referenced by declareRestartableDataWithContext().


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