www.mooseframework.org
PostprocessorInterface.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // Standard includes
13 #include <string>
14 
15 // MOOSE includes
16 #include "MooseTypes.h"
17 
18 // Forward Declarations
19 class FEProblemBase;
20 class InputParameters;
21 class PostprocessorName;
22 class MooseObject;
23 
24 #define usingPostprocessorInterfaceMembers \
25  using PostprocessorInterface::getPostprocessorValue; \
26  using PostprocessorInterface::getPostprocessorValueOld; \
27  using PostprocessorInterface::getPostprocessorValueOlder; \
28  using PostprocessorInterface::coupledPostprocessors
29 
35 {
36 public:
37  PostprocessorInterface(const MooseObject * moose_object);
38 
39  PostprocessorInterface(const FEProblemBase * problem);
40 
42 
44 
58  const PostprocessorValue & getPostprocessorValue(const std::string & param_name,
59  const unsigned int index = 0) const;
60  const PostprocessorValue & getPostprocessorValueOld(const std::string & param_name,
61  const unsigned int index = 0) const;
62  const PostprocessorValue & getPostprocessorValueOlder(const std::string & param_name,
63  const unsigned int index = 0) const;
64  // doco-normal-methods-end
65 
67 
69 
81  virtual const PostprocessorValue &
82  getPostprocessorValueByName(const PostprocessorName & name) const;
83  const PostprocessorValue & getPostprocessorValueOldByName(const PostprocessorName & name) const;
84  const PostprocessorValue & getPostprocessorValueOlderByName(const PostprocessorName & name) const;
86 
96  bool isDefaultPostprocessorValue(const std::string & param_name,
97  const unsigned int index = 0) const;
98 
107  bool hasPostprocessor(const std::string & param_name, const unsigned int index = 0) const;
108 
116  bool hasPostprocessorByName(const PostprocessorName & name) const;
117 
124  std::size_t coupledPostprocessors(const std::string & param_name) const;
125 
134  const PostprocessorName & getPostprocessorName(const std::string & param_name,
135  const unsigned int index = 0) const;
136 
137 protected:
141  virtual void addPostprocessorDependencyHelper(const PostprocessorName & /* name */) const {}
142 
143 private:
146 
149 
152 
154  mutable std::map<PostprocessorName, std::unique_ptr<PostprocessorValue>> _default_values;
155 
160  const PostprocessorName &
161  getPostprocessorNameInternal(const std::string & param_name,
162  const unsigned int index,
163  const bool allow_default_value = true) const;
164 
168  const PostprocessorValue & getPostprocessorValueInternal(const std::string & param_name,
170  unsigned int index,
171  std::size_t t_index) const;
172  const PostprocessorValue & getPostprocessorValueByNameInternal(const PostprocessorName & name,
173  std::size_t t_index) const;
175 
181  bool isDefaultPostprocessorValueByName(const PostprocessorName & name) const;
182 
186  PostprocessorValue getDefaultPostprocessorValueByName(const PostprocessorName & name) const;
187 
192  void checkParam(const std::string & param_name,
193  const unsigned int index = std::numeric_limits<unsigned int>::max()) const;
194 
198  bool postprocessorsAdded() const;
199 };
std::string name(const ElemQuality q)
static InputParameters validParams()
const PostprocessorValue & getPostprocessorValueOlderByName(const PostprocessorName &name) const
const FEProblemBase & _ppi_feproblem
Reference the the FEProblemBase class.
bool hasPostprocessor(const std::string &param_name, const unsigned int index=0) const
Determine if the Postprocessor data exists.
bool isDefaultPostprocessorValueByName(const PostprocessorName &name) const
const PostprocessorValue & getPostprocessorValueOlder(const std::string &param_name, const unsigned int index=0) const
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const PostprocessorValue & getPostprocessorValueOldByName(const PostprocessorName &name) const
const PostprocessorValue & getPostprocessorValue(const std::string &param_name, const unsigned int index=0) const
doco-normal-methods-begin Retrieve the value of a Postprocessor or one of it&#39;s old or older values ...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
auto max(const L &left, const R &right)
PostprocessorValue getDefaultPostprocessorValueByName(const PostprocessorName &name) const
const PostprocessorName & getPostprocessorNameInternal(const std::string &param_name, const unsigned int index, const bool allow_default_value=true) const
Internal method for getting the PostprocessorName associated with a paremeter.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:33
bool hasPostprocessorByName(const PostprocessorName &name) const
Determine if the Postprocessor data exists.
Real PostprocessorValue
various MOOSE typedefs
Definition: MooseTypes.h:191
const MooseObject & _ppi_moose_object
The MooseObject that uses this interface.
void checkParam(const std::string &param_name, const unsigned int index=std::numeric_limits< unsigned int >::max()) const
Checks the parameters relating to a Postprocessor.
const PostprocessorValue & getPostprocessorValueInternal(const std::string &param_name, unsigned int index, std::size_t t_index) const
Internal methods for getting Postprocessor values.
bool isDefaultPostprocessorValue(const std::string &param_name, const unsigned int index=0) const
Determine whether or not the Postprocessor is a default value.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
const PostprocessorValue & getPostprocessorValueByNameInternal(const PostprocessorName &name, std::size_t t_index) const
virtual void addPostprocessorDependencyHelper(const PostprocessorName &) const
Helper for deriving classes to override to add dependencies when a Postprocessor is requested...
PostprocessorInterface(const MooseObject *moose_object)
std::size_t coupledPostprocessors(const std::string &param_name) const
Returns number of Postprocessors coupled under parameter name.
const PostprocessorValue & getPostprocessorValueOld(const std::string &param_name, const unsigned int index=0) const
const InputParameters & _ppi_params
PostprocessorInterface Parameters.
std::map< PostprocessorName, std::unique_ptr< PostprocessorValue > > _default_values
Holds the default postprocessor values that are requested (key is PostprocessorName) ...
const PostprocessorName & getPostprocessorName(const std::string &param_name, const unsigned int index=0) const
Get the name of a postprocessor.
Interface class for classes which interact with Postprocessors.