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

Transfer Postprocessor from sub-applications to a VectorPostprocessor on the master application. More...

#include <SamplerPostprocessorTransfer.h>

Inheritance diagram for SamplerPostprocessorTransfer:
[legend]

Public Member Functions

 SamplerPostprocessorTransfer (const InputParameters &parameters)
 
virtual void initialSetup () override
 
void setGlobalMultiAppIndex (dof_id_type index)
 Method for keeping track of the global MultiApp index when running in batch mode. More...
 
virtual void initializeToMultiapp ()
 Methods for transferring data to sub-applications to the master application. More...
 
virtual void executeToMultiapp ()
 
virtual void finalizeToMultiapp ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void execute () override
 Traditional Transfer callback. More...
 
virtual void initializeFromMultiapp () override
 Methods used when running in batch mode (see SamplerFullSolveMultiApp) More...
 
virtual void executeFromMultiapp () override
 
virtual void finalizeFromMultiapp () override
 

Protected Attributes

StochasticResults_results
 Storage for StochasticResults object that data will be transferred to/from. More...
 
const PostprocessorName & _sub_pp_name
 Name of postprocessor on the sub-applications. More...
 
const VectorPostprocessorName & _master_vpp_name
 Name of vector-postprocessor on the master. More...
 
VectorPostprocessorValue _current_data
 Temporary storage for batch mode execution. More...
 
dof_id_type _global_index = 0
 Index for tracking the global index when using batch mode operation. More...
 
Sampler * _sampler_ptr
 Pointer to the Sampler object used by the SamplerTransientMultiApp or SamplerFullSolveMultiApp. More...
 

Detailed Description

Transfer Postprocessor from sub-applications to a VectorPostprocessor on the master application.

This object transfers the distributed data to a StochasticResults object.

Definition at line 29 of file SamplerPostprocessorTransfer.h.

Constructor & Destructor Documentation

◆ SamplerPostprocessorTransfer()

SamplerPostprocessorTransfer::SamplerPostprocessorTransfer ( const InputParameters &  parameters)

Definition at line 50 of file SamplerPostprocessorTransfer.C.

51  : StochasticToolsTransfer(parameters),
52  _sub_pp_name(isParamValid("postprocessor") ? getParam<PostprocessorName>("postprocessor")
53  : getParam<PostprocessorName>("from_postprocessor")),
54  _master_vpp_name(isParamValid("vector_postprocessor")
55  ? getParam<VectorPostprocessorName>("vector_postprocessor")
56  : getParam<VectorPostprocessorName>("to_vector_postprocessor"))
57 {
58 }

Member Function Documentation

◆ execute()

void SamplerPostprocessorTransfer::execute ( )
overrideprotectedvirtual

Traditional Transfer callback.

Definition at line 101 of file SamplerPostprocessorTransfer.C.

102 {
103  VectorPostprocessorValue current;
104  current.reserve(_sampler_ptr->getNumberOfLocalRows());
105  for (dof_id_type i = _sampler_ptr->getLocalRowBegin(); i < _sampler_ptr->getLocalRowEnd(); ++i)
106  {
107  FEProblemBase & app_problem = _multi_app->appProblemBase(i);
108  current.emplace_back(app_problem.getPostprocessorValue(_sub_pp_name));
109  }
110  _results->setCurrentLocalVectorPostprocessorValue(_sampler_ptr->name(), std::move(current));
111 }

◆ executeFromMultiapp()

void SamplerPostprocessorTransfer::executeFromMultiapp ( )
overrideprotectedvirtual

Reimplemented from StochasticToolsTransfer.

Definition at line 80 of file SamplerPostprocessorTransfer.C.

81 {
82  const dof_id_type n = _multi_app->numGlobalApps();
83  for (MooseIndex(n) i = 0; i < n; i++)
84  {
85  if (_multi_app->hasLocalApp(i))
86  {
87  FEProblemBase & app_problem = _multi_app->appProblemBase(i);
88  _current_data.emplace_back(app_problem.getPostprocessorValue(_sub_pp_name));
89  }
90  }
91 }

◆ executeToMultiapp()

void StochasticToolsTransfer::executeToMultiapp ( )
virtualinherited

Reimplemented in SamplerParameterTransfer.

Definition at line 127 of file StochasticToolsTransfer.C.

128 {
129 }

◆ finalizeFromMultiapp()

void SamplerPostprocessorTransfer::finalizeFromMultiapp ( )
overrideprotectedvirtual

Reimplemented from StochasticToolsTransfer.

Definition at line 94 of file SamplerPostprocessorTransfer.C.

95 {
97  _current_data.clear();
98 }

◆ finalizeToMultiapp()

void StochasticToolsTransfer::finalizeToMultiapp ( )
virtualinherited

Reimplemented in SamplerParameterTransfer.

Definition at line 132 of file StochasticToolsTransfer.C.

133 {
134 }

◆ initializeFromMultiapp()

void SamplerPostprocessorTransfer::initializeFromMultiapp ( )
overrideprotectedvirtual

Methods used when running in batch mode (see SamplerFullSolveMultiApp)

Reimplemented from StochasticToolsTransfer.

Definition at line 73 of file SamplerPostprocessorTransfer.C.

74 {
75  _current_data.clear();
76  _current_data.reserve(_sampler_ptr->getNumberOfLocalRows());
77 }

◆ initializeToMultiapp()

void StochasticToolsTransfer::initializeToMultiapp ( )
virtualinherited

Methods for transferring data to sub-applications to the master application.

Reimplemented in SamplerParameterTransfer.

Definition at line 122 of file StochasticToolsTransfer.C.

123 {
124 }

◆ initialSetup()

