https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
VectorPostprocessorInterface Class Reference

#include <VectorPostprocessorInterface.h>

Inheritance diagram for VectorPostprocessorInterface:
[legend]

Public Member Functions

 VectorPostprocessorInterface (const MooseObject *moose_object, bool broadcast_by_default=false)
 Constructor. More...
 
 VectorPostprocessorInterface (const VectorPostprocessorInterface &object, const Moose::Kokkos::FunctorCopy &key)
 Special constructor used for Kokkos functor copy during parallel dispatch. More...
 
virtual ~VectorPostprocessorInterface ()=default
 This class has virtual methods, so it needs a virtual dtor. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 Retrieve the value of a VectorPostprocessor. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 Retrieve the value of the VectorPostprocessor. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 Retrieve the old value of a VectorPostprocessor. More...
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 Retrieve the old value of a VectorPostprocessor. More...
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 Return the scatter value for the post processor. More...
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 Return the scatter value for the post processor. More...
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 Return the old scatter value for the post processor. More...
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 Return the old scatter value for the post processor. More...
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 Determine if the VectorPostprocessor data exists by parameter. More...
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 Determine if the VectorPostprocessor data exists by name. More...
 
bool hasVectorPostprocessor (const std::string &param_name) const
 Determine if the VectorPostprocessor exists by parameter. More...
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 Determine if the VectorPostprocessor exists by name. More...
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 Get the name of a VectorPostprocessor associated with a parameter. More...
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 Return true if the VectorPostprocessor is marked with parallel_type as DISTRIBUTED. More...
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &) const
 Helper for deriving classes to override to add dependencies when a VectorPostprocessor is requested. More...
 

Private Member Functions

const VectorPostprocessorValuegetVectorPostprocessorByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
 Helper function for extracting VPP data from ReporterData object. More...
 
const VectorPostprocessorContext< VectorPostprocessorValue > & getVectorPostprocessorContextByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name) const
 Helper for getting the VPP context that handles scatter values. More...
 
bool vectorPostprocessorsAdded () const
 
void possiblyCheckHasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 Helpers for "possibly" checking if a vpp exists. More...
 
void possiblyCheckHasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 

Private Attributes

const bool _broadcast_by_default
 Whether or not to force broadcasting by default. More...
 
const MooseObject_vpi_moose_object
 The MooseObject that uses this interface. More...
 
const FEProblemBase_vpi_feproblem
 Reference the FEProblemBase class. More...
 
const THREAD_ID _vpi_tid
 Thread ID. More...
 

Detailed Description

Definition at line 22 of file VectorPostprocessorInterface.h.

Constructor & Destructor Documentation

◆ VectorPostprocessorInterface() [1/2]

VectorPostprocessorInterface::VectorPostprocessorInterface ( const MooseObject moose_object,
bool  broadcast_by_default = false 
)

Constructor.

Parameters
broadcast_by_defaultSet to true if the system inheriting from this interface always needs the VPPs to be broadcast

Definition at line 25 of file VectorPostprocessorInterface.C.

27  : _broadcast_by_default(broadcast_by_default),
28  _vpi_moose_object(*moose_object),
30  "_fe_problem_base")),
33  : 0)
34 {
35 }
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.
unsigned int THREAD_ID
Definition: MooseTypes.h:237

◆ VectorPostprocessorInterface() [2/2]

VectorPostprocessorInterface::VectorPostprocessorInterface ( const VectorPostprocessorInterface object,
const Moose::Kokkos::FunctorCopy key 
)

Special constructor used for Kokkos functor copy during parallel dispatch.

Definition at line 38 of file VectorPostprocessorInterface.C.

43  _vpi_tid(object._vpi_tid)
44 {
45 }
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ ~VectorPostprocessorInterface()

virtual VectorPostprocessorInterface::~VectorPostprocessorInterface ( )
virtualdefault

This class has virtual methods, so it needs a virtual dtor.

Member Function Documentation

◆ addVectorPostprocessorDependencyHelper()

