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

#include <PostprocessorData.h>

Inheritance diagram for PostprocessorData:
[legend]

Public Member Functions

 PostprocessorData (FEProblemBase &fe_problem)
 Class constructor. More...
 
void init (const std::string &name)
 Initialization method, sets the current and old value to 0.0 for this postprocessor. More...
 
bool hasPostprocessor (const std::string &name)
 Returns a true value if the Postprocessor exists. More...
 
PostprocessorValuegetPostprocessorValue (const PostprocessorName &name)
 Return the value for the Postprocessor. More...
 
PostprocessorValuegetPostprocessorValueOld (const PostprocessorName &name)
 The the old value of an Postprocessor. More...
 
PostprocessorValuegetPostprocessorValueOlder (const PostprocessorName &name)
 The the older value of an Postprocessor. More...
 
void storeValue (const std::string &name, PostprocessorValue value)
 
const std::map< std::string, PostprocessorValue * > & values () const
 Get the map of names -> Postprocessor values. More...
 
void copyValuesBack ()
 Copy the current Postprocessor values into old (i.e. 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...
 

Protected Attributes

std::map< std::string, PostprocessorValue * > _values
 Values of the Postprocessor at the current time. More...
 
std::map< std::string, PostprocessorValue * > _values_old
 Values of the Postprocessors at the time t-1. More...
 
std::map< std::string, PostprocessorValue * > _values_older
 Values of the Postprocessors at the time t-2. More...
 

Detailed Description

Definition at line 26 of file PostprocessorData.h.

Constructor & Destructor Documentation

PostprocessorData::PostprocessorData ( FEProblemBase fe_problem)

Class constructor.

Definition at line 18 of file PostprocessorData.C.

19  : Restartable("values", "PostprocessorData", fe_problem, 0)
20 {
21 }
Restartable(const InputParameters &parameters, std::string system_name, SubProblem *subproblem=NULL)
Class constructor Populates the SubProblem and MooseMesh pointers.
Definition: Restartable.C:20

Member Function Documentation

void PostprocessorData::copyValuesBack ( )

Copy the current Postprocessor values into old (i.e.

shift it "back in time")

Definition at line 77 of file PostprocessorData.C.

Referenced by FEProblemBase::advanceState(), and values().

78 {
79  for (const auto & it : _values)
80  {
82  getPostprocessorValueOld(it.first) = getPostprocessorValue(it.first);
83  }
84 }
std::map< std::string, PostprocessorValue * > _values
Values of the Postprocessor at the current time.
PostprocessorValue & getPostprocessorValueOld(const PostprocessorName &name)
The the old value of an Postprocessor.
PostprocessorValue & getPostprocessorValueOlder(const PostprocessorName &name)
The the older value of an Postprocessor.
PostprocessorValue & getPostprocessorValue(const PostprocessorName &name)
Return the value for the Postprocessor.
template<typename T >
T & Restartable::declareRestartableData ( std::string  data_name)
protectedinherited

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 
)
protectedinherited

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 
)
protectedinherited

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 
)
protectedinherited

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
PostprocessorValue & PostprocessorData::getPostprocessorValue ( const PostprocessorName &  name)

Return the value for the Postprocessor.

Definition at line 30 of file PostprocessorData.C.

Referenced by copyValuesBack(), FEProblemBase::getPostprocessorValue(), init(), and storeValue().

31 {
32  PostprocessorValue *& pp_val = _values[name];
33 
34  if (pp_val == NULL)
35  pp_val = &declareRestartableDataWithObjectName<PostprocessorValue>(name, "values");
36 
37  return *pp_val;
38 }
std::map< std::string, PostprocessorValue * > _values
Values of the Postprocessor at the current time.
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
PostprocessorValue & PostprocessorData::getPostprocessorValueOld ( const PostprocessorName &  name)

The the old value of an Postprocessor.

Parameters
nameThe name of the Postprocessor
Returns
The reference to the old value