void SamplerPostprocessorTransfer::initialSetup ( )
overridevirtual

Definition at line 61 of file SamplerPostprocessorTransfer.C.

62 {
63  auto & uo = _fe_problem.getUserObjectTempl<UserObject>(_master_vpp_name);
64  _results = dynamic_cast<StochasticResults *>(&uo);
65 
66  if (!_results)
67  mooseError("The 'results' object must be a 'StochasticResults' object.");
68 
70 }

◆ setGlobalMultiAppIndex()

void StochasticToolsTransfer::setGlobalMultiAppIndex ( dof_id_type  index)
inlineinherited

Method for keeping track of the global MultiApp index when running in batch mode.

See StochasticTools<FullSolve/Transient>MultiApp

Definition at line 54 of file StochasticToolsTransfer.h.

54 { _global_index = index; }

◆ validParams()

InputParameters SamplerPostprocessorTransfer::validParams ( )
static

Definition at line 23 of file SamplerPostprocessorTransfer.C.

24 {
25  InputParameters params = StochasticToolsTransfer::validParams();
26  params.addClassDescription("Transfers data from Postprocessors on the sub-application to a "
27  "VectorPostprocessor on the master application.");
28  params.addParam<PostprocessorName>(
29  "from_postprocessor", "The name of the Postprocessors on the sub-app to transfer from.");
30  params.addParam<VectorPostprocessorName>("to_vector_postprocessor",
31  "The name of the VectorPostprocessor in "
32  "the MultiApp to transfer values "
33  "to.");
34 
35  params.addDeprecatedParam<PostprocessorName>(
36  "postprocessor",
37  "The name of the Postprocessors on the sub-app to transfer from.",
38  "Replaced by from_postprocessor");
39  params.addDeprecatedParam<VectorPostprocessorName>("vector_postprocessor",
40  "The name of the VectorPostprocessor in "
41  "the MultiApp to transfer values "
42  "to.",
43  "Replaced by to_vector_postprocessor");
44 
45  params.set<MultiMooseEnum>("direction") = "from_multiapp";
46  params.suppressParameter<MultiMooseEnum>("direction");
47  return params;
48 }

Member Data Documentation

◆ _current_data

VectorPostprocessorValue SamplerPostprocessorTransfer::_current_data
protected

Temporary storage for batch mode execution.

Definition at line 62 of file SamplerPostprocessorTransfer.h.

Referenced by executeFromMultiapp(), finalizeFromMultiapp(), and initializeFromMultiapp().

◆ _global_index

dof_id_type StochasticToolsTransfer::_global_index = 0
protectedinherited

Index for tracking the global index when using batch mode operation.

Definition at line 58 of file StochasticToolsTransfer.h.

Referenced by StochasticToolsTransfer::setGlobalMultiAppIndex().

◆ _master_vpp_name

const VectorPostprocessorName& SamplerPostprocessorTransfer::_master_vpp_name
protected

Name of vector-postprocessor on the master.

Definition at line 59 of file SamplerPostprocessorTransfer.h.

Referenced by initialSetup().

◆ _results

StochasticResults* SamplerPostprocessorTransfer::_results
protected

Storage for StochasticResults object that data will be transferred to/from.

Definition at line 53 of file SamplerPostprocessorTransfer.h.

Referenced by execute(), finalizeFromMultiapp(), and initialSetup().

◆ _sampler_ptr

Sampler* StochasticToolsTransfer::_sampler_ptr
protectedinherited

◆ _sub_pp_name

const PostprocessorName& SamplerPostprocessorTransfer::_sub_pp_name
protected

Name of postprocessor on the sub-applications.

Definition at line 56 of file SamplerPostprocessorTransfer.h.

Referenced by execute(), and executeFromMultiapp().


The documentation for this class was generated from the following files:
StochasticToolsTransfer::StochasticToolsTransfer
StochasticToolsTransfer(const InputParameters &parameters)
Definition: StochasticToolsTransfer.C:26
SamplerPostprocessorTransfer::_results
StochasticResults * _results
Storage for StochasticResults object that data will be transferred to/from.
Definition: SamplerPostprocessorTransfer.h:53
StochasticToolsTransfer::_sampler_ptr
Sampler * _sampler_ptr
Pointer to the Sampler object used by the SamplerTransientMultiApp or SamplerFullSolveMultiApp.
Definition: StochasticToolsTransfer.h:61
SamplerPostprocessorTransfer::_current_data
VectorPostprocessorValue _current_data
Temporary storage for batch mode execution.
Definition: SamplerPostprocessorTransfer.h:62
SamplerPostprocessorTransfer::_master_vpp_name
const VectorPostprocessorName & _master_vpp_name
Name of vector-postprocessor on the master.
Definition: SamplerPostprocessorTransfer.h:59
SamplerPostprocessorTransfer::_sub_pp_name
const PostprocessorName & _sub_pp_name
Name of postprocessor on the sub-applications.
Definition: SamplerPostprocessorTransfer.h:56
StochasticToolsTransfer::validParams
static InputParameters validParams()
Definition: StochasticToolsTransfer.C:18
StochasticResults::setCurrentLocalVectorPostprocessorValue
void setCurrentLocalVectorPostprocessorValue(const std::string &vector_name, const VectorPostprocessorValue &&current)
Definition: StochasticResults.C:127
StochasticResults::init
void init(Sampler &_sampler)
DEPRECATED Initialize storage based on the Sampler returned by the SamplerTransientMultiApp or Sample...
Definition: StochasticResults.C:141
StochasticToolsTransfer::_global_index
dof_id_type _global_index
Index for tracking the global index when using batch mode operation.
Definition: StochasticToolsTransfer.h:58