10 #include "FEProblemBase.h"
13 #include "UserObject.h"
23 InputParameters params = validParams<MultiAppTransfer>();
25 params.addClassDescription(
"Transfers coefficient arrays between objects that are derived from "
26 "MutableCoefficientsInterface; currently includes the following "
27 "types: FunctionSeries, FXBoundaryUserObject, and FXVolumeUserObject");
29 params.addRequiredParam<std::string>(
30 "this_app_object_name",
31 "Name of the MutableCoefficientsInterface-derived object in this app (LocalApp).");
33 params.addRequiredParam<std::string>(
34 "multi_app_object_name",
35 "Name of the MutableCoefficientsInterface-derived object in the MultiApp.");
41 : MultiAppTransfer(parameters),
42 _this_app_object_name(getParam<std::string>(
"this_app_object_name")),
43 _multi_app_object_name(getParam<std::string>(
"multi_app_object_name")),
44 getMultiAppObject(NULL),
47 if (_directions.size() != 1)
48 paramError(
"direction",
"This transfer is only unidirectional");
62 for (std::size_t i = 0; i < _multi_app->numGlobalApps(); ++i)
63 if (_multi_app->hasLocalApp(i))
71 mooseError(
"The name '",
73 "' is assigned to two different object types. Please modify your input file and "
83 const std::string & object_name,
84 const std::string & app_name)
100 if (base.hasFunction(object_name))
102 Function &
function = base.getFunction(object_name);
109 mooseError(
"Function '",
113 "' does not inherit from MutableCoefficientsInterface.",
114 " Please change the function type and try again.");
117 else if (base.hasUserObject(object_name))
120 auto & user_object = base.getUserObjectTempl<UserObject>(object_name);
127 mooseError(
"UserObject '",
131 "' does not inherit from MutableCoefficientsInterface.",
132 " Please change the function type and try again.");
140 const std::string & object_name,
143 return dynamic_cast<MutableCoefficientsInterface &>(base.getFunction(object_name, thread));
148 const std::string & object_name,
152 auto & user_object = base.getUserObjectTempl<UserObject>(object_name, thread);
153 return dynamic_cast<MutableCoefficientsInterface &>(user_object);
159 _console <<
"Beginning MultiAppFXTransfer: " <<
name() << std::endl;
161 switch (_current_direction)
170 for (
unsigned int i = 0; i < _multi_app->numGlobalApps(); ++i)
172 if (_multi_app->hasLocalApp(i))
173 for (THREAD_ID t = 0; t < libMesh::n_threads(); ++t)
184 "' is not compatible with '",
200 if (_multi_app->hasLocalApp(0))
206 for (THREAD_ID t = 0; t < libMesh::n_threads(); ++t)
217 "' is not compatible with '",
226 _console <<
"Finished MultiAppFXTransfer: " <<
name() << std::endl;