virtual void VectorPostprocessorInterface::addVectorPostprocessorDependencyHelper ( const VectorPostprocessorName &  ) const
inlineprotectedvirtual

Helper for deriving classes to override to add dependencies when a VectorPostprocessor is requested.

Reimplemented in UserObjectBase, and AuxKernelBase.

Definition at line 319 of file VectorPostprocessorInterface.h.

Referenced by getVectorPostprocessorByNameHelper(), and getVectorPostprocessorContextByNameHelper().

320  {
321  }

◆ getScatterVectorPostprocessorValue()

const ScatterVectorPostprocessorValue & VectorPostprocessorInterface::getScatterVectorPostprocessorValue ( const std::string &  param_name,
const std::string &  vector_name 
) const

Return the scatter value for the post processor.

This is only valid when you expec the vector to be of lenghth "num_procs" In that case - this will return a reference to a value that will be this processor's value from that vector

Parameters
param_nameThe name of the parameter holding the vpp name
vector_nameThe name of the vector
Returns
The reference to the current scatter value

Definition at line 119 of file VectorPostprocessorInterface.C.

121 {
122  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
124  vector_name);
125 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const ScatterVectorPostprocessorValue & getScatterVectorPostprocessorValueByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Return the scatter value for the post processor.

◆ getScatterVectorPostprocessorValueByName()

const ScatterVectorPostprocessorValue & VectorPostprocessorInterface::getScatterVectorPostprocessorValueByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const

Return the scatter value for the post processor.

This is only valid when you expec the vector to be of lenghth "num_procs" In that case - this will return a reference to a value that will be this processor's value from that vector

Parameters
nameThe name of the VectorPostprocessor
vector_nameThe name of the vector
Returns
The reference to the current scatter value

Definition at line 128 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValue().

130 {
131  return getVectorPostprocessorContextByNameHelper(name, vector_name).getScatterValue();
132 }
const VectorPostprocessorContext< VectorPostprocessorValue > & getVectorPostprocessorContextByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name) const
Helper for getting the VPP context that handles scatter values.

◆ getScatterVectorPostprocessorValueOld()

const ScatterVectorPostprocessorValue & VectorPostprocessorInterface::getScatterVectorPostprocessorValueOld ( const std::string &  param_name,
const std::string &  vector_name 
) const

Return the old scatter value for the post processor.

This is only valid when you expec the vector to be of lenghth "num_procs" In that case - this will return a reference to a value that will be this processor's value from that vector

Parameters
param_nameThe name of the parameter holding the vpp name
vector_nameThe name of the vector
Returns
The reference to the old scatter value

Definition at line 135 of file VectorPostprocessorInterface.C.

137 {
138  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
140  vector_name);
141 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const ScatterVectorPostprocessorValue & getScatterVectorPostprocessorValueOldByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Return the old scatter value for the post processor.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.

◆ getScatterVectorPostprocessorValueOldByName()

const ScatterVectorPostprocessorValue & VectorPostprocessorInterface::getScatterVectorPostprocessorValueOldByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const

Return the old scatter value for the post processor.

This is only valid when you expect the vector to be of length "num_procs" In that case - this will return a reference to a value that will be this processor's value from that vector

Parameters
nameThe name of the VectorPostprocessor
vector_nameThe name of the vector
Returns
The reference to the old scatter value

Definition at line 144 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValueOld().

146 {
147  return getVectorPostprocessorContextByNameHelper(name, vector_name).getScatterValueOld();
148 }
const VectorPostprocessorContext< VectorPostprocessorValue > & getVectorPostprocessorContextByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name) const
Helper for getting the VPP context that handles scatter values.

◆ getVectorPostprocessorByNameHelper()

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorByNameHelper ( const VectorPostprocessorName &  name,
const std::string &  vector_name,
bool  broadcast,
std::size_t  t_index 
) const
private

Helper function for extracting VPP data from ReporterData object.

Definition at line 282 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorValueByName(), and getVectorPostprocessorValueOldByName().

