Line data Source code
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 : // MOOSE includes
11 : #include "MooseUtils.h"
12 : #include "MooseInit.h"
13 : #include "InputParameters.h"
14 : #include "ActionFactory.h"
15 : #include "Action.h"
16 : #include "Factory.h"
17 : #include "MooseObjectAction.h"
18 : #include "AddActionComponentAction.h"
19 : #include "ActionWarehouse.h"
20 : #include "EmptyAction.h"
21 : #include "FEProblem.h"
22 : #include "MooseMesh.h"
23 : #include "Executioner.h"
24 : #include "MooseApp.h"
25 : #include "MooseEnum.h"
26 : #include "MultiMooseEnum.h"
27 : #include "MultiApp.h"
28 : #include "GlobalParamsAction.h"
29 : #include "SyntaxTree.h"
30 : #include "InputFileFormatter.h"
31 : #include "YAMLFormatter.h"
32 : #include "MooseTypes.h"
33 : #include "CommandLine.h"
34 : #include "JsonSyntaxTree.h"
35 : #include "SystemInfo.h"
36 : #include "MooseUtils.h"
37 : #include "Conversion.h"
38 : #include "Units.h"
39 : #include "ActionComponent.h"
40 :
41 : #include "libmesh/parallel.h"
42 : #include "libmesh/fparser.hh"
43 :
44 : // Regular expression includes
45 : #include "pcrecpp.h"
46 :
47 : // C++ includes
48 : #include <string>
49 : #include <map>
50 : #include <fstream>
51 : #include <iomanip>
52 : #include <algorithm>
53 : #include <cstdlib>
54 : #include <filesystem>
55 :
56 : namespace Moose
57 : {
58 :
59 : bool
60 1142371 : isSectionActive(std::string path, hit::Node * root)
61 : {
62 1142371 : hit::Node * n = root->find(path);
63 3858147 : while (n)
64 : {
65 2779182 : hit::Node * section = n->parent();
66 2779182 : if (section)
67 : {
68 1700217 : auto actives = section->find("active");
69 1700217 : auto inactives = section->find("inactive");
70 :
71 : // only check current level, not nested ones
72 1700217 : if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
73 : {
74 77669 : auto vars = section->param<std::vector<std::string>>("active");
75 77669 : bool have_var = false;
76 200225 : for (auto & var : vars)
77 122556 : if (n->path() == hit::pathNorm(var))
78 22536 : have_var = true;
79 77669 : if (!have_var)
80 55133 : return false;
81 77669 : }
82 : // only check current level, not nested ones
83 1645084 : if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
84 : {
85 11995 : auto vars = section->param<std::vector<std::string>>("inactive");
86 20058 : for (auto & var : vars)
87 16336 : if (n->path() == hit::pathNorm(var))
88 8273 : return false;
89 11995 : }
90 : }
91 2715776 : n = section;
92 : }
93 1078965 : return true;
94 : }
95 :
96 : std::vector<std::string>
97 128 : findSimilar(std::string param, std::vector<std::string> options)
98 : {
99 128 : std::vector<std::string> candidates;
100 128 : if (options.size() == 0)
101 14 : return candidates;
102 :
103 114 : int mindist = MooseUtils::levenshteinDist(options[0], param);
104 3620 : for (auto & opt : options)
105 : {
106 3506 : int dist = MooseUtils::levenshteinDist(opt, param);
107 : // magic number heuristics to get similarity distance cutoff
108 3506 : int dist_cutoff = 1 + param.size() / 5;
109 3506 : if (dist > dist_cutoff || dist > mindist)
110 3506 : continue;
111 :
112 0 : if (dist < mindist)
113 : {
114 0 : mindist = dist;
115 0 : candidates.clear();
116 : }
117 0 : candidates.push_back(opt);
118 : }
119 114 : return candidates;
120 0 : }
121 :
122 62755 : Builder::Builder(MooseApp & app, ActionWarehouse & action_wh, std::shared_ptr<Parser> parser)
123 : : ConsoleStreamInterface(app),
124 62755 : _app(app),
125 62755 : _factory(app.getFactory()),
126 62755 : _action_wh(action_wh),
127 62755 : _action_factory(app.getActionFactory()),
128 62755 : _syntax(_action_wh.syntax()),
129 62755 : _parser(parser),
130 62755 : _syntax_formatter(nullptr),
131 62755 : _sections_read(false),
132 62755 : _current_params(nullptr),
133 125510 : _current_error_stream(nullptr)
134 : {
135 : mooseAssert(_parser, "Parser is not set");
136 62755 : }
137 :
138 57254 : Builder::~Builder() {}
139 :
140 : InputParameters
141 7246213 : Builder::validParams()
142 : {
143 7246213 : InputParameters params = emptyInputParameters();
144 :
145 : /**
146 : * Add the "active" and "inactive" parameters so that all blocks in the input file
147 : * can selectively create lists of active/inactive sub-blocks.
148 : */
149 21738639 : params.addParam<std::vector<std::string>>(
150 : "active",
151 28984852 : std::vector<std::string>({"__all__"}),
152 : "If specified only the blocks named will be visited and made active");
153 21738639 : params.addParam<std::vector<std::string>>(
154 : "inactive",
155 14492426 : std::vector<std::string>(),
156 : "If specified blocks matching these identifiers will be skipped.");
157 :
158 7246213 : return params;
159 14492426 : }
160 :
161 : std::vector<std::string>
162 128 : Builder::listValidParams(std::string & section_name)
163 : {
164 : bool dummy;
165 128 : std::string registered_identifier = _syntax.isAssociated(section_name, &dummy);
166 128 : auto iters = _syntax.getActions(registered_identifier);
167 :
168 128 : std::vector<std::string> paramlist;
169 370 : for (auto it = iters.first; it != iters.second; ++it)
170 : {
171 242 : auto params = _action_factory.getValidParams(it->second._action);
172 3748 : for (const auto & it : params)
173 3506 : paramlist.push_back(it.first);
174 242 : }
175 256 : return paramlist;
176 128 : }
177 :
178 : void
179 2330614 : UnusedWalker::walk(const std::string & fullpath, const std::string & nodename, hit::Node * n)
180 : {
181 : // the line() > 0 check allows us to skip nodes that were merged into this tree (i.e. CLI
182 : // args) because their unused params are checked+reported independently of the ones in the
183 : // main tree.
184 65457 : if (!_used.count(fullpath) && nodename != "active" && nodename != "inactive" &&
185 2396071 : isSectionActive(fullpath, n->root()) && n->line() > 0)
186 : {
187 128 : auto section_name = fullpath.substr(0, fullpath.rfind("/"));
188 128 : auto paramlist = _builder.listValidParams(section_name);
189 128 : auto candidates = findSimilar(nodename, paramlist);
190 128 : if (candidates.size() > 0)
191 0 : errors.push_back(hit::errormsg(
192 0 : n, "unused parameter '", fullpath, "'\n", " Did you mean '", candidates[0], "'?"));
193 : else
194 128 : errors.push_back(hit::errormsg(n, "unused parameter '", fullpath, "'"));
195 128 : }
196 2330614 : }
197 :
198 : std::string
199 2218 : Builder::getPrimaryFileName(bool strip_leading_path) const
200 : {
201 2218 : const auto path = _parser->getLastInputFilePath();
202 6654 : return (strip_leading_path ? path.filename() : std::filesystem::absolute(path)).string();
203 2218 : }
204 :
205 : void
206 1093384 : Builder::walkRaw(std::string /*fullpath*/, std::string /*nodepath*/, hit::Node * n)
207 : {
208 1093384 : InputParameters active_list_params = Action::validParams();
209 1093384 : InputParameters params = EmptyAction::validParams();
210 :
211 1093384 : std::string section_name = n->fullpath();
212 1093384 : std::string curr_identifier = n->fullpath();
213 :
214 : // Before we retrieve any actions or build any objects, make sure that the section they are in
215 : // is active
216 1093384 : if (!isSectionActive(curr_identifier, root()))
217 14547 : return;
218 :
219 : // Extract the block parameters before constructing the action
220 : // There may be more than one Action registered for a given section in which case we need to
221 : // build them all
222 : bool is_parent;
223 1078837 : std::string registered_identifier = _syntax.isAssociated(section_name, &is_parent);
224 :
225 : // Make sure at least one action is associated with the current identifier
226 1078837 : if (const auto [begin, end] = _syntax.getActions(registered_identifier); begin == end)
227 : {
228 8 : _errmsg += hit::errormsg(n,
229 : "section '[",
230 : curr_identifier,
231 : "]' does not have an associated \"Action\".\n Common causes:\n"
232 : "- you misspelled the Action/section name\n"
233 8 : "- the app you are running does not support this Action/syntax") +
234 4 : "\n";
235 4 : return;
236 : }
237 :
238 : // The DynamicObjecRegistrationAction changes the action multimap and would invalidate the
239 : // iterators returned by _syntax.getActions, that's why we have to loop in this awkward way.
240 1078833 : std::set<const Syntax::ActionInfo *> processed_actions;
241 : while (true)
242 : {
243 : // search for an unprocessed action
244 2781381 : auto [begin, end] = _syntax.getActions(registered_identifier);
245 2781381 : auto it = begin;
246 5654341 : for (; it != end && processed_actions.count(&it->second); ++it)
247 : ;
248 :
249 : // no more unprocessed actions
250 2781381 : if (it == end)
251 1078671 : break;
252 :
253 : // mark action as processed
254 1702710 : processed_actions.insert(&it->second);
255 :
256 1702710 : if (is_parent)
257 314338 : continue;
258 1388372 : if (_syntax.isDeprecatedSyntax(registered_identifier))
259 0 : mooseDeprecated(
260 0 : hit::errormsg(n, _syntax.deprecatedActionSyntaxMessage(registered_identifier)));
261 :
262 1388372 : params = _action_factory.getValidParams(it->second._action);
263 1388372 : params.set<ActionWarehouse *>("awh") = &_action_wh;
264 1388372 : params.setHitNode(*n, {});
265 :
266 1388372 : extractParams(curr_identifier, params);
267 :
268 : // Add the parsed syntax to the parameters object for consumption by the Action
269 1388368 : params.set<std::string>("task") = it->second._task;
270 1388368 : params.set<std::string>("registered_identifier") = registered_identifier;
271 :
272 1388368 : if (!(params.have_parameter<bool>("isObjectAction") && params.get<bool>("isObjectAction")))
273 1386118 : params.set<std::vector<std::string>>("control_tags")
274 693059 : .push_back(MooseUtils::baseName(curr_identifier));
275 :
276 : // Create the Action
277 : std::shared_ptr<Action> action_obj =
278 1388368 : _action_factory.create(it->second._action, curr_identifier, params);
279 :
280 : {
281 : // extract the MooseObject params if necessary
282 : std::shared_ptr<MooseObjectAction> object_action =
283 1388258 : std::dynamic_pointer_cast<MooseObjectAction>(action_obj);
284 1388258 : if (object_action)
285 : {
286 695098 : auto & object_params = object_action->getObjectParams();
287 695098 : object_params.setHitNode(*n, {});
288 695098 : extractParams(curr_identifier, object_params);
289 1390108 : object_params.set<std::vector<std::string>>("control_tags")
290 695054 : .push_back(MooseUtils::baseName(curr_identifier));
291 : }
292 : // extract the Component params if necessary
293 : std::shared_ptr<AddActionComponentAction> component_action =
294 1388214 : std::dynamic_pointer_cast<AddActionComponentAction>(action_obj);
295 1388214 : if (component_action)
296 : {
297 184 : auto & component_params = component_action->getComponentParams();
298 184 : component_params.setHitNode(*n, {});
299 184 : extractParams(curr_identifier, component_params);
300 368 : component_params.set<std::vector<std::string>>("control_tags")
301 184 : .push_back(MooseUtils::baseName(curr_identifier));
302 : }
303 1388214 : }
304 :
305 : // add it to the warehouse
306 1388214 : _action_wh.addActionBlock(action_obj);
307 3090758 : }
308 1136879 : }
309 :
310 : void
311 1093373 : Builder::walk(const std::string & fullpath, const std::string & nodepath, hit::Node * n)
312 : {
313 : // skip sections that were manually processed first.
314 4341930 : for (auto & sec : _secs_need_first)
315 3274238 : if (nodepath == sec)
316 25681 : return;
317 1067692 : walkRaw(fullpath, nodepath, n);
318 : }
319 :
320 : hit::Node *
321 61306154 : Builder::root()
322 : {
323 : mooseAssert(_parser, "Parser is not set");
324 61306154 : return _parser->root();
325 : }
326 :
327 : void
328 62190 : Builder::build()
329 : {
330 : // add in command line arguments
331 62190 : const auto cli_input = _app.commandLine()->buildHitParams();
332 : try
333 : {
334 62190 : _cli_root.reset(hit::parse("CLI_ARGS", cli_input));
335 62190 : hit::explode(_cli_root.get());
336 62190 : hit::merge(_cli_root.get(), root());
337 : }
338 0 : catch (hit::ParseError & err)
339 : {
340 0 : mooseError(err.what());
341 0 : }
342 :
343 : // expand ${bla} parameter values and mark/include variables used in expansions as "used". This
344 : // MUST occur before parameter extraction - otherwise parameters will get wrong values.
345 62190 : hit::RawEvaler raw;
346 62190 : hit::EnvEvaler env;
347 62190 : hit::ReplaceEvaler repl;
348 62190 : FuncParseEvaler fparse_ev;
349 62190 : UnitsConversionEvaler units_ev;
350 62190 : hit::BraceExpander exw;
351 62190 : exw.registerEvaler("raw", raw);
352 62190 : exw.registerEvaler("env", env);
353 62190 : exw.registerEvaler("fparse", fparse_ev);
354 62190 : exw.registerEvaler("replace", repl);
355 62190 : exw.registerEvaler("units", units_ev);
356 62190 : root()->walk(&exw);
357 85305 : for (auto & var : exw.used)
358 23115 : _extracted_vars.insert(var);
359 62191 : for (auto & msg : exw.errors)
360 1 : _errmsg += msg + "\n";
361 :
362 : // do as much error checking as early as possible so that errors are more useful instead
363 : // of surprising and disconnected from what caused them.
364 62190 : DupParamWalker dw;
365 62190 : BadActiveWalker bw;
366 62190 : root()->walk(&dw, hit::NodeType::Field);
367 62190 : root()->walk(&bw, hit::NodeType::Section);
368 62190 : for (auto & msg : dw.errors)
369 0 : _errmsg += msg + "\n";
370 62206 : for (auto & msg : bw.errors)
371 16 : _errmsg += msg + "\n";
372 :
373 : // Print parse errors related to brace expansion early
374 62190 : if (_errmsg.size() > 0)
375 13 : mooseError(_errmsg);
376 :
377 : // There are a few order dependent actions that have to be built first in
378 : // order for the parser and application to function properly:
379 : //
380 : // SetupDebugAction: This action can contain an option for monitoring the parser progress. It must
381 : // be parsed first to capture all of the parsing output.
382 : //
383 : // GlobalParamsAction: This action is checked during the parameter extraction routines of all
384 : // subsequent blocks. It must be parsed early since it must exist during
385 : // subsequent parameter extraction.
386 : //
387 : // DynamicObjectRegistration: This action must be built before any MooseObjectActions are built.
388 : // This is because we retrieve valid parameters from the Factory
389 : // during parse time. Objects must be registered before
390 : // validParameters can be retrieved.
391 62177 : auto syntax = _syntax.getSyntaxByAction("SetupDebugAction");
392 62177 : std::copy(syntax.begin(), syntax.end(), std::back_inserter(_secs_need_first));
393 :
394 62177 : syntax = _syntax.getSyntaxByAction("GlobalParamsAction");
395 62177 : std::copy(syntax.begin(), syntax.end(), std::back_inserter(_secs_need_first));
396 :
397 62177 : syntax = _syntax.getSyntaxByAction("DynamicObjectRegistrationAction");
398 62177 : std::copy(syntax.begin(), syntax.end(), std::back_inserter(_secs_need_first));
399 :
400 : // walk all the sections extracting paramters from each into InputParameters objects
401 248708 : for (auto & sec : _secs_need_first)
402 : {
403 186531 : auto n = root()->find(sec);
404 186531 : if (n)
405 25692 : walkRaw(n->parent()->fullpath(), n->path(), n);
406 : }
407 62177 : root()->walk(this, hit::NodeType::Section);
408 :
409 62015 : if (_errmsg.size() > 0)
410 28 : mooseError(_errmsg);
411 61996 : }
412 :
413 : // Checks the input and the way it has been used and emits any errors/warnings.
414 : // This has to be a separate function because for we don't know if some parameters were unused
415 : // until all the multiapps/subapps have been fully initialized - which isn't complete until
416 : // *after* all the other member functions on Parser have been run. So this is here to be
417 : // externally called at the right time.
418 : void
419 57245 : Builder::errorCheck(const Parallel::Communicator & comm, bool warn_unused, bool err_unused)
420 : {
421 : // this if guard is important in case the simulation was not configured via parsed input text -
422 : // e.g. configured programatically.
423 57245 : if (!root() || !_cli_root)
424 1 : return;
425 :
426 57244 : UnusedWalker uw(_extracted_vars, *this);
427 57244 : UnusedWalker uwcli(_extracted_vars, *this);
428 :
429 57244 : root()->walk(&uw);
430 57244 : _cli_root->walk(&uwcli);
431 :
432 57244 : auto cli = _app.commandLine();
433 57244 : if (warn_unused)
434 : {
435 119 : for (const auto & arg : cli->unusedHitParams(comm))
436 : _warnmsg +=
437 119 : hit::errormsg("CLI_ARG", nullptr, "unused command line parameter '", arg, "'") + "\n";
438 136 : for (auto & msg : uwcli.errors)
439 17 : _warnmsg += msg + "\n";
440 168 : for (auto & msg : uw.errors)
441 49 : _warnmsg += msg + "\n";
442 : }
443 57125 : else if (err_unused)
444 : {
445 57129 : for (const auto & arg : cli->unusedHitParams(comm))
446 : _errmsg +=
447 57129 : hit::errormsg("CLI_ARG", nullptr, "unused command line parameter '", arg, "'") + "\n";
448 57144 : for (auto & msg : uwcli.errors)
449 19 : _errmsg += msg + "\n";
450 57168 : for (auto & msg : uw.errors)
451 43 : _errmsg += msg + "\n";
452 : }
453 :
454 57244 : if (_warnmsg.size() > 0)
455 49 : mooseUnused(_warnmsg);
456 57244 : if (_errmsg.size() > 0)
457 39 : mooseError(
458 39 : _errmsg +
459 : "\n\nAppend --allow-unused (or -w) on the command line to ignore unused parameters.");
460 57205 : }
461 :
462 : void
463 20 : Builder::initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
464 : {
465 20 : switch (type)
466 : {
467 0 : case INPUT_FILE:
468 0 : _syntax_formatter = std::make_unique<InputFileFormatter>(dump_mode);
469 0 : break;
470 20 : case YAML:
471 20 : _syntax_formatter = std::make_unique<YAMLFormatter>(dump_mode);
472 20 : break;
473 0 : default:
474 0 : mooseError("Unrecognized Syntax Formatter requested");
475 : break;
476 : }
477 20 : }
478 :
479 : void
480 183 : Builder::buildJsonSyntaxTree(JsonSyntaxTree & root) const
481 : {
482 183 : std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
483 :
484 4941 : for (const auto & iter : _syntax.getAssociatedTypes())
485 4758 : root.addSyntaxType(iter.first, iter.second);
486 :
487 : // Build a list of all the actions appearing in the syntax
488 21921 : for (const auto & iter : _syntax.getAssociatedActions())
489 : {
490 21738 : Syntax::ActionInfo act_info = iter.second;
491 : /**
492 : * If the task is nullptr that means we need to figure out which task goes with this syntax for
493 : * the purpose of building the Moose Object part of the tree. We will figure this out by asking
494 : * the ActionFactory for the registration info.
495 : */
496 21738 : if (act_info._task == "")
497 17111 : act_info._task = _action_factory.getTaskName(act_info._action);
498 :
499 21738 : all_names.push_back(std::make_pair(iter.first, act_info));
500 21738 : }
501 :
502 : // Add all the actions to the JSON tree, except for ActionComponents (below)
503 21921 : for (const auto & act_names : all_names)
504 : {
505 21738 : const auto & act_info = act_names.second;
506 21738 : const std::string & action = act_info._action;
507 21738 : const std::string & task = act_info._task;
508 21738 : const std::string syntax = act_names.first;
509 21738 : InputParameters action_obj_params = _action_factory.getValidParams(action);
510 65214 : bool params_added = root.addParameters("",
511 : syntax,
512 : false,
513 : action,
514 : true,
515 : &action_obj_params,
516 43476 : _syntax.getLineInfo(syntax, action, ""),
517 : "");
518 :
519 21738 : if (params_added)
520 : {
521 19111 : auto tasks = _action_factory.getTasksByAction(action);
522 49400 : for (auto & t : tasks)
523 : {
524 30289 : auto info = _action_factory.getLineInfo(action, t);
525 30289 : root.addActionTask(syntax, action, t, info);
526 30289 : }
527 19111 : }
528 :
529 : /**
530 : * We need to see if this action is inherited from MooseObjectAction. If it is, then we will
531 : * loop over all the Objects in MOOSE's Factory object to print them out if they have associated
532 : * bases matching the current task.
533 : */
534 34593 : if (action_obj_params.have_parameter<bool>("isObjectAction") &&
535 34593 : action_obj_params.get<bool>("isObjectAction"))
536 : {
537 19183683 : for (auto & [moose_obj_name, obj] : _factory.registeredObjects())
538 : {
539 19170828 : auto moose_obj_params = obj->buildParameters();
540 : // Now that we know that this is a MooseObjectAction we need to see if it has been
541 : // restricted
542 : // in any way by the user.
543 19170828 : const std::vector<std::string> & buildable_types = action_obj_params.getBuildableTypes();
544 :
545 : // See if the current Moose Object syntax belongs under this Action's block
546 19170828 : if ((buildable_types.empty() || // Not restricted
547 0 : std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
548 0 : buildable_types.end()) && // Restricted but found
549 19170828 : moose_obj_params.have_parameter<std::string>("_moose_base") && // Has a registered base
550 19170828 : _syntax.verifyMooseObjectTask(moose_obj_params.get<std::string>("_moose_base"),
551 38341656 : task) && // and that base is associated
552 404510 : action_obj_params.mooseObjectSyntaxVisibility() // and the Action says it's visible
553 : )
554 : {
555 404510 : std::string name;
556 404510 : size_t pos = 0;
557 404510 : bool is_action_params = false;
558 404510 : bool is_type = false;
559 404510 : if (syntax[syntax.size() - 1] == '*')
560 : {
561 352283 : pos = syntax.size();
562 :
563 352283 : if (!action_obj_params.collapseSyntaxNesting())
564 352283 : name = syntax.substr(0, pos - 1) + moose_obj_name;
565 : else
566 : {
567 0 : name = syntax.substr(0, pos - 1) + "/<type>/" + moose_obj_name;
568 0 : is_action_params = true;
569 : }
570 : }
571 : else
572 : {
573 52227 : name = syntax + "/<type>/" + moose_obj_name;
574 52227 : is_type = true;
575 : }
576 404510 : moose_obj_params.set<std::string>("type") = moose_obj_name;
577 :
578 404510 : auto lineinfo = _factory.getLineInfo(moose_obj_name);
579 404510 : std::string classname = _factory.associatedClassName(moose_obj_name);
580 404510 : root.addParameters(syntax,
581 : name,
582 : is_type,
583 : moose_obj_name,
584 : is_action_params,
585 : &moose_obj_params,
586 : lineinfo,
587 : classname);
588 404510 : }
589 19170828 : }
590 :
591 : // Same thing for ActionComponents, which, while they are not MooseObjects, should behave
592 : // similarly syntax-wise
593 12855 : if (syntax != "ActionComponents/*")
594 12672 : continue;
595 :
596 183 : auto iters = _action_factory.getActionsByTask("list_component");
597 :
598 549 : for (auto it = iters.first; it != iters.second; ++it)
599 : {
600 : // Get the name and parameters
601 366 : const auto component_name = it->second;
602 366 : auto component_params = _action_factory.getValidParams(component_name);
603 :
604 : // We currently do not have build-type restrictions on this action that adds
605 : // action-components
606 :
607 : // See if the current Moose Object syntax belongs under this Action's block
608 366 : if (action_obj_params.mooseObjectSyntaxVisibility() // and the Action says it's visible
609 : )
610 : {
611 : // The logic for Components is a little simpler here for now because syntax like
612 : // Executioner/TimeIntegrator/type= do not exist for components
613 366 : std::string name;
614 366 : if (syntax[syntax.size() - 1] == '*')
615 : {
616 366 : size_t pos = syntax.size();
617 366 : name = syntax.substr(0, pos - 1) + component_name;
618 : }
619 366 : component_params.set<std::string>("type") = component_name;
620 :
621 366 : auto lineinfo = _action_factory.getLineInfo(component_name, "list_component");
622 : // We add the parameters as for an object, because we want to fit them to be
623 : // added to json["AddActionComponentAction"]["subblock_types"]
624 366 : root.addParameters(syntax,
625 : /*syntax_path*/ name,
626 : /*is_type*/ false,
627 : "AddActionComponentAction",
628 : /*is_action=*/false,
629 : &component_params,
630 : lineinfo,
631 : component_name);
632 366 : }
633 366 : }
634 : }
635 34410 : }
636 183 : root.addGlobal();
637 183 : }
638 :
639 : void
640 20 : Builder::buildFullTree(const std::string & search_string)
641 : {
642 20 : std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
643 :
644 2408 : for (const auto & iter : _syntax.getAssociatedActions())
645 : {
646 2388 : Syntax::ActionInfo act_info = iter.second;
647 : /**
648 : * If the task is nullptr that means we need to figure out which task goes with this syntax for
649 : * the purpose of building the Moose Object part of the tree. We will figure this out by asking
650 : * the ActionFactory for the registration info.
651 : */
652 2388 : if (act_info._task == "")
653 1880 : act_info._task = _action_factory.getTaskName(act_info._action);
654 :
655 2388 : all_names.push_back(std::pair<std::string, Syntax::ActionInfo>(iter.first, act_info));
656 2388 : }
657 :
658 2408 : for (const auto & act_names : all_names)
659 : {
660 2388 : InputParameters action_obj_params = _action_factory.getValidParams(act_names.second._action);
661 4776 : _syntax_formatter->insertNode(
662 2388 : act_names.first, act_names.second._action, true, &action_obj_params);
663 :
664 2388 : const std::string & task = act_names.second._task;
665 2388 : std::string act_name = act_names.first;
666 :
667 : /**
668 : * We need to see if this action is inherited from MooseObjectAction. If it is, then we will
669 : * loop over all the Objects in MOOSE's Factory object to print them out if they have associated
670 : * bases matching the current task.
671 : */
672 3796 : if (action_obj_params.have_parameter<bool>("isObjectAction") &&
673 3796 : action_obj_params.get<bool>("isObjectAction"))
674 : {
675 2101792 : for (const auto & [moose_obj_name, obj] : _factory.registeredObjects())
676 : {
677 2100384 : auto moose_obj_params = obj->buildParameters();
678 : /**
679 : * Now that we know that this is a MooseObjectAction we need to see if it has been
680 : * restricted in any way by the user.
681 : */
682 2100384 : const std::vector<std::string> & buildable_types = action_obj_params.getBuildableTypes();
683 :
684 : // See if the current Moose Object syntax belongs under this Action's block
685 2100384 : if ((buildable_types.empty() || // Not restricted
686 0 : std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
687 0 : buildable_types.end()) && // Restricted but found
688 2100384 : moose_obj_params.have_parameter<std::string>("_moose_base") && // Has a registered base
689 2100384 : _syntax.verifyMooseObjectTask(moose_obj_params.get<std::string>("_moose_base"),
690 4200768 : task) && // and that base is associated
691 44430 : action_obj_params.mooseObjectSyntaxVisibility() // and the Action says it's visible
692 : )
693 : {
694 44430 : std::string name;
695 44430 : size_t pos = 0;
696 44430 : bool is_action_params = false;
697 44430 : if (act_name[act_name.size() - 1] == '*')
698 : {
699 38718 : pos = act_name.size();
700 :
701 38718 : if (!action_obj_params.collapseSyntaxNesting())
702 38718 : name = act_name.substr(0, pos - 1) + moose_obj_name;
703 : else
704 : {
705 0 : name = act_name.substr(0, pos - 1) + "/<type>/" + moose_obj_name;
706 0 : is_action_params = true;
707 : }
708 : }
709 : else
710 : {
711 5712 : name = act_name + "/<type>/" + moose_obj_name;
712 : }
713 :
714 44430 : moose_obj_params.set<std::string>("type") = moose_obj_name;
715 :
716 44430 : _syntax_formatter->insertNode(name, moose_obj_name, is_action_params, &moose_obj_params);
717 44430 : }
718 2100384 : }
719 : }
720 2388 : }
721 :
722 : // Do not change to _console, we need this printed to the stdout in all cases
723 20 : Moose::out << _syntax_formatter->print(search_string) << std::flush;
724 20 : }
725 :
726 : /**************************************************************************************************
727 : **************************************************************************************************
728 : * Parameter Extraction Routines *
729 : **************************************************************************************************
730 : **************************************************************************************************/
731 : using std::string;
732 :
733 : // Template Specializations for retrieving special types from the input file
734 : template <>
735 : void Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
736 : const std::string & full_name,
737 : const std::string & short_name,
738 : InputParameters::Parameter<RealVectorValue> * param,
739 : bool in_global,
740 : GlobalParamsAction * global_block);
741 :
742 : template <>
743 : void Builder::setScalarParameter<Point, Point>(const std::string & full_name,
744 : const std::string & short_name,
745 : InputParameters::Parameter<Point> * param,
746 : bool in_global,
747 : GlobalParamsAction * global_block);
748 :
749 : template <>
750 : void Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
751 : const std::string & full_name,
752 : const std::string & short_name,
753 : InputParameters::Parameter<RealEigenVector> * param,
754 : bool in_global,
755 : GlobalParamsAction * global_block);
756 :
757 : template <>
758 : void Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
759 : const std::string & full_name,
760 : const std::string & short_name,
761 : InputParameters::Parameter<RealEigenMatrix> * param,
762 : bool in_global,
763 : GlobalParamsAction * global_block);
764 :
765 : template <>
766 : void Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
767 : const std::string & full_name,
768 : const std::string & short_name,
769 : InputParameters::Parameter<PostprocessorName> * param,
770 : bool in_global,
771 : GlobalParamsAction * global_block);
772 :
773 : template <>
774 : void
775 : Builder::setScalarParameter<MooseEnum, MooseEnum>(const std::string & full_name,
776 : const std::string & short_name,
777 : InputParameters::Parameter<MooseEnum> * param,
778 : bool in_global,
779 : GlobalParamsAction * global_block);
780 :
781 : template <>
782 : void Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
783 : const std::string & full_name,
784 : const std::string & short_name,
785 : InputParameters::Parameter<MultiMooseEnum> * param,
786 : bool in_global,
787 : GlobalParamsAction * global_block);
788 :
789 : template <>
790 : void Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
791 : const std::string & full_name,
792 : const std::string & short_name,
793 : InputParameters::Parameter<ExecFlagEnum> * param,
794 : bool in_global,
795 : GlobalParamsAction * global_block);
796 :
797 : template <>
798 : void Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
799 : const std::string & full_name,
800 : const std::string & short_name,
801 : InputParameters::Parameter<RealTensorValue> * param,
802 : bool in_global,
803 : GlobalParamsAction * global_block);
804 :
805 : template <>
806 : void Builder::setScalarParameter<ReporterName, std::string>(
807 : const std::string & full_name,
808 : const std::string & short_name,
809 : InputParameters::Parameter<ReporterName> * param,
810 : bool in_global,
811 : GlobalParamsAction * global_block);
812 :
813 : // Vectors
814 : template <>
815 : void Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
816 : const std::string & full_name,
817 : const std::string & short_name,
818 : InputParameters::Parameter<std::vector<RealVectorValue>> * param,
819 : bool in_global,
820 : GlobalParamsAction * global_block);
821 :
822 : template <>
823 : void
824 : Builder::setVectorParameter<Point, Point>(const std::string & full_name,
825 : const std::string & short_name,
826 : InputParameters::Parameter<std::vector<Point>> * param,
827 : bool in_global,
828 : GlobalParamsAction * global_block);
829 :
830 : template <>
831 : void Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
832 : const std::string & full_name,
833 : const std::string & short_name,
834 : InputParameters::Parameter<std::vector<PostprocessorName>> * param,
835 : bool in_global,
836 : GlobalParamsAction * global_block);
837 :
838 : template <>
839 : void Builder::setVectorParameter<MooseEnum, MooseEnum>(
840 : const std::string & full_name,
841 : const std::string & short_name,
842 : InputParameters::Parameter<std::vector<MooseEnum>> * param,
843 : bool in_global,
844 : GlobalParamsAction * global_block);
845 :
846 : template <>
847 : void Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
848 : const std::string & full_name,
849 : const std::string & short_name,
850 : InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
851 : bool in_global,
852 : GlobalParamsAction * global_block);
853 :
854 : template <>
855 : void Builder::setVectorParameter<VariableName, VariableName>(
856 : const std::string & full_name,
857 : const std::string & short_name,
858 : InputParameters::Parameter<std::vector<VariableName>> * param,
859 : bool in_global,
860 : GlobalParamsAction * global_block);
861 :
862 : template <>
863 : void Builder::setVectorParameter<ReporterName, std::string>(
864 : const std::string & full_name,
865 : const std::string & short_name,
866 : InputParameters::Parameter<std::vector<ReporterName>> * param,
867 : bool in_global,
868 : GlobalParamsAction * global_block);
869 :
870 : template <>
871 : void Builder::setVectorParameter<CLIArgString, std::string>(
872 : const std::string & full_name,
873 : const std::string & short_name,
874 : InputParameters::Parameter<std::vector<CLIArgString>> * param,
875 : bool in_global,
876 : GlobalParamsAction * global_block);
877 :
878 : template <>
879 : void Builder::setDoubleIndexParameter<Point>(
880 : const std::string & full_name,
881 : const std::string & short_name,
882 : InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
883 : bool in_global,
884 : GlobalParamsAction * global_block);
885 :
886 : void
887 2107120 : Builder::extractParams(const std::string & prefix, InputParameters & p)
888 : {
889 2107120 : std::ostringstream error_stream;
890 2107120 : static const std::string global_params_task = "set_global_params";
891 : static const std::string global_params_block_name =
892 2107120 : _syntax.getSyntaxByAction("GlobalParamsAction").front();
893 :
894 2107120 : ActionIterator act_iter = _action_wh.actionBlocksWithActionBegin(global_params_task);
895 2107120 : GlobalParamsAction * global_params_block = nullptr;
896 :
897 : // We are grabbing only the first
898 2107120 : if (act_iter != _action_wh.actionBlocksWithActionEnd(global_params_task))
899 158213 : global_params_block = dynamic_cast<GlobalParamsAction *>(*act_iter);
900 :
901 : // Set a pointer to the current InputParameters object being parsed so that it can be referred
902 : // to
903 : // in the extraction routines
904 2107120 : _current_params = &p;
905 2107120 : _current_error_stream = &error_stream;
906 55104374 : for (const auto & it : p)
907 : {
908 52997290 : if (p.shouldIgnore(it.first))
909 2552 : continue;
910 :
911 52994738 : bool found = false;
912 52994738 : bool in_global = false;
913 :
914 103682009 : for (const auto & param_name : p.paramAliases(it.first))
915 : {
916 53155390 : std::string orig_name = prefix + "/" + param_name;
917 53155390 : std::string full_name = orig_name;
918 :
919 : // Mark parameters appearing in the input file or command line
920 53155390 : auto node = root()->find(full_name);
921 53155390 : if (node && node->type() == hit::NodeType::Field)
922 : {
923 2411377 : p.setHitNode(param_name, *node, {});
924 2411377 : p.set_attributes(param_name, false);
925 : // Check if we have already printed the deprecated param message.
926 : // If we haven't, add it to the tracker, and print it.
927 2411377 : if (!_deprec_param_tracker.count(param_name))
928 2410404 : if (p.attemptPrintDeprecated(param_name))
929 1232 : _deprec_param_tracker.insert(param_name);
930 2411369 : _extracted_vars.insert(
931 : full_name); // Keep track of all variables extracted from the input file
932 2411369 : found = true;
933 : }
934 : // Wait! Check the GlobalParams section
935 50744013 : else if (global_params_block)
936 : {
937 3584053 : full_name = global_params_block_name + "/" + param_name;
938 3584053 : node = root()->find(full_name);
939 3584053 : if (node)
940 : {
941 56816 : p.setHitNode(param_name, *node, {});
942 56816 : p.set_attributes(param_name, false);
943 56816 : _extracted_vars.insert(
944 : full_name); // Keep track of all variables extracted from the input file
945 56816 : found = true;
946 56816 : in_global = true;
947 : }
948 : }
949 53155382 : if (found)
950 : {
951 2468185 : if (p.isPrivate(param_name) && !in_global)
952 8 : mooseError("The parameter '",
953 : full_name,
954 : "' is a private parameter and should not be used in an input file.");
955 : // avoid setting the parameter
956 2468177 : else if (p.isPrivate(param_name) && in_global)
957 74 : continue;
958 :
959 2468103 : auto & short_name = param_name;
960 2468103 : libMesh::Parameters::Value * par = MooseUtils::get(it.second);
961 :
962 : #define setscalarvaltype(ptype, base, range) \
963 : else if (par->type() == demangle(typeid(ptype).name())) \
964 : setScalarValueTypeParameter<ptype, range, base>( \
965 : full_name, \
966 : short_name, \
967 : dynamic_cast<InputParameters::Parameter<ptype> *>(par), \
968 : in_global, \
969 : global_params_block)
970 : #define setscalar(ptype, base) \
971 : else if (par->type() == demangle(typeid(ptype).name())) \
972 : setScalarParameter<ptype, base>(full_name, \
973 : short_name, \
974 : dynamic_cast<InputParameters::Parameter<ptype> *>(par), \
975 : in_global, \
976 : global_params_block)
977 : #define setvector(ptype, base) \
978 : else if (par->type() == demangle(typeid(std::vector<ptype>).name())) \
979 : setVectorParameter<ptype, base>( \
980 : full_name, \
981 : short_name, \
982 : dynamic_cast<InputParameters::Parameter<std::vector<ptype>> *>(par), \
983 : in_global, \
984 : global_params_block)
985 : #define setmap(key_type, mapped_type) \
986 : else if (par->type() == demangle(typeid(std::map<key_type, mapped_type>).name())) \
987 : setMapParameter( \
988 : full_name, \
989 : short_name, \
990 : dynamic_cast<InputParameters::Parameter<std::map<key_type, mapped_type>> *>(par), \
991 : in_global, \
992 : global_params_block)
993 : #define setvectorvector(ptype) \
994 : else if (par->type() == demangle(typeid(std::vector<std::vector<ptype>>).name())) \
995 : setDoubleIndexParameter<ptype>( \
996 : full_name, \
997 : short_name, \
998 : dynamic_cast<InputParameters::Parameter<std::vector<std::vector<ptype>>> *>(par), \
999 : in_global, \
1000 : global_params_block)
1001 : #define setvectorvectorvector(ptype) \
1002 : else if (par->type() == demangle(typeid(std::vector<std::vector<std::vector<ptype>>>).name())) \
1003 : setTripleIndexParameter<ptype>( \
1004 : full_name, \
1005 : short_name, \
1006 : dynamic_cast< \
1007 : InputParameters::Parameter<std::vector<std::vector<std::vector<ptype>>>> *>(par), \
1008 : in_global, \
1009 : global_params_block)
1010 :
1011 : /**
1012 : * Scalar types
1013 : */
1014 : // built-ins
1015 : // NOTE: Similar dynamic casting is done in InputParameters.C, please update appropriately
1016 : if (false)
1017 : ;
1018 2468103 : setscalarvaltype(Real, double, Real);
1019 2252475 : setscalarvaltype(int, int, long);
1020 2250583 : setscalarvaltype(unsigned short, unsigned int, long);
1021 2239419 : setscalarvaltype(long, int, long);
1022 2239419 : setscalarvaltype(unsigned int, unsigned int, long);
1023 2085941 : setscalarvaltype(unsigned long, unsigned int, long);
1024 2083512 : setscalarvaltype(long int, int64_t, long);
1025 2083512 : setscalarvaltype(unsigned long long, unsigned int, long);
1026 :
1027 2083512 : setscalar(bool, bool);
1028 1917404 : setscalar(SubdomainID, int);
1029 1917404 : setscalar(BoundaryID, int);
1030 :
1031 : // string and string-subclass types
1032 1915834 : setscalar(string, string);
1033 1308720 : setscalar(SubdomainName, string);
1034 1303369 : setscalar(BoundaryName, string);
1035 1286232 : setscalar(FileName, string);
1036 1285003 : setscalar(MeshFileName, string);
1037 1279074 : setscalar(MatrixFileName, string);
1038 1279034 : setscalar(FileNameNoExtension, string);
1039 1278344 : setscalar(RelativeFileName, string);
1040 1278344 : setscalar(DataFileName, string);
1041 1278288 : setscalar(ComponentName, string);
1042 1278288 : setscalar(PhysicsName, string);
1043 1278288 : setscalar(OutFileBase, string);
1044 1278288 : setscalar(VariableName, string);
1045 1265902 : setscalar(NonlinearVariableName, string);
1046 1085701 : setscalar(LinearVariableName, string);
1047 1081069 : setscalar(SolverVariableName, string);
1048 1081069 : setscalar(AuxVariableName, string);
1049 1049063 : setscalar(FunctionName, string);
1050 1005419 : setscalar(ConvergenceName, string);
1051 1004436 : setscalar(MeshDivisionName, string);
1052 1003192 : setscalar(UserObjectName, string);
1053 997427 : setscalar(VectorPostprocessorName, string);
1054 995951 : setscalar(IndicatorName, string);
1055 995493 : setscalar(MarkerName, string);
1056 993655 : setscalar(MultiAppName, string);
1057 980892 : setscalar(OutputName, string);
1058 980892 : setscalar(MaterialPropertyName, string);
1059 968960 : setscalar(MooseFunctorName, string);
1060 953131 : setscalar(MaterialName, string);
1061 953011 : setscalar(DistributionName, string);
1062 953011 : setscalar(PositionsName, string);
1063 952607 : setscalar(SamplerName, string);
1064 952289 : setscalar(TagName, string);
1065 950999 : setscalar(TimesName, string);
1066 950971 : setscalar(MeshGeneratorName, string);
1067 927836 : setscalar(ExtraElementIDName, string);
1068 927740 : setscalar(PostprocessorName, PostprocessorName);
1069 920209 : setscalar(ExecutorName, string);
1070 920169 : setscalar(NonlinearSystemName, string);
1071 919713 : setscalar(LinearSystemName, string);
1072 919713 : setscalar(SolverSystemName, string);
1073 918144 : setscalar(CLIArgString, string);
1074 : #ifdef MFEM_ENABLED
1075 583285 : setscalar(MFEMScalarCoefficientName, string);
1076 583113 : setscalar(MFEMVectorCoefficientName, string);
1077 583051 : setscalar(MFEMMatrixCoefficientName, string);
1078 : #endif
1079 :
1080 : // Moose Compound Scalars
1081 917910 : setscalar(RealVectorValue, RealVectorValue);
1082 899471 : setscalar(Point, Point);
1083 892054 : setscalar(RealEigenVector, RealEigenVector);
1084 890214 : setscalar(RealEigenMatrix, RealEigenMatrix);
1085 890077 : setscalar(MooseEnum, MooseEnum);
1086 494081 : setscalar(MultiMooseEnum, MultiMooseEnum);
1087 462601 : setscalar(RealTensorValue, RealTensorValue);
1088 462565 : setscalar(ExecFlagEnum, ExecFlagEnum);
1089 410034 : setscalar(ReporterName, string);
1090 409146 : setscalar(ReporterValueName, string);
1091 409087 : setscalar(ParsedFunctionExpression, string);
1092 :
1093 : // vector types
1094 408225 : setvector(bool, bool);
1095 407217 : setvector(Real, double);
1096 359725 : setvector(int, int);
1097 358545 : setvector(long, int);
1098 358509 : setvector(unsigned int, int);
1099 :
1100 : // We need to be able to parse 8-byte unsigned types when
1101 : // libmesh is configured --with-dof-id-bytes=8. Officially,
1102 : // libmesh uses uint64_t in that scenario, which is usually
1103 : // equivalent to 'unsigned long long'. Note that 'long long'
1104 : // has been around since C99 so most C++ compilers support it,
1105 : // but presumably uint64_t is the "most standard" way to get a
1106 : // 64-bit unsigned type, so we'll stick with that here.
1107 : #if LIBMESH_DOF_ID_BYTES == 8
1108 349855 : setvector(uint64_t, int);
1109 : #endif
1110 :
1111 348932 : setvector(SubdomainID, int);
1112 346952 : setvector(BoundaryID, int);
1113 346784 : setvector(RealVectorValue, RealVectorValue);
1114 346730 : setvector(Point, Point);
1115 338698 : setvector(MooseEnum, MooseEnum);
1116 338650 : setvector(MultiMooseEnum, MultiMooseEnum);
1117 :
1118 338632 : setvector(string, string);
1119 284310 : setvector(FileName, string);
1120 276596 : setvector(FileNameNoExtension, string);
1121 276596 : setvector(RelativeFileName, string);
1122 276596 : setvector(DataFileName, string);
1123 276596 : setvector(MeshFileName, string);
1124 276570 : setvector(MatrixFileName, string);
1125 276570 : setvector(SubdomainName, string);
1126 236754 : setvector(BoundaryName, string);
1127 118137 : setvector(NonlinearVariableName, string);
1128 117311 : setvector(LinearVariableName, string);
1129 117311 : setvector(SolverVariableName, string);
1130 117311 : setvector(AuxVariableName, string);
1131 107550 : setvector(FunctionName, string);
1132 105564 : setvector(ConvergenceName, string);
1133 105260 : setvector(MeshDivisionName, string);
1134 105248 : setvector(UserObjectName, string);
1135 105248 : setvector(IndicatorName, string);
1136 105248 : setvector(MarkerName, string);
1137 105190 : setvector(MultiAppName, string);
1138 105038 : setvector(PostprocessorName, PostprocessorName);
1139 102868 : setvector(VectorPostprocessorName, string);
1140 102868 : setvector(OutputName, string);
1141 94500 : setvector(MaterialPropertyName, string);
1142 94080 : setvector(MooseFunctorName, string);
1143 91079 : setvector(MaterialName, string);
1144 91079 : setvector(DistributionName, string);
1145 91079 : setvector(SamplerName, string);
1146 91079 : setvector(TagName, string);
1147 87924 : setvector(VariableName, VariableName);
1148 16467 : setvector(MeshGeneratorName, string);
1149 15057 : setvector(ExtraElementIDName, string);
1150 14322 : setvector(ReporterName, string);
1151 13223 : setvector(CLIArgString, string);
1152 11480 : setvector(ComponentName, string);
1153 11480 : setvector(PhysicsName, string);
1154 11372 : setvector(PositionsName, string);
1155 10904 : setvector(TimesName, string);
1156 10904 : setvector(ReporterValueName, string);
1157 8282 : setvector(ExecutorName, string);
1158 8282 : setvector(NonlinearSystemName, string);
1159 8046 : setvector(LinearSystemName, string);
1160 6939 : setvector(SolverSystemName, string);
1161 : #ifdef MFEM_ENABLED
1162 3570 : setvector(MFEMScalarCoefficientName, string);
1163 3536 : setvector(MFEMVectorCoefficientName, string);
1164 3528 : setvector(MFEMMatrixCoefficientName, string);
1165 : #endif
1166 :
1167 : // map types
1168 5750 : setmap(string, unsigned int);
1169 5750 : setmap(string, Real);
1170 5694 : setmap(string, string);
1171 5340 : setmap(unsigned int, unsigned int);
1172 5320 : setmap(unsigned long, unsigned int);
1173 5300 : setmap(unsigned long long, unsigned int);
1174 :
1175 : // Double indexed types
1176 5280 : setvectorvector(Real);
1177 3382 : setvectorvector(int);
1178 3220 : setvectorvector(long);
1179 3208 : setvectorvector(unsigned int);
1180 2984 : setvectorvector(unsigned long long);
1181 :
1182 : // See vector type explanation
1183 : #if LIBMESH_DOF_ID_BYTES == 8
1184 2984 : setvectorvector(uint64_t);
1185 : #endif
1186 :
1187 2846 : setvectorvector(SubdomainID);
1188 2588 : setvectorvector(BoundaryID);
1189 2532 : setvectorvector(Point);
1190 2418 : setvectorvector(string);
1191 1901 : setvectorvector(FileName);
1192 1889 : setvectorvector(FileNameNoExtension);
1193 1877 : setvectorvector(DataFileName);
1194 1877 : setvectorvector(MeshFileName);
1195 1865 : setvectorvector(MatrixFileName);
1196 1865 : setvectorvector(SubdomainName);
1197 1629 : setvectorvector(BoundaryName);
1198 1561 : setvectorvector(VariableName);
1199 1561 : setvectorvector(NonlinearVariableName);
1200 1553 : setvectorvector(LinearVariableName);
1201 1553 : setvectorvector(SolverVariableName);
1202 1553 : setvectorvector(AuxVariableName);
1203 1553 : setvectorvector(FunctionName);
1204 1541 : setvectorvector(ConvergenceName);
1205 1541 : setvectorvector(UserObjectName);
1206 1529 : setvectorvector(IndicatorName);
1207 1517 : setvectorvector(MarkerName);
1208 1505 : setvectorvector(MultiAppName);
1209 1493 : setvectorvector(PostprocessorName);
1210 1481 : setvectorvector(VectorPostprocessorName);
1211 1469 : setvectorvector(MarkerName);
1212 1469 : setvectorvector(OutputName);
1213 1437 : setvectorvector(MaterialPropertyName);
1214 1425 : setvectorvector(MooseFunctorName);
1215 1369 : setvectorvector(MaterialName);
1216 1369 : setvectorvector(DistributionName);
1217 1369 : setvectorvector(SamplerName);
1218 1369 : setvectorvector(TagName);
1219 : #ifdef MFEM_ENABLED
1220 372 : setvectorvector(MFEMScalarCoefficientName);
1221 372 : setvectorvector(MFEMVectorCoefficientName);
1222 372 : setvectorvector(MFEMMatrixCoefficientName);
1223 : #endif
1224 :
1225 : // Triple indexed types
1226 576 : setvectorvectorvector(Real);
1227 424 : setvectorvectorvector(int);
1228 412 : setvectorvectorvector(long);
1229 400 : setvectorvectorvector(unsigned int);
1230 388 : setvectorvectorvector(unsigned long long);
1231 :
1232 : // See vector type explanation
1233 : #if LIBMESH_DOF_ID_BYTES == 8
1234 388 : setvectorvectorvector(uint64_t);
1235 : #endif
1236 :
1237 376 : setvectorvectorvector(SubdomainID);
1238 364 : setvectorvectorvector(BoundaryID);
1239 352 : setvectorvectorvector(string);
1240 216 : setvectorvectorvector(FileName);
1241 204 : setvectorvectorvector(FileNameNoExtension);
1242 192 : setvectorvectorvector(DataFileName);
1243 192 : setvectorvectorvector(MeshFileName);
1244 180 : setvectorvectorvector(MatrixFileName);
1245 180 : setvectorvectorvector(SubdomainName);
1246 168 : setvectorvectorvector(BoundaryName);
1247 156 : setvectorvectorvector(VariableName);
1248 156 : setvectorvectorvector(NonlinearVariableName);
1249 156 : setvectorvectorvector(LinearVariableName);
1250 156 : setvectorvectorvector(AuxVariableName);
1251 156 : setvectorvectorvector(FunctionName);
1252 144 : setvectorvectorvector(UserObjectName);
1253 132 : setvectorvectorvector(IndicatorName);
1254 120 : setvectorvectorvector(MarkerName);
1255 108 : setvectorvectorvector(MultiAppName);
1256 96 : setvectorvectorvector(PostprocessorName);
1257 84 : setvectorvectorvector(VectorPostprocessorName);
1258 72 : setvectorvectorvector(MarkerName);
1259 72 : setvectorvectorvector(OutputName);
1260 60 : setvectorvectorvector(MaterialPropertyName);
1261 48 : setvectorvectorvector(MooseFunctorName);
1262 36 : setvectorvectorvector(MaterialName);
1263 24 : setvectorvectorvector(DistributionName);
1264 12 : setvectorvectorvector(SamplerName);
1265 : else
1266 : {
1267 0 : mooseError("unsupported type '", par->type(), "' for input parameter '", full_name, "'");
1268 : }
1269 :
1270 : #undef setscalarValueType
1271 : #undef setscalar
1272 : #undef setvector
1273 : #undef setvectorvectorvector
1274 : #undef setvectorvector
1275 : #undef setmap
1276 2468083 : break;
1277 : }
1278 108618213 : }
1279 :
1280 52994702 : if (!found)
1281 : {
1282 : /**
1283 : * Special case handling
1284 : * if the parameter wasn't found in the input file or the cli object the logic in this
1285 : * branch will execute
1286 : */
1287 :
1288 : // In the case where we have OutFileName but it wasn't actually found in the input filename,
1289 : // we will populate it with the actual parsed filename which is available here in the
1290 : // parser.
1291 :
1292 : InputParameters::Parameter<OutFileBase> * scalar_p =
1293 50526545 : dynamic_cast<InputParameters::Parameter<OutFileBase> *>(MooseUtils::get(it.second));
1294 50526545 : if (scalar_p)
1295 : {
1296 0 : std::string input_file_name = getPrimaryFileName();
1297 : mooseAssert(input_file_name != "", "Input Filename is nullptr");
1298 0 : size_t pos = input_file_name.find_last_of('.');
1299 : mooseAssert(pos != std::string::npos, "Unable to determine suffix of input file name");
1300 0 : scalar_p->set() = input_file_name.substr(0, pos) + "_out";
1301 0 : p.set_attributes(it.first, false);
1302 0 : }
1303 : }
1304 : }
1305 :
1306 : // All of the parameters for this object have been extracted. See if there are any errors
1307 2107084 : if (!error_stream.str().empty())
1308 12 : mooseError(_errmsg + error_stream.str());
1309 :
1310 : // Here we will see if there are any auto build vectors that need to be created
1311 : std::map<std::string, std::pair<std::string, std::string>> auto_build_vectors =
1312 2107072 : p.getAutoBuildVectors();
1313 2107074 : for (const auto & it : auto_build_vectors)
1314 : {
1315 : // We'll autogenerate values iff the requested vector is not valid but both the base and
1316 : // number
1317 : // are valid
1318 2 : const std::string & base_name = it.second.first;
1319 2 : const std::string & num_repeat = it.second.second;
1320 :
1321 2 : if (!p.isParamValid(it.first) && p.isParamValid(base_name) && p.isParamValid(num_repeat))
1322 : {
1323 2 : unsigned int vec_size = p.get<unsigned int>(num_repeat);
1324 2 : const std::string & name = p.get<std::string>(base_name);
1325 :
1326 2 : std::vector<VariableName> variable_names(vec_size);
1327 6 : for (unsigned int i = 0; i < vec_size; ++i)
1328 : {
1329 4 : std::ostringstream oss;
1330 4 : oss << name << i;
1331 4 : variable_names[i] = oss.str();
1332 4 : }
1333 :
1334 : // Finally set the autogenerated vector into the InputParameters object
1335 2 : p.set<std::vector<VariableName>>(it.first) = variable_names;
1336 2 : }
1337 : }
1338 2107072 : }
1339 :
1340 : template <typename T>
1341 : bool
1342 0 : toBool(const std::string & /*s*/, T & /*val*/)
1343 : {
1344 0 : return false;
1345 : }
1346 :
1347 : template <>
1348 : bool
1349 68 : toBool<bool>(const std::string & s, bool & val)
1350 : {
1351 68 : return hit::toBool(s, &val);
1352 : }
1353 :
1354 : template <typename T, typename Base>
1355 : void
1356 1543583 : Builder::setScalarParameter(const std::string & full_name,
1357 : const std::string & short_name,
1358 : InputParameters::Parameter<T> * param,
1359 : bool in_global,
1360 : GlobalParamsAction * global_block)
1361 : {
1362 : try
1363 : {
1364 1543583 : param->set() = root()->param<Base>(full_name);
1365 : }
1366 6678 : catch (hit::Error & err)
1367 : {
1368 3339 : auto strval = root()->param<std::string>(full_name);
1369 :
1370 : // handle the case where the user put a number inside quotes
1371 3339 : auto & t = typeid(T);
1372 7721 : if (t == typeid(int) || t == typeid(unsigned int) || t == typeid(SubdomainID) ||
1373 7721 : t == typeid(BoundaryID) || t == typeid(double))
1374 : {
1375 : try
1376 : {
1377 3271 : param->set() = MooseUtils::convert<T>(strval, true);
1378 : }
1379 8 : catch (std::invalid_argument & /*e*/)
1380 : {
1381 4 : const std::string format_type = (t == typeid(double)) ? "float" : "integer";
1382 4 : _errmsg += hit::errormsg(root()->find(full_name),
1383 : "invalid ",
1384 : format_type,
1385 : " syntax for parameter: ",
1386 : full_name,
1387 : "=",
1388 : strval) +
1389 : "\n";
1390 4 : }
1391 : }
1392 68 : else if (t == typeid(bool))
1393 : {
1394 68 : bool isbool = toBool(strval, param->set());
1395 68 : if (!isbool)
1396 0 : _errmsg += hit::errormsg(root()->find(full_name),
1397 : "invalid boolean syntax for parameter: ",
1398 : full_name,
1399 : "=",
1400 : strval) +
1401 : "\n";
1402 : }
1403 : else
1404 0 : throw;
1405 3339 : }
1406 :
1407 1543583 : if (in_global)
1408 : {
1409 8585 : global_block->remove(short_name);
1410 8585 : global_block->setScalarParam<T>(short_name) = param->get();
1411 : }
1412 1543583 : }
1413 :
1414 : template <typename T, typename UP_T, typename Base>
1415 : void
1416 384591 : Builder::setScalarValueTypeParameter(const std::string & full_name,
1417 : const std::string & short_name,
1418 : InputParameters::Parameter<T> * param,
1419 : bool in_global,
1420 : GlobalParamsAction * global_block)
1421 : {
1422 384591 : setScalarParameter<T, Base>(full_name, short_name, param, in_global, global_block);
1423 :
1424 : // If this is a range checked param, we need to make sure that the value falls within the
1425 : // requested range
1426 : mooseAssert(_current_params, "Current params is nullptr");
1427 :
1428 384591 : _current_params->rangeCheck<T, UP_T>(full_name, short_name, param, *_current_error_stream);
1429 384591 : }
1430 :
1431 : template <typename T, typename Base>
1432 : void
1433 317854 : Builder::setVectorParameter(const std::string & full_name,
1434 : const std::string & short_name,
1435 : InputParameters::Parameter<std::vector<T>> * param,
1436 : bool in_global,
1437 : GlobalParamsAction * global_block)
1438 : {
1439 317854 : std::vector<T> vec;
1440 317854 : if (root()->find(full_name))
1441 : {
1442 : try
1443 : {
1444 317854 : auto tmp = root()->param<std::vector<Base>>(full_name);
1445 807569 : for (auto val : tmp)
1446 489715 : vec.push_back(val);
1447 317854 : }
1448 0 : catch (hit::Error & err)
1449 : {
1450 0 : _errmsg += hit::errormsg(root()->find(full_name), err.what()) + "\n";
1451 0 : return;
1452 : }
1453 : }
1454 :
1455 317854 : param->set() = vec;
1456 :
1457 317854 : if (in_global)
1458 : {
1459 1714 : global_block->remove(short_name);
1460 1714 : global_block->setVectorParam<T>(short_name).resize(param->get().size());
1461 3962 : for (unsigned int i = 0; i < vec.size(); ++i)
1462 2248 : global_block->setVectorParam<T>(short_name)[i] = param->get()[i];
1463 : }
1464 317854 : }
1465 :
1466 : template <typename KeyType, typename MappedType>
1467 : void
1468 470 : Builder::setMapParameter(const std::string & full_name,
1469 : const std::string & short_name,
1470 : InputParameters::Parameter<std::map<KeyType, MappedType>> * param,
1471 : bool in_global,
1472 : GlobalParamsAction * global_block)
1473 : {
1474 470 : std::map<KeyType, MappedType> the_map;
1475 470 : if (root()->find(full_name))
1476 : {
1477 : try
1478 : {
1479 470 : const auto & string_vec = root()->param<std::vector<std::string>>(full_name);
1480 470 : auto it = string_vec.begin();
1481 2402 : while (it != string_vec.end())
1482 : {
1483 1032 : const auto & string_key = *it;
1484 1032 : ++it;
1485 1032 : if (it == string_vec.end())
1486 : {
1487 4 : _errmsg +=
1488 : hit::errormsg(root()->find(full_name),
1489 : "odd number of entries in string vector for map parameter: ",
1490 : full_name,
1491 : ". There must be "
1492 : "an even number or else you will end up with a key without a value!") +
1493 : "\n";
1494 8 : return;
1495 : }
1496 1028 : const auto & string_value = *it;
1497 1028 : ++it;
1498 :
1499 1028 : std::pair<KeyType, MappedType> pr;
1500 : // key
1501 : try
1502 : {
1503 1028 : pr.first = MooseUtils::convert<KeyType>(string_key, true);
1504 : }
1505 0 : catch (std::invalid_argument & /*e*/)
1506 : {
1507 0 : _errmsg += hit::errormsg(root()->find(full_name),
1508 : "invalid ",
1509 : demangle(typeid(KeyType).name()),
1510 : " syntax for map parameter ",
1511 : full_name,
1512 : " key: ",
1513 : string_key) +
1514 : "\n";
1515 0 : return;
1516 : }
1517 : // value
1518 : try
1519 : {
1520 1028 : pr.second = MooseUtils::convert<MappedType>(string_value, true);
1521 : }
1522 4 : catch (std::invalid_argument & /*e*/)
1523 : {
1524 4 : _errmsg += hit::errormsg(root()->find(full_name),
1525 : "invalid ",
1526 : demangle(typeid(MappedType).name()),
1527 : " syntax for map parameter ",
1528 : full_name,
1529 : " value: ",
1530 : string_value) +
1531 : "\n";
1532 4 : return;
1533 : }
1534 :
1535 1024 : auto insert_pr = the_map.insert(std::move(pr));
1536 1024 : if (!insert_pr.second)
1537 : {
1538 0 : _errmsg += hit::errormsg(root()->find(full_name),
1539 : "Duplicate map entry for map parameter: ",
1540 : full_name,
1541 : ". The key ",
1542 : string_key,
1543 : " appears multiple times.") +
1544 : "\n";
1545 0 : return;
1546 : }
1547 : }
1548 470 : }
1549 0 : catch (hit::Error & err)
1550 : {
1551 0 : _errmsg += hit::errormsg(root()->find(full_name), err.what()) + "\n";
1552 0 : return;
1553 : }
1554 : }
1555 :
1556 462 : param->set() = the_map;
1557 :
1558 462 : if (in_global)
1559 : {
1560 0 : global_block->remove(short_name);
1561 0 : auto & global_map = global_block->setParam<std::map<KeyType, MappedType>>(short_name);
1562 0 : for (const auto & pair : the_map)
1563 0 : global_map.insert(pair);
1564 : }
1565 470 : }
1566 :
1567 : template <typename T>
1568 : void
1569 4590 : Builder::setDoubleIndexParameter(const std::string & full_name,
1570 : const std::string & short_name,
1571 : InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1572 : bool in_global,
1573 : GlobalParamsAction * global_block)
1574 : {
1575 4590 : auto & value = param->set();
1576 :
1577 : // Get the full string assigned to the variable full_name
1578 4590 : const auto value_string = MooseUtils::trim(root()->param<std::string>(full_name));
1579 :
1580 : // split vector at delim ;
1581 : // NOTE: the substrings are _not_ of type T yet
1582 : // The zero length here is intentional, as we want something like:
1583 : // "abc; 123;" -> ["abc", "123", ""]
1584 4590 : std::vector<std::string> outer_string_vectors;
1585 : // With split, we will get a single entry if the string value is empty. However,
1586 : // that should represent an empty vector<vector>. Therefore, only split if we have values.
1587 4590 : if (!value_string.empty())
1588 4570 : outer_string_vectors = MooseUtils::split(value_string, ";");
1589 :
1590 4590 : const auto outer_vector_size = outer_string_vectors.size();
1591 4590 : value.resize(outer_vector_size);
1592 :
1593 12905 : for (const auto j : index_range(outer_string_vectors))
1594 8315 : if (!MooseUtils::tokenizeAndConvert<T>(outer_string_vectors[j], value[j]))
1595 : {
1596 0 : _errmsg +=
1597 : hit::errormsg(root()->find(full_name), "invalid format for parameter ", full_name) + "\n";
1598 0 : return;
1599 : }
1600 :
1601 4590 : if (in_global)
1602 : {
1603 0 : global_block->remove(short_name);
1604 0 : global_block->setDoubleIndexParam<T>(short_name).resize(outer_vector_size);
1605 0 : for (const auto j : make_range(outer_vector_size))
1606 : {
1607 0 : global_block->setDoubleIndexParam<T>(short_name)[j].resize(value[j].size());
1608 0 : for (const auto i : index_range(value[j]))
1609 0 : global_block->setDoubleIndexParam<T>(short_name)[j][i] = value[j][i];
1610 : }
1611 : }
1612 4590 : }
1613 :
1614 : template <typename T>
1615 : void
1616 576 : Builder::setTripleIndexParameter(
1617 : const std::string & full_name,
1618 : const std::string & short_name,
1619 : InputParameters::Parameter<std::vector<std::vector<std::vector<T>>>> * param,
1620 : bool in_global,
1621 : GlobalParamsAction * global_block)
1622 : {
1623 : // Get the full string assigned to the variable full_name
1624 576 : const std::string buffer_raw = root()->param<std::string>(full_name);
1625 : // In case the parameter is empty
1626 576 : if (buffer_raw.find_first_not_of(' ', 0) == std::string::npos)
1627 0 : return;
1628 :
1629 : // Add a space between neighboring delim's, before the first delim if nothing is ahead of it, and
1630 : // after the last delim if nothing is behind it.
1631 576 : std::string buffer;
1632 576 : buffer.push_back(buffer_raw[0]);
1633 576 : if (buffer[0] == '|' || buffer[0] == ';')
1634 36 : buffer = ' ' + buffer;
1635 72308 : for (std::string::size_type i = 1; i < buffer_raw.size(); i++)
1636 : {
1637 74338 : if ((buffer_raw[i - 1] == '|' || buffer_raw[i - 1] == ';') &&
1638 2606 : (buffer_raw[i] == '|' || buffer_raw[i] == ';'))
1639 84 : buffer.push_back(' ');
1640 71732 : buffer.push_back(buffer_raw[i]);
1641 : }
1642 576 : if (buffer.back() == '|' || buffer.back() == ';')
1643 16 : buffer.push_back(' ');
1644 :
1645 : // split vector at delim | to get a series of 2D subvectors
1646 576 : std::vector<std::string> first_tokenized_vector;
1647 576 : std::vector<std::vector<std::string>> second_tokenized_vector;
1648 576 : MooseUtils::tokenize(buffer, first_tokenized_vector, 1, "|");
1649 576 : param->set().resize(first_tokenized_vector.size());
1650 576 : second_tokenized_vector.resize(first_tokenized_vector.size());
1651 1924 : for (unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1652 : {
1653 : // Identify empty subvector first
1654 1348 : if (first_tokenized_vector[j].find_first_not_of(' ', 0) == std::string::npos)
1655 : {
1656 76 : param->set()[j].resize(0);
1657 76 : continue;
1658 : }
1659 : // split each 2D subvector at delim ; to get 1D sub-subvectors
1660 : // NOTE: the 1D sub-subvectors are _not_ of type T yet
1661 1272 : MooseUtils::tokenize(first_tokenized_vector[j], second_tokenized_vector[j], 1, ";");
1662 1272 : param->set()[j].resize(second_tokenized_vector[j].size());
1663 4394 : for (unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1664 3122 : if (!MooseUtils::tokenizeAndConvert<T>(second_tokenized_vector[j][k], param->set()[j][k]))
1665 : {
1666 0 : _errmsg +=
1667 : hit::errormsg(root()->find(full_name), "invalid format for parameter ", full_name) +
1668 : "\n";
1669 0 : return;
1670 : }
1671 : }
1672 :
1673 576 : if (in_global)
1674 : {
1675 12 : global_block->remove(short_name);
1676 12 : global_block->setTripleIndexParam<T>(short_name).resize(first_tokenized_vector.size());
1677 48 : for (unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1678 : {
1679 36 : global_block->setTripleIndexParam<T>(short_name)[j].resize(second_tokenized_vector[j].size());
1680 120 : for (unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1681 : {
1682 84 : global_block->setTripleIndexParam<T>(short_name)[j][k].resize(param->get()[j][k].size());
1683 252 : for (unsigned int i = 0; i < param->get()[j][k].size(); ++i)
1684 168 : global_block->setTripleIndexParam<T>(short_name)[j][k][i] = param->get()[j][k][i];
1685 : }
1686 : }
1687 : }
1688 576 : }
1689 :
1690 : template <typename T>
1691 : void
1692 25856 : Builder::setScalarComponentParameter(const std::string & full_name,
1693 : const std::string & short_name,
1694 : InputParameters::Parameter<T> * param,
1695 : bool in_global,
1696 : GlobalParamsAction * global_block)
1697 : {
1698 25856 : std::vector<double> vec;
1699 : try
1700 : {
1701 25856 : vec = root()->param<std::vector<double>>(full_name);
1702 : }
1703 0 : catch (hit::Error & err)
1704 : {
1705 0 : _errmsg += hit::errormsg(root()->find(full_name), err.what()) + "\n";
1706 0 : return;
1707 : }
1708 :
1709 25856 : if (vec.size() != LIBMESH_DIM)
1710 : {
1711 0 : _errmsg += hit::errormsg(root()->find(full_name),
1712 : "wrong number of values in scalar component parameter ",
1713 : full_name,
1714 : ": ",
1715 : short_name,
1716 : " was given ",
1717 : vec.size(),
1718 : " components but should have ",
1719 : LIBMESH_DIM) +
1720 : "\n";
1721 0 : return;
1722 : }
1723 :
1724 25856 : T value;
1725 103424 : for (unsigned int i = 0; i < vec.size(); ++i)
1726 77568 : value(i) = Real(vec[i]);
1727 :
1728 25856 : param->set() = value;
1729 25856 : if (in_global)
1730 : {
1731 0 : global_block->remove(short_name);
1732 0 : global_block->setScalarParam<T>(short_name) = value;
1733 : }
1734 25856 : }
1735 :
1736 : template <typename T>
1737 : void
1738 8086 : Builder::setVectorComponentParameter(const std::string & full_name,
1739 : const std::string & short_name,
1740 : InputParameters::Parameter<std::vector<T>> * param,
1741 : bool in_global,
1742 : GlobalParamsAction * global_block)
1743 : {
1744 8086 : std::vector<double> vec;
1745 : try
1746 : {
1747 8086 : vec = root()->param<std::vector<double>>(full_name);
1748 : }
1749 0 : catch (hit::Error & err)
1750 : {
1751 0 : _errmsg += hit::errormsg(root()->find(full_name), err.what()) + "\n";
1752 0 : return;
1753 : }
1754 :
1755 8086 : if (vec.size() % LIBMESH_DIM)
1756 : {
1757 4 : _errmsg += hit::errormsg(root()->find(full_name),
1758 : "wrong number of values in vector component parameter ",
1759 : full_name,
1760 : ": size ",
1761 : vec.size(),
1762 : " is not a multiple of ",
1763 : LIBMESH_DIM) +
1764 : "\n";
1765 4 : return;
1766 : }
1767 :
1768 8082 : std::vector<T> values;
1769 28241 : for (unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1770 : {
1771 20159 : T value;
1772 80636 : for (int j = 0; j < LIBMESH_DIM; ++j)
1773 60477 : value(j) = Real(vec[i * LIBMESH_DIM + j]);
1774 20159 : values.push_back(value);
1775 : }
1776 :
1777 8082 : param->set() = values;
1778 :
1779 8082 : if (in_global)
1780 : {
1781 0 : global_block->remove(short_name);
1782 0 : global_block->setVectorParam<T>(short_name).resize(vec.size(), values[0]);
1783 0 : for (unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1784 0 : global_block->setVectorParam<T>(short_name)[i] = values[0];
1785 : }
1786 8086 : }
1787 :
1788 : template <typename T>
1789 : void
1790 114 : Builder::setVectorVectorComponentParameter(
1791 : const std::string & full_name,
1792 : const std::string & short_name,
1793 : InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1794 : bool in_global,
1795 : GlobalParamsAction * global_block)
1796 : {
1797 : // Get the full string assigned to the variable full_name
1798 114 : std::string buffer = root()->param<std::string>(full_name);
1799 :
1800 : // split vector at delim ;
1801 : // NOTE: the substrings are _not_ of type T yet
1802 114 : std::vector<std::string> first_tokenized_vector;
1803 114 : MooseUtils::tokenize(buffer, first_tokenized_vector, 1, ";");
1804 114 : param->set().resize(first_tokenized_vector.size());
1805 :
1806 : // get a vector<vector<double>> first
1807 114 : std::vector<std::vector<double>> vecvec(first_tokenized_vector.size());
1808 342 : for (unsigned j = 0; j < vecvec.size(); ++j)
1809 228 : if (!MooseUtils::tokenizeAndConvert<double>(first_tokenized_vector[j], vecvec[j]))
1810 : {
1811 0 : _errmsg +=
1812 : hit::errormsg(root()->find(full_name), "invalid format for parameter ", full_name) + "\n";
1813 0 : return;
1814 : }
1815 :
1816 342 : for (const auto & vec : vecvec)
1817 228 : if (vec.size() % LIBMESH_DIM)
1818 : {
1819 0 : _errmsg +=
1820 : hit::errormsg(root()->find(full_name),
1821 : "wrong number of values in double-indexed vector component parameter ",
1822 : full_name,
1823 : ": size of subcomponent ",
1824 : vec.size(),
1825 : " is not a multiple of ",
1826 : LIBMESH_DIM) +
1827 : "\n";
1828 0 : return;
1829 : }
1830 :
1831 : // convert vector<vector<double>> to vector<vector<T>>
1832 114 : std::vector<std::vector<T>> values(vecvec.size());
1833 342 : for (unsigned int id_vec = 0; id_vec < vecvec.size(); ++id_vec)
1834 798 : for (unsigned int i = 0; i < vecvec[id_vec].size() / LIBMESH_DIM; ++i)
1835 : {
1836 570 : T value;
1837 2280 : for (int j = 0; j < LIBMESH_DIM; ++j)
1838 1710 : value(j) = Real(vecvec[id_vec][i * LIBMESH_DIM + j]);
1839 570 : values[id_vec].push_back(value);
1840 : }
1841 :
1842 114 : param->set() = values;
1843 :
1844 114 : if (in_global)
1845 : {
1846 114 : global_block->remove(short_name);
1847 114 : global_block->setDoubleIndexParam<T>(short_name).resize(vecvec.size());
1848 342 : for (unsigned j = 0; j < vecvec.size(); ++j)
1849 : {
1850 228 : global_block->setDoubleIndexParam<T>(short_name)[j].resize(param->get()[j].size() /
1851 : LIBMESH_DIM);
1852 342 : for (unsigned int i = 0; i < param->get()[j].size() / LIBMESH_DIM; ++i)
1853 114 : global_block->setDoubleIndexParam<T>(short_name)[j][i] = values[j][i];
1854 : }
1855 : }
1856 114 : }
1857 :
1858 : template <>
1859 : void
1860 18439 : Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
1861 : const std::string & full_name,
1862 : const std::string & short_name,
1863 : InputParameters::Parameter<RealVectorValue> * param,
1864 : bool in_global,
1865 : GlobalParamsAction * global_block)
1866 : {
1867 18439 : setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1868 18439 : }
1869 :
1870 : template <>
1871 : void
1872 7417 : Builder::setScalarParameter<Point, Point>(const std::string & full_name,
1873 : const std::string & short_name,
1874 : InputParameters::Parameter<Point> * param,
1875 : bool in_global,
1876 : GlobalParamsAction * global_block)
1877 : {
1878 7417 : setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1879 7417 : }
1880 :
1881 : template <>
1882 : void
1883 1840 : Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
1884 : const std::string & full_name,
1885 : const std::string & short_name,
1886 : InputParameters::Parameter<RealEigenVector> * param,
1887 : bool in_global,
1888 : GlobalParamsAction * global_block)
1889 : {
1890 1840 : std::vector<double> vec;
1891 : try
1892 : {
1893 1840 : vec = root()->param<std::vector<double>>(full_name);
1894 : }
1895 0 : catch (hit::Error & err)
1896 : {
1897 0 : _errmsg += hit::errormsg(root()->find(full_name), err.what()) + "\n";
1898 0 : return;
1899 0 : }
1900 :
1901 1840 : RealEigenVector value(vec.size());
1902 5920 : for (unsigned int i = 0; i < vec.size(); ++i)
1903 4080 : value(i) = Real(vec[i]);
1904 :
1905 1840 : param->set() = value;
1906 1840 : if (in_global)
1907 : {
1908 0 : global_block->remove(short_name);
1909 0 : global_block->setScalarParam<RealEigenVector>(short_name) = value;
1910 : }
1911 1840 : }
1912 :
1913 : template <>
1914 : void
1915 137 : Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
1916 : const std::string & full_name,
1917 : const std::string & short_name,
1918 : InputParameters::Parameter<RealEigenMatrix> * param,
1919 : bool in_global,
1920 : GlobalParamsAction * global_block)
1921 : {
1922 : // Get the full string assigned to the variable full_name
1923 137 : std::string buffer = root()->param<std::string>(full_name);
1924 :
1925 : // split vector at delim ;
1926 : // NOTE: the substrings are _not_ of type T yet
1927 137 : std::vector<std::string> first_tokenized_vector;
1928 137 : MooseUtils::tokenize(buffer, first_tokenized_vector, 1, ";");
1929 :
1930 137 : std::vector<std::vector<Real>> values(first_tokenized_vector.size());
1931 :
1932 411 : for (unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1933 : {
1934 274 : if (!MooseUtils::tokenizeAndConvert<Real>(first_tokenized_vector[j], values[j]))
1935 : {
1936 : _errmsg +=
1937 0 : hit::errormsg(root()->find(full_name), "invalid format for parameter ", full_name) + "\n";
1938 0 : return;
1939 : }
1940 274 : if (j != 0 && values[j].size() != values[0].size())
1941 : {
1942 : _errmsg +=
1943 0 : hit::errormsg(root()->find(full_name), "invalid format for parameter ", full_name) + "\n";
1944 0 : return;
1945 : }
1946 : }
1947 :
1948 137 : RealEigenMatrix value(values.size(), values[0].size());
1949 411 : for (unsigned int i = 0; i < values.size(); ++i)
1950 822 : for (unsigned int j = 0; j < values[i].size(); ++j)
1951 548 : value(i, j) = values[i][j];
1952 :
1953 137 : param->set() = value;
1954 137 : if (in_global)
1955 : {
1956 0 : global_block->remove(short_name);
1957 0 : global_block->setScalarParam<RealEigenMatrix>(short_name) = value;
1958 : }
1959 137 : }
1960 :
1961 : template <>
1962 : void
1963 395996 : Builder::setScalarParameter<MooseEnum, MooseEnum>(const std::string & full_name,
1964 : const std::string & short_name,
1965 : InputParameters::Parameter<MooseEnum> * param,
1966 : bool in_global,
1967 : GlobalParamsAction * global_block)
1968 : {
1969 395996 : MooseEnum current_param = param->get();
1970 :
1971 395996 : std::string value = root()->param<std::string>(full_name);
1972 :
1973 395996 : param->set() = value;
1974 395984 : if (in_global)
1975 : {
1976 44171 : global_block->remove(short_name);
1977 44171 : global_block->setScalarParam<MooseEnum>(short_name) = current_param;
1978 : }
1979 395984 : }
1980 :
1981 : template <>
1982 : void
1983 31480 : Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
1984 : const std::string & full_name,
1985 : const std::string & short_name,
1986 : InputParameters::Parameter<MultiMooseEnum> * param,
1987 : bool in_global,
1988 : GlobalParamsAction * global_block)
1989 : {
1990 31480 : MultiMooseEnum current_param = param->get();
1991 :
1992 31480 : auto vec = root()->param<std::vector<std::string>>(full_name);
1993 :
1994 31480 : std::string raw_values;
1995 91559 : for (unsigned int i = 0; i < vec.size(); ++i)
1996 60079 : raw_values += ' ' + vec[i];
1997 :
1998 31480 : param->set() = raw_values;
1999 :
2000 31480 : if (in_global)
2001 : {
2002 0 : global_block->remove(short_name);
2003 0 : global_block->setScalarParam<MultiMooseEnum>(short_name) = current_param;
2004 : }
2005 31480 : }
2006 :
2007 : template <>
2008 : void
2009 52531 : Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
2010 : const std::string & full_name,
2011 : const std::string & short_name,
2012 : InputParameters::Parameter<ExecFlagEnum> * param,
2013 : bool in_global,
2014 : GlobalParamsAction * global_block)
2015 : {
2016 52531 : ExecFlagEnum current_param = param->get();
2017 52531 : auto vec = root()->param<std::vector<std::string>>(full_name);
2018 :
2019 52531 : std::string raw_values;
2020 121324 : for (unsigned int i = 0; i < vec.size(); ++i)
2021 68793 : raw_values += ' ' + vec[i];
2022 :
2023 52531 : param->set() = raw_values;
2024 :
2025 52531 : if (in_global)
2026 : {
2027 110 : global_block->remove(short_name);
2028 110 : global_block->setScalarParam<ExecFlagEnum>(short_name) = current_param;
2029 : }
2030 52531 : }
2031 :
2032 : template <>
2033 : void
2034 36 : Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
2035 : const std::string & full_name,
2036 : const std::string & short_name,
2037 : InputParameters::Parameter<RealTensorValue> * param,
2038 : bool in_global,
2039 : GlobalParamsAction * global_block)
2040 : {
2041 36 : auto vec = root()->param<std::vector<double>>(full_name);
2042 36 : if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
2043 : {
2044 0 : _errmsg += hit::errormsg(root()->find(full_name),
2045 : "invalid RealTensorValue parameter ",
2046 : full_name,
2047 : ": size is ",
2048 : vec.size(),
2049 : " but should be ",
2050 0 : LIBMESH_DIM * LIBMESH_DIM) +
2051 0 : "\n";
2052 0 : return;
2053 : }
2054 :
2055 36 : RealTensorValue value;
2056 144 : for (int i = 0; i < LIBMESH_DIM; ++i)
2057 432 : for (int j = 0; j < LIBMESH_DIM; ++j)
2058 324 : value(i, j) = Real(vec[i * LIBMESH_DIM + j]);
2059 :
2060 36 : param->set() = value;
2061 36 : if (in_global)
2062 : {
2063 0 : global_block->remove(short_name);
2064 0 : global_block->setScalarParam<RealTensorValue>(short_name) = value;
2065 : }
2066 36 : }
2067 :
2068 : // Specialization for coupling a Real value where a postprocessor would be needed in MOOSE
2069 : template <>
2070 : void
2071 7531 : Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
2072 : const std::string & full_name,
2073 : const std::string & short_name,
2074 : InputParameters::Parameter<PostprocessorName> * param,
2075 : bool in_global,
2076 : GlobalParamsAction * global_block)
2077 : {
2078 7531 : PostprocessorName pps_name = root()->param<std::string>(full_name);
2079 7531 : param->set() = pps_name;
2080 :
2081 7531 : if (in_global)
2082 : {
2083 0 : global_block->remove(short_name);
2084 0 : global_block->setScalarParam<PostprocessorName>(short_name) = pps_name;
2085 : }
2086 7531 : }
2087 :
2088 : template <>
2089 : void
2090 888 : Builder::setScalarParameter<ReporterName, std::string>(
2091 : const std::string & full_name,
2092 : const std::string & /*short_name*/,
2093 : InputParameters::Parameter<ReporterName> * param,
2094 : bool /*in_global*/,
2095 : GlobalParamsAction * /*global_block*/)
2096 : {
2097 : std::vector<std::string> names =
2098 888 : MooseUtils::rsplit(root()->param<std::string>(full_name), "/", 2);
2099 888 : if (names.size() != 2)
2100 8 : _errmsg += hit::errormsg(root()->find(full_name),
2101 : "The supplied name ReporterName '",
2102 : full_name,
2103 4 : "' must contain the '/' delimiter.");
2104 : else
2105 884 : param->set() = ReporterName(names[0], names[1]);
2106 888 : }
2107 :
2108 : template <>
2109 : void
2110 54 : Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
2111 : const std::string & full_name,
2112 : const std::string & short_name,
2113 : InputParameters::Parameter<std::vector<RealVectorValue>> * param,
2114 : bool in_global,
2115 : GlobalParamsAction * global_block)
2116 : {
2117 54 : setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2118 54 : }
2119 :
2120 : template <>
2121 : void
2122 8032 : Builder::setVectorParameter<Point, Point>(const std::string & full_name,
2123 : const std::string & short_name,
2124 : InputParameters::Parameter<std::vector<Point>> * param,
2125 : bool in_global,
2126 : GlobalParamsAction * global_block)
2127 : {
2128 8032 : setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2129 8032 : }
2130 :
2131 : template <>
2132 : void
2133 48 : Builder::setVectorParameter<MooseEnum, MooseEnum>(
2134 : const std::string & full_name,
2135 : const std::string & short_name,
2136 : InputParameters::Parameter<std::vector<MooseEnum>> * param,
2137 : bool in_global,
2138 : GlobalParamsAction * global_block)
2139 : {
2140 48 : std::vector<MooseEnum> enum_values = param->get();
2141 48 : std::vector<std::string> values(enum_values.size());
2142 96 : for (unsigned int i = 0; i < values.size(); ++i)
2143 48 : values[i] = static_cast<std::string>(enum_values[i]);
2144 :
2145 : /**
2146 : * With MOOSE Enums we need a default object so it should have been passed in the param pointer.
2147 : * We are only going to use the first item in the vector (values[0]) and ignore the rest.
2148 : */
2149 48 : std::vector<std::string> vec;
2150 48 : if (root()->find(full_name))
2151 : {
2152 48 : vec = root()->param<std::vector<std::string>>(full_name);
2153 48 : param->set().resize(vec.size(), enum_values[0]);
2154 : }
2155 :
2156 144 : for (unsigned int i = 0; i < vec.size(); ++i)
2157 96 : param->set()[i] = vec[i];
2158 :
2159 48 : if (in_global)
2160 : {
2161 0 : global_block->remove(short_name);
2162 0 : global_block->setVectorParam<MooseEnum>(short_name).resize(vec.size(), enum_values[0]);
2163 0 : for (unsigned int i = 0; i < vec.size(); ++i)
2164 0 : global_block->setVectorParam<MooseEnum>(short_name)[i] = values[0];
2165 : }
2166 48 : }
2167 :
2168 : template <>
2169 : void
2170 18 : Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
2171 : const std::string & full_name,
2172 : const std::string & short_name,
2173 : InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
2174 : bool in_global,
2175 : GlobalParamsAction * global_block)
2176 : {
2177 18 : const std::vector<MultiMooseEnum> & enum_values = param->get();
2178 :
2179 : // Get the full string assigned to the variable full_name
2180 18 : std::string buffer = root()->param<std::string>(full_name);
2181 :
2182 18 : std::vector<std::string> first_tokenized_vector = MooseUtils::split(buffer, ";");
2183 86 : for (const auto & i : first_tokenized_vector)
2184 72 : if (MooseUtils::trim(i) == "")
2185 4 : mooseError("In " + full_name + ", one entry in the vector is empty. This is not allowed.");
2186 :
2187 14 : param->set().resize(first_tokenized_vector.size(), enum_values[0]);
2188 :
2189 14 : std::vector<std::vector<std::string>> vecvec(first_tokenized_vector.size());
2190 74 : for (const auto i : index_range(vecvec))
2191 : {
2192 64 : MooseUtils::tokenize<std::string>(first_tokenized_vector[i], vecvec[i], 1, " ");
2193 64 : param->set()[i] = vecvec[i];
2194 : }
2195 :
2196 10 : if (in_global)
2197 : {
2198 0 : global_block->remove(short_name);
2199 0 : global_block->setVectorParam<MultiMooseEnum>(short_name).resize(vecvec.size(), enum_values[0]);
2200 0 : for (unsigned int i = 0; i < vecvec.size(); ++i)
2201 0 : global_block->setVectorParam<MultiMooseEnum>(short_name)[i] = vecvec[i];
2202 : }
2203 10 : }
2204 :
2205 : template <>
2206 : void
2207 2170 : Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
2208 : const std::string & full_name,
2209 : const std::string & short_name,
2210 : InputParameters::Parameter<std::vector<PostprocessorName>> * param,
2211 : bool in_global,
2212 : GlobalParamsAction * global_block)
2213 : {
2214 2170 : std::vector<std::string> pps_names = root()->param<std::vector<std::string>>(full_name);
2215 2170 : unsigned int n = pps_names.size();
2216 2170 : param->set().resize(n);
2217 :
2218 5403 : for (unsigned int j = 0; j < n; ++j)
2219 3233 : param->set()[j] = pps_names[j];
2220 :
2221 2170 : if (in_global)
2222 : {
2223 0 : global_block->remove(short_name);
2224 0 : global_block->setVectorParam<PostprocessorName>(short_name).resize(n, "");
2225 0 : for (unsigned int j = 0; j < n; ++j)
2226 0 : global_block->setVectorParam<PostprocessorName>(short_name)[j] = pps_names[j];
2227 : }
2228 2170 : }
2229 :
2230 : /**
2231 : * Specialization for coupling vectors. This routine handles default values and auto generated
2232 : * VariableValue vectors.
2233 : */
2234 : template <>
2235 : void
2236 71457 : Builder::setVectorParameter<VariableName, VariableName>(
2237 : const std::string & full_name,
2238 : const std::string & short_name,
2239 : InputParameters::Parameter<std::vector<VariableName>> * param,
2240 : bool /*in_global*/,
2241 : GlobalParamsAction * /*global_block*/)
2242 : {
2243 71457 : auto vec = root()->param<std::vector<std::string>>(full_name);
2244 71457 : auto strval = root()->param<std::string>(full_name);
2245 71457 : std::vector<VariableName> var_names(vec.size());
2246 :
2247 71457 : bool has_var_names = false;
2248 151749 : for (unsigned int i = 0; i < vec.size(); ++i)
2249 : {
2250 80292 : VariableName var_name = vec[i];
2251 :
2252 : Real real_value;
2253 80292 : std::istringstream ss(var_name);
2254 :
2255 : // If we are able to convert this value into a Real, then set a default coupled value
2256 : // NOTE: parameter must be either all default or no defaults
2257 80292 : if (ss >> real_value && ss.eof())
2258 921 : _current_params->defaultCoupledValue(short_name, real_value, i);
2259 : else
2260 : {
2261 79371 : var_names[i] = var_name;
2262 79371 : has_var_names = true;
2263 : }
2264 80292 : }
2265 :
2266 71457 : if (has_var_names)
2267 : {
2268 71026 : param->set().resize(vec.size());
2269 :
2270 150393 : for (unsigned int i = 0; i < vec.size(); ++i)
2271 79371 : if (var_names[i] == "")
2272 : {
2273 8 : _errmsg += hit::errormsg(root()->find(full_name),
2274 : "invalid value for ",
2275 : full_name,
2276 : ":\n"
2277 : " MOOSE does not currently support a coupled vector where "
2278 : "some parameters are ",
2279 8 : "reals and others are variables") +
2280 4 : "\n";
2281 4 : return;
2282 : }
2283 : else
2284 79367 : param->set()[i] = var_names[i];
2285 : }
2286 71465 : }
2287 :
2288 : template <>
2289 : void
2290 1099 : Builder::setVectorParameter<ReporterName, std::string>(
2291 : const std::string & full_name,
2292 : const std::string & /*short_name*/,
2293 : InputParameters::Parameter<std::vector<ReporterName>> * param,
2294 : bool /*in_global*/,
2295 : GlobalParamsAction * /*global_block*/)
2296 : {
2297 1099 : auto rnames = root()->param<std::vector<std::string>>(full_name);
2298 1099 : param->set().resize(rnames.size());
2299 :
2300 3113 : for (unsigned int i = 0; i < rnames.size(); ++i)
2301 : {
2302 2014 : std::vector<std::string> names = MooseUtils::rsplit(rnames[i], "/", 2);
2303 2014 : if (names.size() != 2)
2304 0 : _errmsg += hit::errormsg(root()->find(full_name),
2305 : "The supplied name ReporterName '",
2306 0 : rnames[i],
2307 0 : "' must contain the '/' delimiter.");
2308 : else
2309 2014 : param->set()[i] = ReporterName(names[0], names[1]);
2310 2014 : }
2311 1099 : }
2312 :
2313 : template <>
2314 : void
2315 1743 : Builder::setVectorParameter<CLIArgString, std::string>(
2316 : const std::string & full_name,
2317 : const std::string & /*short_name*/,
2318 : InputParameters::Parameter<std::vector<CLIArgString>> * param,
2319 : bool /*in_global*/,
2320 : GlobalParamsAction * /*global_block*/)
2321 : {
2322 : // Parsed as a vector of string, the vectors parameters are being cut
2323 1743 : auto rnames = root()->param<std::vector<std::string>>(full_name);
2324 1743 : param->set().resize(rnames.size()); // slightly oversized if vectors have been split
2325 :
2326 : // Skip empty parameter
2327 1743 : if (rnames.empty())
2328 4 : return;
2329 :
2330 : // Re-assemble vector parameters
2331 1739 : unsigned int i_param = 0;
2332 1739 : bool vector_param_detected = false;
2333 4826 : for (unsigned int i = 0; i < rnames.size(); ++i)
2334 : {
2335 : // Look for a quote, both types
2336 : std::vector<std::string> double_split =
2337 3087 : MooseUtils::rsplit(rnames[i], "\"", std::numeric_limits<std::size_t>::max());
2338 : std::vector<std::string> single_split =
2339 3087 : MooseUtils::rsplit(rnames[i], "\'", std::numeric_limits<std::size_t>::max());
2340 3087 : if (double_split.size() + single_split.size() >= 3)
2341 : // Either entering or exiting a vector parameter (>3 is entering another vector)
2342 : // Even and >2 number of quotes means both finished and started another vector parameter
2343 1467 : if ((double_split.size() + single_split.size()) % 2 == 1)
2344 216 : vector_param_detected = !vector_param_detected;
2345 :
2346 : // We're building a vector parameters, just append the text, rebuild the spaces
2347 3087 : if (vector_param_detected)
2348 360 : param->set()[i_param] += rnames[i] + ' ';
2349 : else
2350 : {
2351 2727 : param->set()[i_param] += rnames[i];
2352 2727 : i_param++;
2353 : }
2354 3087 : }
2355 : // Use actual size after re-forming vector parameters
2356 1739 : param->set().resize(i_param);
2357 1743 : }
2358 :
2359 : template <>
2360 : void
2361 114 : Builder::setDoubleIndexParameter<Point>(
2362 : const std::string & full_name,
2363 : const std::string & short_name,
2364 : InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
2365 : bool in_global,
2366 : GlobalParamsAction * global_block)
2367 : {
2368 114 : setVectorVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2369 114 : }
2370 :
2371 : } // end of namespace Moose
|