www.mooseframework.org
PostprocessorData.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "PostprocessorData.h"
16 #include "FEProblem.h"
17 
19  : Restartable("values", "PostprocessorData", fe_problem, 0)
20 {
21 }
22 
23 bool
24 PostprocessorData::hasPostprocessor(const std::string & name)
25 {
26  return (_values.find(name) != _values.end());
27 }
28 
30 PostprocessorData::getPostprocessorValue(const PostprocessorName & name)
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 }
39 
41 PostprocessorData::getPostprocessorValueOld(const PostprocessorName & name)
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 }
50 
52 PostprocessorData::getPostprocessorValueOlder(const PostprocessorName & name)
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 }
61 
62 void
63 PostprocessorData::init(const std::string & name)
64 {
65  getPostprocessorValue(name) = 0.0;
66  getPostprocessorValueOld(name) = 0.0;
67  getPostprocessorValueOlder(name) = 0.0;
68 }
69 
70 void
71 PostprocessorData::storeValue(const std::string & name, PostprocessorValue value)
72 {
73  getPostprocessorValue(name) = value;
74 }
75 
76 void
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.
A class for creating restricted objects.
Definition: Restartable.h:31
void storeValue(const std::string &name, PostprocessorValue value)
void init(const std::string &name)
Initialization method, sets the current and old value to 0.0 for this postprocessor.
std::map< std::string, PostprocessorValue * > _values_older
Values of the Postprocessors at the time t-2.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
PostprocessorValue & getPostprocessorValueOld(const PostprocessorName &name)
The the old value of an Postprocessor.
PostprocessorValue & getPostprocessorValueOlder(const PostprocessorName &name)
The the older value of an Postprocessor.
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:73
PostprocessorData(FEProblemBase &fe_problem)
Class constructor.
void copyValuesBack()
Copy the current Postprocessor values into old (i.e.
bool hasPostprocessor(const std::string &name)
Returns a true value if the Postprocessor exists.
PostprocessorValue & getPostprocessorValue(const PostprocessorName &name)
Return the value for the Postprocessor.
std::map< std::string, PostprocessorValue * > _values_old
Values of the Postprocessors at the time t-1.