287 {
290 
291  const ReporterMode mode = broadcast ? REPORTER_MODE_REPLICATED : REPORTER_MODE_ROOT;
293  VectorPostprocessorReporterName(name, vector_name), _vpi_moose_object, mode, t_index);
294 }
const ReporterMode REPORTER_MODE_ROOT
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:152
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
Definition: ReporterData.h:388
void possiblyCheckHasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
virtual void addVectorPostprocessorDependencyHelper(const VectorPostprocessorName &) const
Helper for deriving classes to override to add dependencies when a VectorPostprocessor is requested...
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:231
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
const ReporterMode REPORTER_MODE_REPLICATED
MooseEnumItem that automatically creates the ID and doesn&#39;t allow the ID to be assigned.
Definition: ReporterMode.h:45
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ getVectorPostprocessorContextByNameHelper()

const VectorPostprocessorContext< VectorPostprocessorValue > & VectorPostprocessorInterface::getVectorPostprocessorContextByNameHelper ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const
private

Helper for getting the VPP context that handles scatter values.

Definition at line 297 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValueByName(), and getScatterVectorPostprocessorValueOldByName().

299 {
302 
303  // The complete name of the store Reporter value
304  const VectorPostprocessorReporterName r_name(name, vector_name);
305 
306  // Indicate the scatter value is desired, so the the VectorPostprocessorContext will do scatter
309 
310  // Retrieve the VectorPostprocessorContext which contains the scattered value to be referenced
311  const auto & context = _vpi_feproblem.getReporterData().getReporterContextBase(r_name);
312  auto vpp_context_ptr =
313  dynamic_cast<const VectorPostprocessorContext<VectorPostprocessorValue> *>(&context);
314  mooseAssert(vpp_context_ptr, "Failed to get the VectorPostprocessorContext");
315  return *vpp_context_ptr;
316 }
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:152
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
const T & getReporterValue(const ReporterName &reporter_name, const MooseObject &consumer, const ReporterMode &mode, const std::size_t time_index=0) const
Method for returning read only references to Reporter values.
Definition: ReporterData.h:388
void possiblyCheckHasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
const ReporterMode REPORTER_MODE_VPP_SCATTER
virtual void addVectorPostprocessorDependencyHelper(const VectorPostprocessorName &) const
Helper for deriving classes to override to add dependencies when a VectorPostprocessor is requested...
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:231
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.
const ReporterContextBase & getReporterContextBase(const ReporterName &reporter_name) const
Definition: ReporterData.C:130

◆ getVectorPostprocessorName()

const VectorPostprocessorName & VectorPostprocessorInterface::getVectorPostprocessorName ( const std::string &  param_name) const

Get the name of a VectorPostprocessor associated with a parameter.

Parameters
param_nameThe name of the VectorPostprocessor parameter
Returns
The name of the given VectorPostprocessor

Definition at line 216 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValue(), getScatterVectorPostprocessorValueOld(), getVectorPostprocessorValue(), getVectorPostprocessorValueOld(), hasVectorPostprocessor(), isVectorPostprocessorDistributed(), and possiblyCheckHasVectorPostprocessor().

217 {
218  const auto & params = _vpi_moose_object.parameters();
219 
220  if (!params.isParamValid(param_name))
222  "When getting a VectorPostprocessor, failed to get a parameter with the name \"",
223  param_name,
224  "\".",
225  "\n\nKnown parameters:\n",
227 
228  if (!params.isType<VectorPostprocessorName>(param_name))
230  "Supplied parameter with name \"",
231  param_name,
232  "\" of type \"",
233  params.type(param_name),
234  "\" is not an expected type for getting a VectorPostprocessor.\n\n",
235  "The allowed type is \"VectorPostprocessorName\".");
236 
237  return params.get<VectorPostprocessorName>(param_name);
238 }
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281

