www.mooseframework.org
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...
 
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()

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 23 of file VectorPostprocessorInterface.C.

25  : _broadcast_by_default(broadcast_by_default),
26  _vpi_moose_object(*moose_object),
28  "_fe_problem_base")),
31  : 0)
32 {
33 }
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.
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 InputParameters & parameters() const
Get the parameters of the object.
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:198

◆ ~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 AuxKernelTempl< ComputeValueType >, AuxKernelTempl< RT >, AuxKernelTempl< RealVectorValue >, AuxKernelTempl< Real >, and UserObject.

Definition at line 311 of file VectorPostprocessorInterface.h.

Referenced by getVectorPostprocessorByNameHelper(), and getVectorPostprocessorContextByNameHelper().

312  {
313  }

◆ 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 106 of file VectorPostprocessorInterface.C.

108 {
109  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
111  vector_name);
112 }
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 115 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValue().

117 {
118  return getVectorPostprocessorContextByNameHelper(name, vector_name).getScatterValue();
119 }
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 122 of file VectorPostprocessorInterface.C.

124 {
125  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
127  vector_name);
128 }
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 131 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValueOld().

133 {
134  return getVectorPostprocessorContextByNameHelper(name, vector_name).getScatterValueOld();
135 }
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 269 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorValueByName(), and getVectorPostprocessorValueOldByName().

274 {
277 
278  const ReporterMode mode = broadcast ? REPORTER_MODE_REPLICATED : REPORTER_MODE_ROOT;
280  VectorPostprocessorReporterName(name, vector_name), _vpi_moose_object, mode, t_index);
281 }
const ReporterMode REPORTER_MODE_ROOT
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:143
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:379
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:192
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:44
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 284 of file VectorPostprocessorInterface.C.

Referenced by getScatterVectorPostprocessorValueByName(), and getScatterVectorPostprocessorValueOldByName().

286 {
289 
290  // The complete name of the store Reporter value
291  const VectorPostprocessorReporterName r_name(name, vector_name);
292 
293  // Indicate the scatter value is desired, so the the VectorPostprocessorContext will do scatter
296 
297  // Retrieve the VectorPostprocessorContext which contains the scattered value to be referenced
298  const auto & context = _vpi_feproblem.getReporterData().getReporterContextBase(r_name);
299  auto vpp_context_ptr =
300  dynamic_cast<const VectorPostprocessorContext<VectorPostprocessorValue> *>(&context);
301  mooseAssert(vpp_context_ptr, "Failed to get the VectorPostprocessorContext");
302  return *vpp_context_ptr;
303 }
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:143
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:379
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:192
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:105

◆ 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 203 of file VectorPostprocessorInterface.C.

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

204 {
205  const auto & params = _vpi_moose_object.parameters();
206 
207  if (!params.isParamValid(param_name))
209  "When getting a VectorPostprocessor, failed to get a parameter with the name \"",
210  param_name,
211  "\".",
212  "\n\nKnown parameters:\n",
214 
215  if (!params.isType<VectorPostprocessorName>(param_name))
217  "Supplied parameter with name \"",
218  param_name,
219  "\" of type \"",
220  params.type(param_name),
221  "\" is not an expected type for getting a VectorPostprocessor.\n\n",
222  "The allowed type is \"VectorPostprocessorName\".");
223 
224  return params.get<VectorPostprocessorName>(param_name);
225 }
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.
const InputParameters & parameters() const
Get the parameters of the object.

◆ 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 36 of file VectorPostprocessorInterface.C.

38 {
39  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
40  return getVectorPostprocessorValueByName(getVectorPostprocessorName(param_name), vector_name);
41 }
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 66 of file VectorPostprocessorInterface.C.

69 {
70  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
72  getVectorPostprocessorName(param_name), vector_name, needs_broadcast);
73 }
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 44 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorValue().

46 {
47  return getVectorPostprocessorByNameHelper(name, vector_name, _broadcast_by_default, 0);
48 }
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 76 of file VectorPostprocessorInterface.C.

80 {
82  name, vector_name, needs_broadcast || _broadcast_by_default, 0);
83 }
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 51 of file VectorPostprocessorInterface.C.

53 {
54  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
56 }
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 86 of file VectorPostprocessorInterface.C.

89 {
90  possiblyCheckHasVectorPostprocessor(param_name, vector_name);
92  getVectorPostprocessorName(param_name), vector_name, needs_broadcast);
93 }
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 59 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorValueOld().

