https://mooseframework.inl.gov
stochastic_tools
src
actions
StochasticResultsAction.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
3
//*
4
//* All rights reserved, see COPYRIGHT for full restrictions
5
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6
//*
7
//* Licensed under LGPL 2.1, please see LICENSE for details
8
//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10
#include "
StochasticResultsAction.h
"
11
#include "
ActionWarehouse.h
"
12
#include "
ActionFactory.h
"
13
#include "
Transfer.h
"
14
#include "
SetupMeshAction.h
"
15
#include "
SamplerPostprocessorTransfer.h
"
16
#include "
StochasticResults.h
"
17
18
registerMooseAction
(
"StochasticToolsApp"
,
19
StochasticResultsAction
,
20
"declare_stochastic_results_vectors"
);
21
22
InputParameters
23
StochasticResultsAction::validParams
()
24
{
25
InputParameters
params =
Action::validParams
();
26
params.
addClassDescription
(
"Action for performing initialization of StochasticResults vectors "
27
"based on SamplerPostprocessorTransfer."
);
28
return
params;
29
}
30
31
StochasticResultsAction::StochasticResultsAction
(
const
InputParameters
& params) :
Action
(params) {}
32
33
void
34
StochasticResultsAction::act
()
35
{
36
if
(
_current_task
==
"declare_stochastic_results_vectors"
)
37
{
38
for
(std::shared_ptr<Transfer> & transfer_ptr :
39
_problem
->getTransfers(Transfer::DIRECTION::FROM_MULTIAPP))
40
{
41
auto
ptr = std::dynamic_pointer_cast<
SamplerPostprocessorTransfer
>(transfer_ptr);
42
if
(ptr !=
nullptr
)
43
{
44
const
auto
& result_name =
45
ptr->
getParam
<VectorPostprocessorName>(
"to_vector_postprocessor"
);
46
const
std::vector<VectorPostprocessorName> & vpp_names = ptr->vectorNames();
47
48
// Get the StochasticResults storage object, get it by base class to allow for better
49
// type check error message
50
auto
& uo =
_problem
->getUserObject<
UserObject
>(result_name);
51
auto
* results =
dynamic_cast<
StochasticResults
*
>
(&uo);
52
if
(!results)
53
mooseError
(
"The object prescribed by the 'to_vector_postprocessor' parameter in "
,
54
ptr->name(),
55
" must be a 'StochasticResults' object."
);
56
for
(
const
auto
& vpp_name : vpp_names)
57
results->initVector(vpp_name);
58
}
59
}
60
}
61
}
SamplerPostprocessorTransfer
Transfer Postprocessor from sub-applications to a VectorPostprocessor on the master application...
Definition:
SamplerPostprocessorTransfer.h:25
StochasticResultsAction::act
virtual void act() override
Definition:
StochasticResultsAction.C:34
StochasticResultsAction::validParams
static InputParameters validParams()
Definition:
StochasticResultsAction.C:23
Action
ActionWarehouse.h
StochasticResultsAction.h
InputParameters
Action::validParams
static InputParameters validParams()
StochasticResults.h
StochasticResults
A tool for output Sampler data.
Definition:
StochasticResults.h:30
registerMooseAction
registerMooseAction("StochasticToolsApp", StochasticResultsAction, "declare_stochastic_results_vectors")
MultiAppTransfer::getParam
const T & getParam(const std::string &name) const
Action::_current_task
const std::string & _current_task
Transfer.h
StochasticResultsAction::StochasticResultsAction
StochasticResultsAction(const InputParameters ¶ms)
Definition:
StochasticResultsAction.C:31
Action::mooseError
void mooseError(Args &&... args) const
ActionFactory.h
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
Action::_problem
std::shared_ptr< FEProblemBase > & _problem
StochasticResultsAction
This action is a crutch that gets around a construction and initialSetup execution order of operation...
Definition:
StochasticResultsAction.h:88
SamplerPostprocessorTransfer.h
UserObject
SetupMeshAction.h
Generated on Fri Jul 18 2025 13:43:50 for https://mooseframework.inl.gov by
1.8.14