◆ getVectorPostprocessorValue() [1/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValue ( const std::string &  param_name,
const std::string &  vector_name 
) const

DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast.

Retrieve the value of a VectorPostprocessor

Parameters
param_nameThe name of the VectorPostprocessor parameter (see below)
vector_nameThe name of the particular vector you want.
Returns
A reference to the desired value

The name required by this method is the name that is hard-coded into your source code. For example, if you have a Kernel that requires a VectorPostprocessor you may have an input file with "pp = my_pp", this function requires the "pp" name as input (see .../moose_test/functions/VectorPostprocessorFunction.C)

see getVectorPostprocessorValueOld getVectorPostprocessorValueByName getVectorPostprocessorValueOldByName

Definition at line 49 of file VectorPostprocessorInterface.C.

51 {
52  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
53  return getVectorPostprocessorValueByName(getVectorPostprocessorName(param_name), vector_name);
54 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const VectorPostprocessorValue & getVectorPostprocessorValueByName(const VectorPostprocessorName &name, const std::string &vector_name) const
DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast...

◆ getVectorPostprocessorValue() [2/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValue ( const std::string &  param_name,
const std::string &  vector_name,
bool  needs_broadcast 
) const

Retrieve the value of a VectorPostprocessor.

Parameters
param_nameThe name of the VectorPostprocessor parameter (see below)
vector_nameThe name of the particular vector you want.
need_broadcastWhether or not this object requires the vector to be replicated in parallel
Returns
A reference to the desired value

The name required by this method is the name that is hard-coded into your source code. For example, if you have a Kernel that requires a VectorPostprocessor you may have an input file with "pp = my_pp", this function requires the "pp" name as input (see .../moose_test/functions/VectorPostprocessorFunction.C)

see getVectorPostprocessorValueOld getVectorPostprocessorValueByName getVectorPostprocessorValueOldByName

Definition at line 79 of file VectorPostprocessorInterface.C.

82 {
83  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
85  getVectorPostprocessorName(param_name), vector_name, needs_broadcast);
86 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const VectorPostprocessorValue & getVectorPostprocessorValueByName(const VectorPostprocessorName &name, const std::string &vector_name) const
DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast...

◆ getVectorPostprocessorValueByName() [1/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const

DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast.

Retrieve the value of the VectorPostprocessor

Parameters
nameVectorPostprocessor name (see below)
vector_nameThe name of the particular vector you want.
Returns
A reference to the desired value

The name required by this method is the name defined in the input file. For example, if you have a Kernel that requires a VectorPostprocessor you may have an input file with "pp = my_pp", this method requires the "my_pp" name as input (see .../moose_test/functions/VectorPostprocessorFunction.C)

see getVectorPostprocessorValue getVectorPostprocessorValueOldByName getVectorPostprocessorValueByName

Definition at line 57 of file VectorPostprocessorInterface.C.

Referenced by CombinedVectorPostprocessor::CombinedVectorPostprocessor(), and getVectorPostprocessorValue().

59 {
60  return getVectorPostprocessorByNameHelper(name, vector_name, _broadcast_by_default, 0);
61 }
const VectorPostprocessorValue & getVectorPostprocessorByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
Helper function for extracting VPP data from ReporterData object.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.

◆ getVectorPostprocessorValueByName() [2/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name,
bool  needs_broadcast 
) const

Retrieve the value of the VectorPostprocessor.

Parameters
nameVectorPostprocessor name (see below)
vector_nameThe name of the particular vector you want.
need_broadcastWhether or not this object requires the vector to be replicated in parallel
Returns
A reference to the desired value

The name required by this method is the name defined in the input file. For example, if you have a Kernel that requires a VectorPostprocessor you may have an input file with "pp = my_pp", this method requires the "my_pp" name as input (see .../moose_test/functions/VectorPostprocessorFunction.C)

see getVectorPostprocessorValue getVectorPostprocessorValueOldByName getVectorPostprocessorValueByName

Definition at line 89 of file VectorPostprocessorInterface.C.

93 {
95  name, vector_name, needs_broadcast || _broadcast_by_default, 0);
96 }
const VectorPostprocessorValue & getVectorPostprocessorByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
Helper function for extracting VPP data from ReporterData object.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.

◆ getVectorPostprocessorValueOld() [1/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueOld ( const std::string &  param_name,
const std::string &  vector_name 
) const

DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast.

Retrieve the old value of a VectorPostprocessor

Parameters
param_nameThe name of the VectorPostprocessor parameter
vector_nameThe name of the particular vector you want.
Returns
The value of the VectorPostprocessor

see getVectorPostprocessorValue

Definition at line 64 of file VectorPostprocessorInterface.C.

66 {
67  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
69 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const VectorPostprocessorValue & getVectorPostprocessorValueOldByName(const VectorPostprocessorName &name, const std::string &vector_name) const
DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast...

◆ getVectorPostprocessorValueOld() [2/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueOld ( const std::string &  param_name,
const std::string &  vector_name,
bool  needs_broadcast 
) const

Retrieve the old value of a VectorPostprocessor.

Parameters
param_nameThe name of the VectorPostprocessor parameter
vector_nameThe name of the particular vector you want.
need_broadcastWhether or not this object requires the vector to be replicated in parallel
Returns
The value of the VectorPostprocessor

see getVectorPostprocessorValue

Definition at line 99 of file VectorPostprocessorInterface.C.

102 {
103  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
105  getVectorPostprocessorName(param_name), vector_name, needs_broadcast);
106 }
void possiblyCheckHasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Helpers for "possibly" checking if a vpp exists.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const VectorPostprocessorValue & getVectorPostprocessorValueOldByName(const VectorPostprocessorName &name, const std::string &vector_name) const
DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast...

◆ getVectorPostprocessorValueOldByName() [1/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueOldByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const

DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast.

Retrieve the old value of a VectorPostprocessor

Parameters
nameThe name of the VectorPostprocessor
vector_nameThe name of the particular vector you want.
Returns
The value of the VectorPostprocessor

If within the validParams for the object the addVectorPostprocessorParam was called this method will retun a reference to the default value specified in the call to the addVectorPostprocessorParam function if the postVectorPostprocessor does not exist.

see getVectorPostprocessorValueByName

Definition at line 72 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorValueOld().

74 {
75  return getVectorPostprocessorByNameHelper(name, vector_name, _broadcast_by_default, 1);
76 }
const VectorPostprocessorValue & getVectorPostprocessorByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
Helper function for extracting VPP data from ReporterData object.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.

◆ getVectorPostprocessorValueOldByName() [2/2]

const VectorPostprocessorValue & VectorPostprocessorInterface::getVectorPostprocessorValueOldByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name,
bool  needs_broadcast 
) const

Retrieve the old value of a VectorPostprocessor.

Parameters
nameThe name of the VectorPostprocessor
vector_nameThe name of the particular vector you want.
need_broadcastWhether or not this object requires the vector to be replicated in parallel
Returns
The value of the VectorPostprocessor

If within the validParams for the object the addVectorPostprocessorParam was called this method will retun a reference to the default value specified in the call to the addVectorPostprocessorParam function if the postVectorPostprocessor does not exist.

see getVectorPostprocessorValueByName

Definition at line 109 of file VectorPostprocessorInterface.C.

113 {
115  name, vector_name, needs_broadcast || _broadcast_by_default, 1);
116 }
const VectorPostprocessorValue & getVectorPostprocessorByNameHelper(const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
Helper function for extracting VPP data from ReporterData object.
const bool _broadcast_by_default
Whether or not to force broadcasting by default.

◆ hasVectorPostprocessor() [1/2]

bool VectorPostprocessorInterface::hasVectorPostprocessor ( const std::string &  param_name,
const std::string &  vector_name 
) const

Determine if the VectorPostprocessor data exists by parameter.

Parameters
param_nameThe name of the VectorPostprocessor parameter
vector_nameThe vector name within the VectorPostprocessor
Returns
True if the VectorPostprocessor data exists
See also
hasVectorPostprocessorByName getVectorPostprocessorValue

Definition at line 151 of file VectorPostprocessorInterface.C.

Referenced by possiblyCheckHasVectorPostprocessor().

153 {
155  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessor() until all VectorPostprocessors "
156  "have been constructed.");
157 
158  return hasVectorPostprocessorByName(getVectorPostprocessorName(param_name), vector_name);
159 }
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ hasVectorPostprocessor() [2/2]

bool VectorPostprocessorInterface::hasVectorPostprocessor ( const std::string &  param_name) const

Determine if the VectorPostprocessor exists by parameter.

Parameters
nameThe name of the VectorPostprocessor parameter
Returns
True if the VectorPostprocessor exists

Definition at line 175 of file VectorPostprocessorInterface.C.

176 {
178  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessor() until all "
179  "VectorPostprocessors have been constructed.");
180 
182 }
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ hasVectorPostprocessorByName() [1/2]

bool VectorPostprocessorInterface::hasVectorPostprocessorByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const

Determine if the VectorPostprocessor data exists by name.

Parameters
nameThe name of the VectorPostprocessor
vector_nameThe vector name within the VectorPostprocessor
Returns
True if the VectorPostprocessor data exists
See also
hasVectorPostprocessor getVectorPostprocessorValueByName

Definition at line 162 of file VectorPostprocessorInterface.C.

Referenced by hasVectorPostprocessor(), AdvancedOutput::initShowHideLists(), CSV::output(), and possiblyCheckHasVectorPostprocessorByName().

164 {
166  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessorByName() until all "
167  "VectorPostprocessors have been constructed.");
168 
170  VectorPostprocessorReporterName(name, vector_name)) &&
172 }
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:152
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:231
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
bool hasReporterValue(const ReporterName &reporter_name) const
Return True if a Reporter value with the given type and name have been created.
Definition: ReporterData.h:445
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ hasVectorPostprocessorByName() [2/2]

bool VectorPostprocessorInterface::hasVectorPostprocessorByName ( const VectorPostprocessorName &  name) const

Determine if the VectorPostprocessor exists by name.

Parameters
nameThe name of the VectorPostprocessor
Returns
True if the VectorPostprocessor exists

Definition at line 185 of file VectorPostprocessorInterface.C.

187 {
189  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessorByName() until all "
190  "VectorPostprocessors have been constructed.");
191 
192  std::vector<VectorPostprocessor *> objs;
194  .query()
196  .condition<AttribThread>(0)
197  .condition<AttribName>(name)
198  .queryInto(objs);
199  return !objs.empty();
200 }
std::string name(const ElemQuality q)
TheWarehouse & theWarehouse() const
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ isVectorPostprocessorDistributed()