61 {
62  return getVectorPostprocessorByNameHelper(name, vector_name, _broadcast_by_default, 1);
63 }
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 96 of file VectorPostprocessorInterface.C.

100 {
102  name, vector_name, needs_broadcast || _broadcast_by_default, 1);
103 }
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 138 of file VectorPostprocessorInterface.C.

Referenced by possiblyCheckHasVectorPostprocessor().

140 {
142  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessor() until all VectorPostprocessors "
143  "have been constructed.");
144 
145  return hasVectorPostprocessorByName(getVectorPostprocessorName(param_name), vector_name);
146 }
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.
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 168 of file VectorPostprocessorInterface.C.

169 {
171  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessor() until all "
172  "VectorPostprocessors have been constructed.");
173 
175 }
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.
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 149 of file VectorPostprocessorInterface.C.

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

151 {
153  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessorByName() until all "
154  "VectorPostprocessors have been constructed.");
155 
157  VectorPostprocessorReporterName(name, vector_name));
158 
159  if (has_vpp)
160  mooseAssert(_vpi_feproblem.hasUserObject(name) && dynamic_cast<const VectorPostprocessor *>(
162  "Has reporter VectorPostprocessor Reporter value but not VectorPostprocessor UO");
163 
164  return has_vpp;
165 }
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
A ReporterName that represents a VectorPostprocessor.
Definition: ReporterName.h:143
const ReporterData & getReporterData() const
Provides const access the ReporterData object.
std::vector< Real > VectorPostprocessorValue
Definition: MooseTypes.h:192
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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:436
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
Get the user object by its name.
Base class for Postprocessors that produce a vector of values.
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 178 of file VectorPostprocessorInterface.C.

180 {
182  _vpi_feproblem.mooseError("Cannot call hasVectorPostprocessorByName() until all "
183  "VectorPostprocessors have been constructed.");
184 
185  return _vpi_feproblem.hasUserObject(name) &&
186  dynamic_cast<const VectorPostprocessor *>(&_vpi_feproblem.getUserObjectBase(name));
187 }
bool hasUserObject(const std::string &name) const
Check if there if a user object of given name.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
Get the user object by its name.
Base class for Postprocessors that produce a vector of values.
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 190 of file VectorPostprocessorInterface.C.

191 {
193 }
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 196 of file VectorPostprocessorInterface.C.

Referenced by isVectorPostprocessorDistributed().

198 {
200 }
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 228 of file VectorPostprocessorInterface.C.

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

230 {
231  // Can't do checking if vpps have not been added
233  return;
234 
235  if (!hasVectorPostprocessor(param_name))
236  _vpi_moose_object.paramError(param_name,
237  "A VectorPostprocessor with the name \"",
238  getVectorPostprocessorName(param_name),
239  "\" was not found.");
240  if (!hasVectorPostprocessor(param_name, vector_name))
241  _vpi_moose_object.paramError(param_name,
242  "The VectorPostprocessor \"",
243  getVectorPostprocessorName(param_name),
244  "\" does not have a vector named \"",
245  vector_name,
246  "\".");
247 }
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.
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 ...
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 250 of file VectorPostprocessorInterface.C.

Referenced by getVectorPostprocessorByNameHelper(), and getVectorPostprocessorContextByNameHelper().

252 {
253  // Can't do checking if vpps have not been added
255  return;
256 
257  if (!hasVectorPostprocessorByName(name))
259  "A VectorPostprocessor with the name \"", name, "\" was not found.");
260  if (!hasVectorPostprocessorByName(name, vector_name))
261  _vpi_moose_object.mooseError("The VectorPostprocessor \"",
262  name,
263  "\" does not have a vector named \"",
264  vector_name,
265  "\".");
266 }
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.

◆ validParams()

InputParameters VectorPostprocessorInterface::validParams ( )
static

Definition at line 18 of file VectorPostprocessorInterface.C.

Referenced by FVInterfaceKernel::validParams().

19 {
20  return emptyInputParameters();
21 }
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 306 of file VectorPostprocessorInterface.C.

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

307 {
308  return _vpi_feproblem.getMooseApp().actionWarehouse().isTaskComplete("add_vector_postprocessor");
309 }
bool isTaskComplete(const std::string &task) const
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:45
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:195
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 352 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 361 of file VectorPostprocessorInterface.h.


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