Definition at line 41 of file PostprocessorData.C.

Referenced by copyValuesBack(), FEProblemBase::getPostprocessorValueOld(), and init().

42 {
43  PostprocessorValue *& pp_val = _values_old[name];
44 
45  if (pp_val == NULL)
46  pp_val = &declareRestartableDataWithObjectName<PostprocessorValue>(name, "values_old");
47 
48  return *pp_val;
49 }
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
std::map< std::string, PostprocessorValue * > _values_old
Values of the Postprocessors at the time t-1.
PostprocessorValue & PostprocessorData::getPostprocessorValueOlder ( const PostprocessorName &  name)

The the older value of an Postprocessor.

Parameters
nameThe name of the Postprocessor
Returns
The reference to the older value

Definition at line 52 of file PostprocessorData.C.

Referenced by copyValuesBack(), FEProblemBase::getPostprocessorValueOlder(), and init().

53 {
54  PostprocessorValue *& pp_val = _values_older[name];
55 
56  if (pp_val == NULL)
57  pp_val = &declareRestartableDataWithObjectName<PostprocessorValue>(name, "values_older");
58 
59  return *pp_val;
60 }
std::map< std::string, PostprocessorValue * > _values_older
Values of the Postprocessors at the time t-2.
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
bool PostprocessorData::hasPostprocessor ( const std::string &  name)

Returns a true value if the Postprocessor exists.

Definition at line 24 of file PostprocessorData.C.

Referenced by FEProblemBase::hasPostprocessor().

25 {
26  return (_values.find(name) != _values.end());
27 }
std::map< std::string, PostprocessorValue * > _values
Values of the Postprocessor at the current time.
void PostprocessorData::init ( const std::string &  name)

Initialization method, sets the current and old value to 0.0 for this postprocessor.

Definition at line 63 of file PostprocessorData.C.

Referenced by FEProblemBase::initPostprocessorData().

64 {
65  getPostprocessorValue(name) = 0.0;
66  getPostprocessorValueOld(name) = 0.0;
67  getPostprocessorValueOlder(name) = 0.0;
68 }
PostprocessorValue & getPostprocessorValueOld(const PostprocessorName &name)
The the old value of an Postprocessor.
PostprocessorValue & getPostprocessorValueOlder(const PostprocessorName &name)
The the older value of an Postprocessor.
PostprocessorValue & getPostprocessorValue(const PostprocessorName &name)
Return the value for the Postprocessor.
void PostprocessorData::storeValue ( const std::string &  name,
PostprocessorValue  value 
)

Definition at line 71 of file PostprocessorData.C.

Referenced by FEProblemBase::computeUserObjects().

72 {
73  getPostprocessorValue(name) = value;
74 }
PostprocessorValue & getPostprocessorValue(const PostprocessorName &name)
Return the value for the Postprocessor.
const std::map<std::string, PostprocessorValue *>& PostprocessorData::values ( ) const
inline

Get the map of names -> Postprocessor values.

Exposed for error checking.

Definition at line 69 of file PostprocessorData.h.

Referenced by FEProblemBase::checkUserObjects().

69 { return _values; }
std::map< std::string, PostprocessorValue * > _values
Values of the Postprocessor at the current time.

Member Data Documentation

std::map<std::string, PostprocessorValue *> PostprocessorData::_values
protected

Values of the Postprocessor at the current time.

Definition at line 78 of file PostprocessorData.h.

Referenced by copyValuesBack(), getPostprocessorValue(), hasPostprocessor(), and values().

std::map<std::string, PostprocessorValue *> PostprocessorData::_values_old
protected

Values of the Postprocessors at the time t-1.

Definition at line 81 of file PostprocessorData.h.

Referenced by getPostprocessorValueOld().

std::map<std::string, PostprocessorValue *> PostprocessorData::_values_older
protected

Values of the Postprocessors at the time t-2.

Definition at line 84 of file PostprocessorData.h.

Referenced by getPostprocessorValueOlder().


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