bool VectorPostprocessorInterface::isVectorPostprocessorDistributed ( const std::string &  param_name) const

Return true if the VectorPostprocessor is marked with parallel_type as DISTRIBUTED.

Definition at line 203 of file VectorPostprocessorInterface.C.

204 {
206 }
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
bool isVectorPostprocessorDistributedByName(const VectorPostprocessorName &name) const

◆ isVectorPostprocessorDistributedByName()

bool VectorPostprocessorInterface::isVectorPostprocessorDistributedByName ( const VectorPostprocessorName &  name) const

Definition at line 209 of file VectorPostprocessorInterface.C.

Referenced by isVectorPostprocessorDistributed().

211 {
213 }
const VectorPostprocessor & getVectorPostprocessorObjectByName(const std::string &object_name, const THREAD_ID tid=0) const
Return the VPP object given the name.
bool isDistributed() const
Return true if the VPP is operating in distributed mode.
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

◆ possiblyCheckHasVectorPostprocessor()

void VectorPostprocessorInterface::possiblyCheckHasVectorPostprocessor ( const std::string &  param_name,
const std::string &  vector_name 
) const
private

Helpers for "possibly" checking if a vpp exists.

This is only able to check for existance after all vpps have been added (after the task creating them has been called). If called before said task, this will do nothing, hence the "possibly". This allows us to have errors reported directly by the object requesting the vpp instead of through a system with less context.

