19 MultiAppCommandLineControl,
28 params.
addClassDescription(
"Control for modifying the command line arguments of MultiApps.");
34 params.
addRequiredParam<MultiAppName>(
"multi_app",
"The name of the MultiApp to control.");
37 "The Sampler object to utilize for altering the command line options of the MultiApp.");
39 "param_names",
"The names of the command line parameters to set via the sampled data.");
47 _multi_app(_fe_problem.getMultiApp(getParam<MultiAppName>(
"multi_app"))),
49 _param_names(getParam<
std::vector<
std::string>>(
"param_names"))
54 "The sampler object, '",
56 "', is being used by the '",
58 "' object, thus the 'execute_on' of the sampler must include 'PRE_MULTIAPP_SETUP'.");
62 "The MultiApp must construct its sub-apps in initial setup but not during its " 65 "'.\nTypically only sampler MultiApps work with '",
69 bool batch_reset =
_multi_app->isParamValid(
"mode") &&
71 bool batch_restore =
_multi_app->isParamValid(
"mode") &&
76 else if (batch_restore)
79 "The MultiApp object, '",
81 "', supplied to the '",
83 "' object is setup to run in 'batch-restore' mode, when using this mode command line " 84 "arguments cannot be modified; batch-reset mode should be used instead.");
89 ") created by MultiApp object '",
91 "' must be equal to the number for rows (",
111 _orig_args = getControllableValueByName<std::vector<CLIArgString>>(
112 "MultiApp",
_multi_app->name(),
"cli_args",
true);
126 bool has_brackets =
false;
129 has_brackets =
_param_names[0].find(
"[") != std::string::npos;
131 if (has_brackets != (
_param_names[i].find(
"[") != std::string::npos))
133 "If the bracket is used, it must be provided to every parameter.");
137 "The number of columns (",
139 ") must match the number of parameters (",
145 std::ostringstream oss;
154 for (
auto & clia : cli_args)
157 setControllableValueByName<std::vector<CLIArgString>>(
158 "MultiApp",
_multi_app->name(),
"cli_args", cli_args);
static InputParameters validParams()
static InputParameters validParams()
Sampler & _sampler
Sampler to utilize for creating MultiApps.
static InputParameters validParams()
A Control object for receiving data from a parent application Sampler object.
virtual void initialSetup() override final
Do not allow the use of initialSetup, because this class is designed to operate on PRE_MULTIAPP_SETUP...
virtual const std::string & name() const
MultiAppSamplerControl(const InputParameters ¶meters)
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
std::vector< CLIArgString > _orig_args
The original cli_args from input.
const std::string & type() const
const T & getParam(const std::string &name) const
void paramError(const std::string ¶m, Args... args) const
bool isValueSet(const std::string &value) const
registerMooseObject("StochasticToolsApp", MultiAppSamplerControl)
dof_id_type getNumberOfRows() const
virtual void execute() override
void mooseError(Args &&... args) const
std::shared_ptr< MultiApp > _multi_app
The MultiApp this Transfer is transferring data to or from.
const std::vector< std::string > & _param_names
Storage for the parameter names to be applied.
registerMooseObjectRenamed("StochasticToolsApp", MultiAppCommandLineControl, "01/01/2023 00:00", MultiAppSamplerControl)
dof_id_type getNumberOfCols() const