23 "Declare and transfer reporter data from sub-application(s) to main application.");
26 "List of the reporter names (object_name/value_name) to transfer the value from.");
28 "to_reporter",
"Reporter object to reference when declaring reporter values.");
30 params.
addParam<std::string>(
"prefix",
31 "Use the supplied string as the prefix for reporter "
32 "name rather than the transfer name.");
37 "The type of the reporter on the sub-application. This parameter is not typically required, "
38 "but if some processors do not have a sub-app, for instance if the max_procs_per_app "
39 "parameter is used in the MultiApp, then this is required.");
48 _from_reporter_names(getParam<
std::vector<
ReporterName>>(
"from_reporters")),
49 _to_obj_name(getParam<
std::string>(
"to_reporter")),
50 _to_reporter_names(isParamValid(
"prefix")
51 ? getReporterNamesHelper(getParam<
std::string>(
"prefix"),
54 : getReporterNamesHelper(_name, _to_obj_name, _from_reporter_names))
59 "The multi_app parameter is no longer valid for this class, use to_multi_app");
63 "Sibling or to_multiapp transfer have not been implemented for this transfer.");
72 mooseError(
"For a direct reporter clone, all processors must be associated with a "
73 "sub-application. If you know the type of reporter being transferred, please "
74 "consider using the 'reporter_type' parameter for an indirect clone.");
78 mooseError(
"For a direct reporter clone, all processors must be associated with a "
79 "sub-application. If you know the type of reporter being transferred, please "
80 "consider using the 'reporter_type' parameter for an indirect clone.");
83 if (!
dynamic_cast<const Reporter *
>(&uo))
84 paramError(
"to_reporter",
"This object must be a Reporter object.");
87 const dof_id_type n = multi_app->numGlobalApps();
90 for (MooseIndex(n) i = 0; i < n; i++)
91 if (multi_app->hasLocalApp(i))
95 if (multi_app->hasApp())
98 for (MooseIndex(n) i = 0; i < n; i++)
99 if (multi_app->hasLocalApp(i))
104 multi_app->appProblemBase(i),
105 multi_app->problemBase(),
110 multi_app->appProblemBase(i),
111 multi_app->problemBase(),
118 const auto & types = getParam<MultiMooseEnum>(
"reporter_type");
120 paramError(
"reporter_type",
"This parameter must be the same length as 'from_reporters'");
131 if (n > 1 && multi_app->isRootProcessor())
133 resizeReporter(rn, multi_app->problemBase(), multi_app->numLocalApps());
151 for (dof_id_type i = begin; i < end; ++i)
170 TIME_SECTION(
"MultiAppCloneReporterTransfer::execute()", 5,
"Transferring reporters");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObject("MooseApp", MultiAppCloneReporterTransfer)
const ReporterMode REPORTER_MODE_DISTRIBUTED
const ReporterMode REPORTER_MODE_ROOT
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
Get the user object by its name.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Transfer for migrating reporter values between the main and sub-application(s).
virtual void executeToMultiapp()
static InputParameters validParams()
virtual void executeFromMultiapp()
MultiAppCloneReporterTransfer(const InputParameters ¶meters)
virtual void execute() override
Execute the transfer.
const std::vector< ReporterName > & _from_reporter_names
virtual void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup.
const std::vector< ReporterName > _to_reporter_names
const std::string & _to_obj_name
Base class for all MultiAppTransfer objects.
void initialSetup() override
Method called at the beginning of the simulation for checking integrity or doing one-time setup.
const std::shared_ptr< MultiApp > getToMultiApp() const
Get the MultiApp to transfer data to.
const std::shared_ptr< MultiApp > getMultiApp() const
Use this getter to obtain the MultiApp for transfers with a single direction.
static InputParameters validParams()
const std::shared_ptr< MultiApp > getFromMultiApp() const
Get the MultiApp to transfer data from.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
The Reporter system is comprised of objects that can contain any number of data values.
void transferToVectorReporter(const ReporterName &from_reporter, const ReporterName &to_reporter, const FEProblemBase &from_problem, FEProblemBase &to_problem, dof_id_type index, unsigned int time_index=0)
void transferReporter(const ReporterName &from_reporter, const ReporterName &to_reporter, const FEProblemBase &from_problem, FEProblemBase &to_problem, unsigned int time_index=0)
void resizeReporter(const ReporterName &name, FEProblemBase &problem, dof_id_type n)
void declareVectorClone(const ReporterName &from_reporter, const ReporterName &to_reporter, const FEProblemBase &from_problem, FEProblemBase &to_problem, const ReporterMode &mode)
void declareClone(const ReporterName &from_reporter, const ReporterName &to_reporter, const FEProblemBase &from_problem, FEProblemBase &to_problem, const ReporterMode &mode)
static MultiMooseEnum standardTransferTypes()
void addReporterTransferMode(const ReporterName &name, const ReporterMode &mode, FEProblemBase &problem)
static InputParameters validParams()
Reporter objects allow for the declaration of arbitrary data types that are aggregate values for a si...
FEProblemBase & _fe_problem
MooseEnum _current_direction
Base class for user-specific data.