Definition at line 241 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValue(), getScatterVectorPostprocessorValueOld(), getVectorPostprocessorValue(), and getVectorPostprocessorValueOld().

243 {
244  // Can't do checking if vpps have not been added
246  return;
247 
248  if (!hasVectorPostprocessor(param_name))
249  _vpi_moose_object.paramError(param_name,
250  "A VectorPostprocessor with the name \"",
251  getVectorPostprocessorName(param_name),
252  "\" was not found.");
253  if (!hasVectorPostprocessor(param_name, vector_name))
254  _vpi_moose_object.paramError(param_name,
255  "The VectorPostprocessor \"",
256  getVectorPostprocessorName(param_name),
257  "\" does not have a vector named \"",
258  vector_name,
259  "\".");
260 }
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:467
bool hasVectorPostprocessor(const std::string &param_name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by parameter.
const VectorPostprocessorName & getVectorPostprocessorName(const std::string &param_name) const
Get the name of a VectorPostprocessor associated with a parameter.
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.

◆ possiblyCheckHasVectorPostprocessorByName()

void VectorPostprocessorInterface::possiblyCheckHasVectorPostprocessorByName ( const VectorPostprocessorName &  name,
const std::string &  vector_name 
) const
private

Definition at line 263 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorByNameHelper(), and getVectorPostprocessorContextByNameHelper().

265 {
266  // Can't do checking if vpps have not been added
268  return;
269 
270  if (!hasVectorPostprocessorByName(name))
272  "A VectorPostprocessor with the name \"", name, "\" was not found.");
273  if (!hasVectorPostprocessorByName(name, vector_name))
274  _vpi_moose_object.mooseError("The VectorPostprocessor \"",
275  name,
276  "\" does not have a vector named \"",
277  vector_name,
278  "\".");
279 }
bool hasVectorPostprocessorByName(const VectorPostprocessorName &name, const std::string &vector_name) const
Determine if the VectorPostprocessor data exists by name.
const MooseObject & _vpi_moose_object
The MooseObject that uses this interface.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition: MooseBase.h:281

◆ validParams()

InputParameters VectorPostprocessorInterface::validParams ( )
static

Definition at line 20 of file VectorPostprocessorInterface.C.

Referenced by MFEMObject::validParams(), and FVInterfaceKernel::validParams().

21 {
22  return emptyInputParameters();
23 }
InputParameters emptyInputParameters()

◆ vectorPostprocessorsAdded()

bool VectorPostprocessorInterface::vectorPostprocessorsAdded ( ) const
private
Returns
True if all vpps have been added (the task associated with adding them is complete)

Definition at line 319 of file VectorPostprocessorInterface.C.

Referenced by hasVectorPostprocessor(), hasVectorPostprocessorByName(), possiblyCheckHasVectorPostprocessor(), and possiblyCheckHasVectorPostprocessorByName().

320 {
321  return _vpi_feproblem.getMooseApp().actionWarehouse().isTaskComplete("add_vector_postprocessor");
322 }
bool isTaskComplete(const std::string &task) const
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:87
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:215
const FEProblemBase & _vpi_feproblem
Reference the FEProblemBase class.

Member Data Documentation

◆ _broadcast_by_default

const bool VectorPostprocessorInterface::_broadcast_by_default
private

Whether or not to force broadcasting by default.

Definition at line 360 of file VectorPostprocessorInterface.h.

Referenced by getVectorPostprocessorValueByName(), and getVectorPostprocessorValueOldByName().

◆ _vpi_feproblem

const FEProblemBase& VectorPostprocessorInterface::_vpi_feproblem
private

◆ _vpi_moose_object

const MooseObject& VectorPostprocessorInterface::_vpi_moose_object
private

◆ _vpi_tid

const THREAD_ID VectorPostprocessorInterface::_vpi_tid
private

Thread ID.

Definition at line 369 of file VectorPostprocessorInterface.h.


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