41 #include "libmesh/parallel.h" 42 #include "libmesh/fparser.hh" 62 hit::Node * n = root->find(path);
65 hit::Node * section = n->parent();
68 auto actives = section->find(
"active");
69 auto inactives = section->find(
"inactive");
72 if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
74 auto vars = section->param<std::vector<std::string>>(
"active");
75 bool have_var =
false;
76 for (
auto & var : vars)
77 if (n->path() == hit::pathNorm(var))
83 if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
85 auto vars = section->param<std::vector<std::string>>(
"inactive");
86 for (
auto & var : vars)
87 if (n->path() == hit::pathNorm(var))
96 std::vector<std::string>
97 findSimilar(std::string param, std::vector<std::string> options)
99 std::vector<std::string> candidates;
100 if (options.size() == 0)
104 for (
auto & opt : options)
108 int dist_cutoff = 1 + param.size() / 5;
109 if (dist > dist_cutoff || dist > mindist)
117 candidates.push_back(opt);
125 _factory(app.getFactory()),
126 _action_wh(action_wh),
127 _action_factory(app.getActionFactory()),
128 _syntax(_action_wh.syntax()),
130 _syntax_formatter(nullptr),
131 _sections_read(false),
132 _current_params(nullptr),
133 _current_error_stream(nullptr)
135 mooseAssert(
_parser,
"Parser is not set");
149 params.
addParam<std::vector<std::string>>(
151 std::vector<std::string>({
"__all__"}),
152 "If specified only the blocks named will be visited and made active");
153 params.
addParam<std::vector<std::string>>(
155 std::vector<std::string>(),
156 "If specified blocks matching these identifiers will be skipped.");
161 std::vector<std::string>
168 std::vector<std::string> paramlist;
169 for (
auto it = iters.first; it != iters.second; ++it)
172 for (
const auto & it : params)
173 paramlist.push_back(it.first);
184 if (!
_used.count(fullpath) && nodename !=
"active" && nodename !=
"inactive" &&
187 auto section_name = fullpath.substr(0, fullpath.rfind(
"/"));
189 auto candidates =
findSimilar(nodename, paramlist);
190 if (candidates.size() > 0)
191 errors.push_back(hit::errormsg(
192 n,
"unused parameter '", fullpath,
"'\n",
" Did you mean '", candidates[0],
"'?"));
194 errors.push_back(hit::errormsg(n,
"unused parameter '", fullpath,
"'"));
201 const auto path =
_parser->getLastInputFilePath();
202 return (strip_leading_path ? path.filename() : std::filesystem::absolute(path)).
string();
211 std::string section_name = n->fullpath();
212 std::string curr_identifier = n->fullpath();
226 if (
const auto [begin, end] =
_syntax.
getActions(registered_identifier); begin == end)
231 "]' does not have an associated \"Action\".\n Common causes:\n" 232 "- you misspelled the Action/section name\n" 233 "- the app you are running does not support this Action/syntax") +
240 std::set<const Syntax::ActionInfo *> processed_actions;
246 for (; it != end && processed_actions.count(&it->second); ++it)
254 processed_actions.insert(&it->second);
269 params.
set<std::string>(
"task") = it->second._task;
270 params.
set<std::string>(
"registered_identifier") = registered_identifier;
272 if (!(params.
have_parameter<
bool>(
"isObjectAction") && params.
get<
bool>(
"isObjectAction")))
273 params.
set<std::vector<std::string>>(
"control_tags")
277 std::shared_ptr<Action> action_obj =
282 std::shared_ptr<MooseObjectAction> object_action =
289 object_params.set<std::vector<std::string>>(
"control_tags")
293 std::shared_ptr<AddActionComponentAction> component_action =
295 if (component_action)
300 component_params.set<std::vector<std::string>>(
"control_tags")
311 Builder::walk(
const std::string & fullpath,
const std::string & nodepath, hit::Node * n)
317 walkRaw(fullpath, nodepath, n);
323 mooseAssert(
_parser,
"Parser is not set");
334 _cli_root.reset(hit::parse(
"CLI_ARGS", cli_input));
338 catch (hit::ParseError &
err)
347 hit::ReplaceEvaler repl;
350 hit::BraceExpander exw;
351 exw.registerEvaler(
"raw", raw);
352 exw.registerEvaler(
"env", env);
353 exw.registerEvaler(
"fparse", fparse_ev);
354 exw.registerEvaler(
"replace", repl);
355 exw.registerEvaler(
"units", units_ev);
357 for (
auto & var : exw.used)
359 for (
auto & msg : exw.errors)
366 root()->walk(&dw, hit::NodeType::Field);
367 root()->walk(&bw, hit::NodeType::Section);
368 for (
auto & msg : dw.
errors)
370 for (
auto & msg : bw.
errors)
392 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
395 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
398 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
403 auto n =
root()->find(sec);
405 walkRaw(n->parent()->fullpath(), n->path(), n);
407 root()->walk(
this, hit::NodeType::Section);
435 for (
const auto & arg : cli->unusedHitParams(comm))
437 hit::errormsg(
"CLI_ARG",
nullptr,
"unused command line parameter '", arg,
"'") +
"\n";
438 for (
auto & msg : uwcli.
errors)
440 for (
auto & msg : uw.
errors)
445 for (
const auto & arg : cli->unusedHitParams(comm))
447 hit::errormsg(
"CLI_ARG",
nullptr,
"unused command line parameter '", arg,
"'") +
"\n";
448 for (
auto & msg : uwcli.
errors)
450 for (
auto & msg : uw.
errors)
459 "\n\nAppend --allow-unused (or -w) on the command line to ignore unused parameters.");
474 mooseError(
"Unrecognized Syntax Formatter requested");
482 std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
485 root.addSyntaxType(iter.first, iter.second);
496 if (act_info.
_task ==
"")
499 all_names.push_back(std::make_pair(iter.first, act_info));
503 for (
const auto & act_names : all_names)
505 const auto & act_info = act_names.second;
506 const std::string & action = act_info._action;
507 const std::string & task = act_info._task;
508 const std::string syntax = act_names.first;
510 bool params_added =
root.addParameters(
"",
522 for (
auto & t : tasks)
525 root.addActionTask(syntax, action, t,
info);
535 action_obj_params.
get<
bool>(
"isObjectAction"))
539 auto moose_obj_params = obj->buildParameters();
543 const std::vector<std::string> & buildable_types = action_obj_params.
getBuildableTypes();
546 if ((buildable_types.empty() ||
547 std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
548 buildable_types.end()) &&
549 moose_obj_params.have_parameter<std::string>(
"_moose_base") &&
557 bool is_action_params =
false;
558 bool is_type =
false;
559 if (syntax[syntax.size() - 1] ==
'*')
564 name = syntax.substr(0, pos - 1) + moose_obj_name;
567 name = syntax.substr(0, pos - 1) +
"/<type>/" + moose_obj_name;
568 is_action_params =
true;
573 name = syntax +
"/<type>/" + moose_obj_name;
576 moose_obj_params.set<std::string>(
"type") = moose_obj_name;
580 root.addParameters(syntax,
593 if (syntax !=
"ActionComponents/*")
598 for (
auto it = iters.first; it != iters.second; ++it)
601 const auto component_name = it->second;
614 if (syntax[syntax.size() - 1] ==
'*')
616 size_t pos = syntax.size();
617 name = syntax.substr(0, pos - 1) + component_name;
619 component_params.set<std::string>(
"type") = component_name;
624 root.addParameters(syntax,
627 "AddActionComponentAction",
642 std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
652 if (act_info.
_task ==
"")
655 all_names.push_back(std::pair<std::string, Syntax::ActionInfo>(iter.first, act_info));
658 for (
const auto & act_names : all_names)
662 act_names.first, act_names.second._action,
true, &action_obj_params);
664 const std::string & task = act_names.second._task;
665 std::string act_name = act_names.first;
673 action_obj_params.
get<
bool>(
"isObjectAction"))
677 auto moose_obj_params = obj->buildParameters();
682 const std::vector<std::string> & buildable_types = action_obj_params.
getBuildableTypes();
685 if ((buildable_types.empty() ||
686 std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
687 buildable_types.end()) &&
688 moose_obj_params.have_parameter<std::string>(
"_moose_base") &&
696 bool is_action_params =
false;
697 if (act_name[act_name.size() - 1] ==
'*')
699 pos = act_name.size();
702 name = act_name.substr(0, pos - 1) + moose_obj_name;
705 name = act_name.substr(0, pos - 1) +
"/<type>/" + moose_obj_name;
706 is_action_params =
true;
711 name = act_name +
"/<type>/" + moose_obj_name;
714 moose_obj_params.set<std::string>(
"type") = moose_obj_name;
735 void Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
736 const std::string & full_name,
737 const std::string & short_name,
738 InputParameters::Parameter<RealVectorValue> * param,
743 void Builder::setScalarParameter<Point, Point>(
const std::string & full_name,
744 const std::string & short_name,
745 InputParameters::Parameter<Point> * param,
750 void Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
751 const std::string & full_name,
752 const std::string & short_name,
753 InputParameters::Parameter<RealEigenVector> * param,
758 void Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
759 const std::string & full_name,
760 const std::string & short_name,
761 InputParameters::Parameter<RealEigenMatrix> * param,
766 void Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
767 const std::string & full_name,
768 const std::string & short_name,
769 InputParameters::Parameter<PostprocessorName> * param,
775 Builder::setScalarParameter<MooseEnum, MooseEnum>(
const std::string & full_name,
776 const std::string & short_name,
777 InputParameters::Parameter<MooseEnum> * param,
782 void Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
783 const std::string & full_name,
784 const std::string & short_name,
785 InputParameters::Parameter<MultiMooseEnum> * param,
790 void Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
791 const std::string & full_name,
792 const std::string & short_name,
793 InputParameters::Parameter<ExecFlagEnum> * param,
798 void Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
799 const std::string & full_name,
800 const std::string & short_name,
801 InputParameters::Parameter<RealTensorValue> * param,
806 void Builder::setScalarParameter<ReporterName, std::string>(
807 const std::string & full_name,
808 const std::string & short_name,
809 InputParameters::Parameter<ReporterName> * param,
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,
824 Builder::setVectorParameter<Point, Point>(
const std::string & full_name,
825 const std::string & short_name,
826 InputParameters::Parameter<std::vector<Point>> * param,
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,
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,
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,
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,
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,
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,
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,
889 std::ostringstream error_stream;
890 static const std::string global_params_task =
"set_global_params";
891 static const std::string global_params_block_name =
899 global_params_block = dynamic_cast<GlobalParamsAction *>(*act_iter);
906 for (
const auto & it : p)
908 if (p.shouldIgnore(it.first))
912 bool in_global =
false;
914 for (
const auto & param_name : p.paramAliases(it.first))
916 std::string orig_name = prefix +
"/" + param_name;
917 std::string full_name = orig_name;
920 auto node =
root()->find(full_name);
921 if (node && node->type() == hit::NodeType::Field)
923 p.setHitNode(param_name, *node, {});
924 p.set_attributes(param_name,
false);
928 if (p.attemptPrintDeprecated(param_name))
935 else if (global_params_block)
937 full_name = global_params_block_name +
"/" + param_name;
938 node =
root()->find(full_name);
941 p.setHitNode(param_name, *node, {});
942 p.set_attributes(param_name,
false);
951 if (p.isPrivate(param_name) && !in_global)
954 "' is a private parameter and should not be used in an input file.");
956 else if (p.isPrivate(param_name) && in_global)
959 auto & short_name = param_name;
962 #define setscalarvaltype(ptype, base, range) \ 963 else if (par->type() == demangle(typeid(ptype).name())) \ 964 setScalarValueTypeParameter<ptype, range, base>( \ 967 dynamic_cast<InputParameters::Parameter<ptype> *>(par), \ 970 #define setscalar(ptype, base) \ 971 else if (par->type() == demangle(typeid(ptype).name())) \ 972 setScalarParameter<ptype, base>(full_name, \ 974 dynamic_cast<InputParameters::Parameter<ptype> *>(par), \ 977 #define setvector(ptype, base) \ 978 else if (par->type() == demangle(typeid(std::vector<ptype>).name())) \ 979 setVectorParameter<ptype, base>( \ 982 dynamic_cast<InputParameters::Parameter<std::vector<ptype>> *>(par), \ 985 #define setmap(key_type, mapped_type) \ 986 else if (par->type() == demangle(typeid(std::map<key_type, mapped_type>).name())) \ 990 dynamic_cast<InputParameters::Parameter<std::map<key_type, mapped_type>> *>(par), \ 993 #define setvectorvector(ptype) \ 994 else if (par->type() == demangle(typeid(std::vector<std::vector<ptype>>).name())) \ 995 setDoubleIndexParameter<ptype>( \ 998 dynamic_cast<InputParameters::Parameter<std::vector<std::vector<ptype>>> *>(par), \ 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>( \ 1007 InputParameters::Parameter<std::vector<std::vector<std::vector<ptype>>>> *>(par), \ 1009 global_params_block) 1018 setscalarvaltype(
Real,
double,
Real);
1019 setscalarvaltype(
int,
int,
long);
1020 setscalarvaltype(
unsigned short,
unsigned int,
long);
1021 setscalarvaltype(
long,
int,
long);
1022 setscalarvaltype(
unsigned int,
unsigned int,
long);
1023 setscalarvaltype(
unsigned long,
unsigned int,
long);
1024 setscalarvaltype(
long int, int64_t,
long);
1025 setscalarvaltype(
unsigned long long,
unsigned int,
long);
1027 setscalar(
bool,
bool);
1032 setscalar(
string,
string);
1033 setscalar(SubdomainName,
string);
1034 setscalar(BoundaryName,
string);
1035 setscalar(FileName,
string);
1036 setscalar(MeshFileName,
string);
1037 setscalar(MatrixFileName,
string);
1038 setscalar(FileNameNoExtension,
string);
1039 setscalar(RelativeFileName,
string);
1040 setscalar(DataFileName,
string);
1041 setscalar(ComponentName,
string);
1042 setscalar(PhysicsName,
string);
1043 setscalar(OutFileBase,
string);
1044 setscalar(VariableName,
string);
1045 setscalar(NonlinearVariableName,
string);
1046 setscalar(LinearVariableName,
string);
1047 setscalar(SolverVariableName,
string);
1048 setscalar(AuxVariableName,
string);
1049 setscalar(FunctionName,
string);
1050 setscalar(ConvergenceName,
string);
1051 setscalar(MeshDivisionName,
string);
1052 setscalar(UserObjectName,
string);
1053 setscalar(VectorPostprocessorName,
string);
1054 setscalar(IndicatorName,
string);
1055 setscalar(MarkerName,
string);
1056 setscalar(MultiAppName,
string);
1057 setscalar(OutputName,
string);
1058 setscalar(MaterialPropertyName,
string);
1059 setscalar(MooseFunctorName,
string);
1060 setscalar(MaterialName,
string);
1061 setscalar(DistributionName,
string);
1062 setscalar(PositionsName,
string);
1063 setscalar(SamplerName,
string);
1064 setscalar(TagName,
string);
1065 setscalar(TimesName,
string);
1066 setscalar(MeshGeneratorName,
string);
1067 setscalar(ExtraElementIDName,
string);
1068 setscalar(PostprocessorName, PostprocessorName);
1069 setscalar(ExecutorName,
string);
1070 setscalar(NonlinearSystemName,
string);
1071 setscalar(LinearSystemName,
string);
1072 setscalar(SolverSystemName,
string);
1073 setscalar(CLIArgString,
string);
1077 setscalar(Point, Point);
1085 setscalar(ReporterValueName,
string);
1086 setscalar(ParsedFunctionExpression,
string);
1089 setvector(
bool,
bool);
1090 setvector(
Real,
double);
1091 setvector(
int,
int);
1092 setvector(
long,
int);
1093 setvector(
unsigned int,
int);
1102 #if LIBMESH_DOF_ID_BYTES == 8 1103 setvector(uint64_t,
int);
1109 setvector(Point, Point);
1113 setvector(
string,
string);
1114 setvector(FileName,
string);
1115 setvector(FileNameNoExtension,
string);
1116 setvector(RelativeFileName,
string);
1117 setvector(DataFileName,
string);
1118 setvector(MeshFileName,
string);
1119 setvector(MatrixFileName,
string);
1120 setvector(SubdomainName,
string);
1121 setvector(BoundaryName,
string);
1122 setvector(NonlinearVariableName,
string);
1123 setvector(LinearVariableName,
string);
1124 setvector(SolverVariableName,
string);
1125 setvector(AuxVariableName,
string);
1126 setvector(FunctionName,
string);
1127 setvector(ConvergenceName,
string);
1128 setvector(MeshDivisionName,
string);
1129 setvector(UserObjectName,
string);
1130 setvector(IndicatorName,
string);
1131 setvector(MarkerName,
string);
1132 setvector(MultiAppName,
string);
1133 setvector(PostprocessorName, PostprocessorName);
1134 setvector(VectorPostprocessorName,
string);
1135 setvector(OutputName,
string);
1136 setvector(MaterialPropertyName,
string);
1137 setvector(MooseFunctorName,
string);
1138 setvector(MaterialName,
string);
1139 setvector(DistributionName,
string);
1140 setvector(SamplerName,
string);
1141 setvector(TagName,
string);
1142 setvector(VariableName, VariableName);
1143 setvector(MeshGeneratorName,
string);
1144 setvector(ExtraElementIDName,
string);
1146 setvector(CLIArgString,
string);
1147 setvector(ComponentName,
string);
1148 setvector(PhysicsName,
string);
1149 setvector(PositionsName,
string);
1150 setvector(TimesName,
string);
1151 setvector(ReporterValueName,
string);
1152 setvector(ExecutorName,
string);
1153 setvector(NonlinearSystemName,
string);
1154 setvector(LinearSystemName,
string);
1155 setvector(SolverSystemName,
string);
1158 setmap(
string,
unsigned int);
1159 setmap(
string,
Real);
1160 setmap(
string,
string);
1161 setmap(
unsigned int,
unsigned int);
1162 setmap(
unsigned long,
unsigned int);
1163 setmap(
unsigned long long,
unsigned int);
1166 setvectorvector(
Real);
1167 setvectorvector(
int);
1168 setvectorvector(
long);
1169 setvectorvector(
unsigned int);
1170 setvectorvector(
unsigned long long);
1173 #if LIBMESH_DOF_ID_BYTES == 8 1174 setvectorvector(uint64_t);
1179 setvectorvector(Point);
1180 setvectorvector(
string);
1181 setvectorvector(FileName);
1182 setvectorvector(FileNameNoExtension);
1183 setvectorvector(DataFileName);
1184 setvectorvector(MeshFileName);
1185 setvectorvector(MatrixFileName);
1186 setvectorvector(SubdomainName);
1187 setvectorvector(BoundaryName);
1188 setvectorvector(VariableName);
1189 setvectorvector(NonlinearVariableName);
1190 setvectorvector(LinearVariableName);
1191 setvectorvector(SolverVariableName);
1192 setvectorvector(AuxVariableName);
1193 setvectorvector(FunctionName);
1194 setvectorvector(ConvergenceName);
1195 setvectorvector(UserObjectName);
1196 setvectorvector(IndicatorName);
1197 setvectorvector(MarkerName);
1198 setvectorvector(MultiAppName);
1199 setvectorvector(PostprocessorName);
1200 setvectorvector(VectorPostprocessorName);
1201 setvectorvector(MarkerName);
1202 setvectorvector(OutputName);
1203 setvectorvector(MaterialPropertyName);
1204 setvectorvector(MooseFunctorName);
1205 setvectorvector(MaterialName);
1206 setvectorvector(DistributionName);
1207 setvectorvector(SamplerName);
1208 setvectorvector(TagName);
1211 setvectorvectorvector(
Real);
1212 setvectorvectorvector(
int);
1213 setvectorvectorvector(
long);
1214 setvectorvectorvector(
unsigned int);
1215 setvectorvectorvector(
unsigned long long);
1218 #if LIBMESH_DOF_ID_BYTES == 8 1219 setvectorvectorvector(uint64_t);
1224 setvectorvectorvector(
string);
1225 setvectorvectorvector(FileName);
1226 setvectorvectorvector(FileNameNoExtension);
1227 setvectorvectorvector(DataFileName);
1228 setvectorvectorvector(MeshFileName);
1229 setvectorvectorvector(MatrixFileName);
1230 setvectorvectorvector(SubdomainName);
1231 setvectorvectorvector(BoundaryName);
1232 setvectorvectorvector(VariableName);
1233 setvectorvectorvector(NonlinearVariableName);
1234 setvectorvectorvector(LinearVariableName);
1235 setvectorvectorvector(AuxVariableName);
1236 setvectorvectorvector(FunctionName);
1237 setvectorvectorvector(UserObjectName);
1238 setvectorvectorvector(IndicatorName);
1239 setvectorvectorvector(MarkerName);
1240 setvectorvectorvector(MultiAppName);
1241 setvectorvectorvector(PostprocessorName);
1242 setvectorvectorvector(VectorPostprocessorName);
1243 setvectorvectorvector(MarkerName);
1244 setvectorvectorvector(OutputName);
1245 setvectorvectorvector(MaterialPropertyName);
1246 setvectorvectorvector(MooseFunctorName);
1247 setvectorvectorvector(MaterialName);
1248 setvectorvectorvector(DistributionName);
1249 setvectorvectorvector(SamplerName);
1252 mooseError(
"unsupported type '", par->
type(),
"' for input parameter '", full_name,
"'");
1255 #undef setscalarValueType 1258 #undef setvectorvectorvector 1259 #undef setvectorvector 1277 InputParameters::Parameter<OutFileBase> * scalar_p =
1278 dynamic_cast<InputParameters::Parameter<OutFileBase> *
>(
MooseUtils::get(it.second));
1282 mooseAssert(input_file_name !=
"",
"Input Filename is nullptr");
1283 size_t pos = input_file_name.find_last_of(
'.');
1284 mooseAssert(pos != std::string::npos,
"Unable to determine suffix of input file name");
1285 scalar_p->set() = input_file_name.substr(0, pos) +
"_out";
1286 p.set_attributes(it.first,
false);
1292 if (!error_stream.str().empty())
1296 std::map<std::string, std::pair<std::string, std::string>> auto_build_vectors =
1297 p.getAutoBuildVectors();
1298 for (
const auto & it : auto_build_vectors)
1303 const std::string & base_name = it.second.first;
1304 const std::string & num_repeat = it.second.second;
1306 if (!p.isParamValid(it.first) && p.isParamValid(base_name) && p.isParamValid(num_repeat))
1308 unsigned int vec_size = p.get<
unsigned int>(num_repeat);
1309 const std::string &
name = p.get<std::string>(base_name);
1311 std::vector<VariableName> variable_names(vec_size);
1312 for (
unsigned int i = 0; i < vec_size; ++i)
1314 std::ostringstream oss;
1316 variable_names[i] = oss.str();
1320 p.set<std::vector<VariableName>>(it.first) = variable_names;
1325 template <
typename T>
1339 template <
typename T,
typename Base>
1342 const std::string & short_name,
1343 InputParameters::Parameter<T> * param,
1349 param->set() =
root()->param<Base>(full_name);
1351 catch (hit::Error &
err)
1353 auto strval =
root()->param<std::string>(full_name);
1356 auto & t =
typeid(T);
1357 if (t ==
typeid(
int) || t ==
typeid(
unsigned int) || t ==
typeid(
SubdomainID) ||
1358 t ==
typeid(
BoundaryID) || t ==
typeid(
double))
1362 param->set() = MooseUtils::convert<T>(strval,
true);
1364 catch (std::invalid_argument & )
1366 const std::string format_type = (t ==
typeid(double)) ?
"float" :
"integer";
1370 " syntax for parameter: ",
1377 else if (t ==
typeid(
bool))
1379 bool isbool =
toBool(strval, param->set());
1382 "invalid boolean syntax for parameter: ",
1394 global_block->
remove(short_name);
1399 template <
typename T,
typename UP_T,
typename Base>
1402 const std::string & short_name,
1403 InputParameters::Parameter<T> * param,
1407 setScalarParameter<T, Base>(full_name, short_name, param, in_global, global_block);
1416 template <
typename T,
typename Base>
1419 const std::string & short_name,
1420 InputParameters::Parameter<std::vector<T>> * param,
1425 if (
root()->find(full_name))
1429 auto tmp =
root()->param<std::vector<Base>>(full_name);
1430 for (
auto val : tmp)
1433 catch (hit::Error &
err)
1435 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1444 global_block->
remove(short_name);
1445 global_block->
setVectorParam<T>(short_name).resize(param->get().size());
1446 for (
unsigned int i = 0; i < vec.size(); ++i)
1447 global_block->
setVectorParam<T>(short_name)[i] = param->get()[i];
1451 template <
typename KeyType,
typename MappedType>
1454 const std::string & short_name,
1455 InputParameters::Parameter<std::map<KeyType, MappedType>> * param,
1459 std::map<KeyType, MappedType> the_map;
1460 if (
root()->find(full_name))
1464 const auto & string_vec =
root()->param<std::vector<std::string>>(full_name);
1465 auto it = string_vec.begin();
1466 while (it != string_vec.end())
1468 const auto & string_key = *it;
1470 if (it == string_vec.end())
1473 hit::errormsg(
root()->find(full_name),
1474 "odd number of entries in string vector for map parameter: ",
1477 "an even number or else you will end up with a key without a value!") +
1481 const auto & string_value = *it;
1484 std::pair<KeyType, MappedType> pr;
1488 pr.first = MooseUtils::convert<KeyType>(string_key,
true);
1490 catch (std::invalid_argument & )
1495 " syntax for map parameter ",
1505 pr.second = MooseUtils::convert<MappedType>(string_value,
true);
1507 catch (std::invalid_argument & )
1512 " syntax for map parameter ",
1520 auto insert_pr = the_map.insert(std::move(pr));
1521 if (!insert_pr.second)
1524 "Duplicate map entry for map parameter: ",
1528 " appears multiple times.") +
1534 catch (hit::Error &
err)
1536 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1541 param->set() = the_map;
1545 global_block->
remove(short_name);
1546 auto & global_map = global_block->
setParam<std::map<KeyType, MappedType>>(short_name);
1547 for (
const auto & pair : the_map)
1548 global_map.insert(pair);
1552 template <
typename T>
1555 const std::string & short_name,
1556 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1560 auto &
value = param->set();
1569 std::vector<std::string> outer_string_vectors;
1572 if (!value_string.empty())
1575 const auto outer_vector_size = outer_string_vectors.size();
1576 value.resize(outer_vector_size);
1578 for (
const auto j :
index_range(outer_string_vectors))
1579 if (!MooseUtils::tokenizeAndConvert<T>(outer_string_vectors[j],
value[j]))
1582 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1588 global_block->
remove(short_name);
1590 for (
const auto j :
make_range(outer_vector_size))
1599 template <
typename T>
1602 const std::string & full_name,
1603 const std::string & short_name,
1604 InputParameters::Parameter<std::vector<std::vector<std::vector<T>>>> * param,
1609 const std::string buffer_raw =
root()->param<std::string>(full_name);
1611 if (buffer_raw.find_first_not_of(
' ', 0) == std::string::npos)
1617 buffer.push_back(buffer_raw[0]);
1618 if (buffer[0] ==
'|' || buffer[0] ==
';')
1619 buffer =
' ' + buffer;
1620 for (std::string::size_type i = 1; i < buffer_raw.size(); i++)
1622 if ((buffer_raw[i - 1] ==
'|' || buffer_raw[i - 1] ==
';') &&
1623 (buffer_raw[i] ==
'|' || buffer_raw[i] ==
';'))
1624 buffer.push_back(
' ');
1625 buffer.push_back(buffer_raw[i]);
1627 if (buffer.back() ==
'|' || buffer.back() ==
';')
1628 buffer.push_back(
' ');
1631 std::vector<std::string> first_tokenized_vector;
1632 std::vector<std::vector<std::string>> second_tokenized_vector;
1634 param->set().resize(first_tokenized_vector.size());
1635 second_tokenized_vector.resize(first_tokenized_vector.size());
1636 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1639 if (first_tokenized_vector[j].find_first_not_of(
' ', 0) == std::string::npos)
1641 param->set()[j].resize(0);
1647 param->set()[j].resize(second_tokenized_vector[j].size());
1648 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1649 if (!MooseUtils::tokenizeAndConvert<T>(second_tokenized_vector[j][k], param->set()[j][k]))
1652 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
1660 global_block->
remove(short_name);
1662 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1664 global_block->
setTripleIndexParam<T>(short_name)[j].resize(second_tokenized_vector[j].size());
1665 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1668 for (
unsigned int i = 0; i < param->get()[j][k].size(); ++i)
1675 template <
typename T>
1678 const std::string & short_name,
1679 InputParameters::Parameter<T> * param,
1683 std::vector<double> vec;
1686 vec =
root()->param<std::vector<double>>(full_name);
1688 catch (hit::Error &
err)
1690 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1694 if (vec.size() != LIBMESH_DIM)
1697 "wrong number of values in scalar component parameter ",
1703 " components but should have ",
1710 for (
unsigned int i = 0; i < vec.size(); ++i)
1713 param->set() =
value;
1716 global_block->
remove(short_name);
1721 template <
typename T>
1724 const std::string & short_name,
1725 InputParameters::Parameter<std::vector<T>> * param,
1729 std::vector<double> vec;
1732 vec =
root()->param<std::vector<double>>(full_name);
1734 catch (hit::Error &
err)
1736 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1740 if (vec.size() % LIBMESH_DIM)
1743 "wrong number of values in vector component parameter ",
1747 " is not a multiple of ",
1753 std::vector<T> values;
1754 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1757 for (
int j = 0; j < LIBMESH_DIM; ++j)
1758 value(j) =
Real(vec[i * LIBMESH_DIM + j]);
1759 values.push_back(
value);
1762 param->set() = values;
1766 global_block->
remove(short_name);
1767 global_block->
setVectorParam<T>(short_name).resize(vec.size(), values[0]);
1768 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1773 template <
typename T>
1776 const std::string & full_name,
1777 const std::string & short_name,
1778 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1783 std::string buffer =
root()->param<std::string>(full_name);
1787 std::vector<std::string> first_tokenized_vector;
1789 param->set().resize(first_tokenized_vector.size());
1792 std::vector<std::vector<double>> vecvec(first_tokenized_vector.size());
1793 for (
unsigned j = 0; j < vecvec.size(); ++j)
1794 if (!MooseUtils::tokenizeAndConvert<double>(first_tokenized_vector[j], vecvec[j]))
1797 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1801 for (
const auto & vec : vecvec)
1802 if (vec.size() % LIBMESH_DIM)
1805 hit::errormsg(
root()->find(full_name),
1806 "wrong number of values in double-indexed vector component parameter ",
1808 ": size of subcomponent ",
1810 " is not a multiple of ",
1817 std::vector<std::vector<T>> values(vecvec.size());
1818 for (
unsigned int id_vec = 0; id_vec < vecvec.size(); ++id_vec)
1819 for (
unsigned int i = 0; i < vecvec[id_vec].size() / LIBMESH_DIM; ++i)
1822 for (
int j = 0; j < LIBMESH_DIM; ++j)
1823 value(j) =
Real(vecvec[id_vec][i * LIBMESH_DIM + j]);
1824 values[id_vec].push_back(
value);
1827 param->set() = values;
1831 global_block->
remove(short_name);
1833 for (
unsigned j = 0; j < vecvec.size(); ++j)
1837 for (
unsigned int i = 0; i < param->get()[j].size() / LIBMESH_DIM; ++i)
1845 Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
1846 const std::string & full_name,
1847 const std::string & short_name,
1848 InputParameters::Parameter<RealVectorValue> * param,
1852 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1857 Builder::setScalarParameter<Point, Point>(
const std::string & full_name,
1858 const std::string & short_name,
1859 InputParameters::Parameter<Point> * param,
1863 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1868 Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
1869 const std::string & full_name,
1870 const std::string & short_name,
1871 InputParameters::Parameter<RealEigenVector> * param,
1875 std::vector<double> vec;
1878 vec = root()->param<std::vector<double>>(full_name);
1880 catch (hit::Error &
err)
1882 _errmsg += hit::errormsg(root()->find(full_name),
err.what()) +
"\n";
1887 for (
unsigned int i = 0; i < vec.size(); ++i)
1890 param->set() =
value;
1893 global_block->remove(short_name);
1900 Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
1901 const std::string & full_name,
1902 const std::string & short_name,
1903 InputParameters::Parameter<RealEigenMatrix> * param,
1908 std::string buffer = root()->param<std::string>(full_name);
1912 std::vector<std::string> first_tokenized_vector;
1915 std::vector<std::vector<Real>> values(first_tokenized_vector.size());
1917 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1919 if (!MooseUtils::tokenizeAndConvert<Real>(first_tokenized_vector[j], values[j]))
1922 hit::errormsg(root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1925 if (j != 0 && values[j].size() != values[0].size())
1928 hit::errormsg(root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1934 for (
unsigned int i = 0; i < values.size(); ++i)
1935 for (
unsigned int j = 0; j < values[i].size(); ++j)
1936 value(i, j) = values[i][j];
1938 param->set() =
value;
1941 global_block->remove(short_name);
1948 Builder::setScalarParameter<MooseEnum, MooseEnum>(
const std::string & full_name,
1949 const std::string & short_name,
1950 InputParameters::Parameter<MooseEnum> * param,
1956 std::string
value = root()->param<std::string>(full_name);
1958 param->set() =
value;
1961 global_block->remove(short_name);
1962 global_block->setScalarParam<
MooseEnum>(short_name) = current_param;
1968 Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
1969 const std::string & full_name,
1970 const std::string & short_name,
1971 InputParameters::Parameter<MultiMooseEnum> * param,
1977 auto vec = root()->param<std::vector<std::string>>(full_name);
1979 std::string raw_values;
1980 for (
unsigned int i = 0; i < vec.size(); ++i)
1981 raw_values +=
' ' + vec[i];
1983 param->set() = raw_values;
1987 global_block->remove(short_name);
1988 global_block->setScalarParam<
MultiMooseEnum>(short_name) = current_param;
1994 Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
1995 const std::string & full_name,
1996 const std::string & short_name,
1997 InputParameters::Parameter<ExecFlagEnum> * param,
2002 auto vec = root()->param<std::vector<std::string>>(full_name);
2004 std::string raw_values;
2005 for (
unsigned int i = 0; i < vec.size(); ++i)
2006 raw_values +=
' ' + vec[i];
2008 param->set() = raw_values;
2012 global_block->remove(short_name);
2013 global_block->setScalarParam<
ExecFlagEnum>(short_name) = current_param;
2019 Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
2020 const std::string & full_name,
2021 const std::string & short_name,
2022 InputParameters::Parameter<RealTensorValue> * param,
2026 auto vec = root()->param<std::vector<double>>(full_name);
2027 if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
2029 _errmsg += hit::errormsg(root()->find(full_name),
2030 "invalid RealTensorValue parameter ",
2035 LIBMESH_DIM * LIBMESH_DIM) +
2041 for (
int i = 0; i < LIBMESH_DIM; ++i)
2042 for (
int j = 0; j < LIBMESH_DIM; ++j)
2043 value(i, j) =
Real(vec[i * LIBMESH_DIM + j]);
2045 param->set() =
value;
2048 global_block->remove(short_name);
2056 Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
2057 const std::string & full_name,
2058 const std::string & short_name,
2059 InputParameters::Parameter<PostprocessorName> * param,
2063 PostprocessorName pps_name = root()->param<std::string>(full_name);
2064 param->set() = pps_name;
2068 global_block->remove(short_name);
2069 global_block->setScalarParam<PostprocessorName>(short_name) = pps_name;
2075 Builder::setScalarParameter<ReporterName, std::string>(
2076 const std::string & full_name,
2077 const std::string & ,
2078 InputParameters::Parameter<ReporterName> * param,
2082 std::vector<std::string> names =
2084 if (names.size() != 2)
2085 _errmsg += hit::errormsg(root()->find(full_name),
2086 "The supplied name ReporterName '",
2088 "' must contain the '/' delimiter.");
2095 Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
2096 const std::string & full_name,
2097 const std::string & short_name,
2098 InputParameters::Parameter<std::vector<RealVectorValue>> * param,
2102 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2107 Builder::setVectorParameter<Point, Point>(
const std::string & full_name,
2108 const std::string & short_name,
2109 InputParameters::Parameter<std::vector<Point>> * param,
2113 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2118 Builder::setVectorParameter<MooseEnum, MooseEnum>(
2119 const std::string & full_name,
2120 const std::string & short_name,
2121 InputParameters::Parameter<std::vector<MooseEnum>> * param,
2125 std::vector<MooseEnum> enum_values = param->get();
2126 std::vector<std::string> values(enum_values.size());
2127 for (
unsigned int i = 0; i < values.size(); ++i)
2128 values[i] = static_cast<std::string>(enum_values[i]);
2134 std::vector<std::string> vec;
2135 if (root()->find(full_name))
2137 vec = root()->param<std::vector<std::string>>(full_name);
2138 param->set().resize(vec.size(), enum_values[0]);
2141 for (
unsigned int i = 0; i < vec.size(); ++i)
2142 param->set()[i] = vec[i];
2146 global_block->remove(short_name);
2147 global_block->setVectorParam<
MooseEnum>(short_name).resize(vec.size(), enum_values[0]);
2148 for (
unsigned int i = 0; i < vec.size(); ++i)
2149 global_block->setVectorParam<
MooseEnum>(short_name)[i] = values[0];
2155 Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
2156 const std::string & full_name,
2157 const std::string & short_name,
2158 InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
2162 const std::vector<MultiMooseEnum> & enum_values = param->get();
2165 std::string buffer = root()->param<std::string>(full_name);
2167 std::vector<std::string> first_tokenized_vector =
MooseUtils::split(buffer,
";");
2168 for (
const auto & i : first_tokenized_vector)
2170 mooseError(
"In " + full_name +
", one entry in the vector is empty. This is not allowed.");
2172 param->set().resize(first_tokenized_vector.size(), enum_values[0]);
2174 std::vector<std::vector<std::string>> vecvec(first_tokenized_vector.size());
2177 MooseUtils::tokenize<std::string>(first_tokenized_vector[i], vecvec[i], 1,
" ");
2178 param->set()[i] = vecvec[i];
2183 global_block->remove(short_name);
2184 global_block->setVectorParam<
MultiMooseEnum>(short_name).resize(vecvec.size(), enum_values[0]);
2185 for (
unsigned int i = 0; i < vecvec.size(); ++i)
2186 global_block->setVectorParam<
MultiMooseEnum>(short_name)[i] = vecvec[i];
2192 Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
2193 const std::string & full_name,
2194 const std::string & short_name,
2195 InputParameters::Parameter<std::vector<PostprocessorName>> * param,
2199 std::vector<std::string> pps_names = root()->param<std::vector<std::string>>(full_name);
2200 unsigned int n = pps_names.
size();
2201 param->set().resize(n);
2203 for (
unsigned int j = 0; j < n; ++j)
2204 param->set()[j] = pps_names[j];
2208 global_block->remove(short_name);
2209 global_block->setVectorParam<PostprocessorName>(short_name).resize(n,
"");
2210 for (
unsigned int j = 0; j < n; ++j)
2211 global_block->setVectorParam<PostprocessorName>(short_name)[j] = pps_names[j];
2221 Builder::setVectorParameter<VariableName, VariableName>(
2222 const std::string & full_name,
2223 const std::string & short_name,
2224 InputParameters::Parameter<std::vector<VariableName>> * param,
2228 auto vec = root()->param<std::vector<std::string>>(full_name);
2229 auto strval = root()->param<std::string>(full_name);
2230 std::vector<VariableName> var_names(vec.size());
2232 bool has_var_names =
false;
2233 for (
unsigned int i = 0; i < vec.size(); ++i)
2235 VariableName var_name = vec[i];
2238 std::istringstream ss(var_name);
2242 if (ss >> real_value && ss.eof())
2243 _current_params->defaultCoupledValue(short_name, real_value, i);
2246 var_names[i] = var_name;
2247 has_var_names =
true;
2253 param->set().resize(vec.size());
2255 for (
unsigned int i = 0; i < vec.size(); ++i)
2256 if (var_names[i] ==
"")
2258 _errmsg += hit::errormsg(root()->find(full_name),
2259 "invalid value for ",
2262 " MOOSE does not currently support a coupled vector where " 2263 "some parameters are ",
2264 "reals and others are variables") +
2269 param->set()[i] = var_names[i];
2275 Builder::setVectorParameter<ReporterName, std::string>(
2276 const std::string & full_name,
2277 const std::string & ,
2278 InputParameters::Parameter<std::vector<ReporterName>> * param,
2282 auto rnames = root()->param<std::vector<std::string>>(full_name);
2283 param->set().resize(rnames.size());
2285 for (
unsigned int i = 0; i < rnames.size(); ++i)
2288 if (names.size() != 2)
2289 _errmsg += hit::errormsg(root()->find(full_name),
2290 "The supplied name ReporterName '",
2292 "' must contain the '/' delimiter.");
2300 Builder::setVectorParameter<CLIArgString, std::string>(
2301 const std::string & full_name,
2302 const std::string & ,
2303 InputParameters::Parameter<std::vector<CLIArgString>> * param,
2308 auto rnames = root()->param<std::vector<std::string>>(full_name);
2309 param->set().resize(rnames.size());
2316 unsigned int i_param = 0;
2317 bool vector_param_detected =
false;
2318 for (
unsigned int i = 0; i < rnames.size(); ++i)
2321 std::vector<std::string> double_split =
2323 std::vector<std::string> single_split =
2325 if (double_split.size() + single_split.size() >= 3)
2328 if ((double_split.size() + single_split.size()) % 2 == 1)
2329 vector_param_detected = !vector_param_detected;
2332 if (vector_param_detected)
2333 param->set()[i_param] += rnames[i] +
' ';
2336 param->set()[i_param] += rnames[i];
2341 param->set().resize(i_param);
2346 Builder::setDoubleIndexParameter<Point>(
2347 const std::string & full_name,
2348 const std::string & short_name,
2349 InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
2353 setVectorVectorComponentParameter(full_name, short_name, param, in_global, global_block);
std::string name(const ElemQuality q)
void build()
Parse an input file (or text string if provided) consisting of hit syntax and setup objects in the MO...
ActionFactory & _action_factory
The Factory that builds actions.
MooseApp & _app
The MooseApp this Parser is part of.
const std::multimap< std::string, std::string > & getAssociatedTypes() const
Get a multimap of registered associations of syntax with type.
void walk(const std::string &fullpath, const std::string &nodename, hit::Node *n) override
std::pair< std::multimap< std::string, ActionInfo >::const_iterator, std::multimap< std::string, ActionInfo >::const_iterator > getActions(const std::string &syntax) const
Returns a pair of multimap iterators to all the ActionInfo objects associated with a given piece of s...
std::unordered_set< std::string > _deprec_param_tracker
Tracks whether a deprecated param has had its warning message printed already.
void walkRaw(std::string fullpath, std::string nodepath, hit::Node *n)
A MultiMooseEnum object to hold "execute_on" flags.
virtual std::string type() const=0
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
InputParameters & getComponentParams()
Return the parameters of the component.
void setTripleIndexParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::vector< std::vector< std::vector< T >>>> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting any triple indexed type parameter read from the input file or command lin...
std::list< Action * >::iterator ActionIterator
alias to hide implementation details
const std::multimap< std::string, ActionInfo > & getAssociatedActions() const
Return all Syntax to Action associations.
std::vector< std::string > errors
void buildFullTree(const std::string &search_string)
Use MOOSE Factories to construct a full parse tree for documentation or echoing input.
InputParameters getValidParams(const std::string &name)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::shared_ptr< CommandLine > commandLine() const
Get the command line.
std::vector< std::string > _secs_need_first
void setVectorVectorComponentParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::vector< std::vector< T >>> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting vector of several multivalue "scalar" type parameter read from the input ...
std::string associatedClassName(const std::string &name) const
Get the associated class name for an object name.
std::pair< std::multimap< std::string, std::string >::const_iterator, std::multimap< std::string, std::string >::const_iterator > getActionsByTask(const std::string &task) const
Returns begin and end iterators in a multimap from tasks to actions names.
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
std::set< std::string > getTasksByAction(const std::string &action) const
InputParameters * _current_params
The current parameter object for which parameters are being extracted.
FileLineInfo getLineInfo(const std::string &syntax, const std::string &action, const std::string &task) const
Gets the file and line where the syntax/action/task combo was registered.
void setScalarComponentParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting any multivalue "scalar" type parameter read from the input file or comman...
static InputParameters validParams()
Parameters that are processed directly by the Parser and are valid anywhere in the input...
Base class for MOOSE-based applications.
void setMapParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::map< KeyType, MappedType >> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting any map type parameter read from the input file or command line...
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
Storage for action instances.
void addActionBlock(std::shared_ptr< Action > blk)
This method add an Action instance to the warehouse.
FileLineInfo getLineInfo(const std::string &name, const std::string &task) const
Gets file and line information where an action was registered.
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
bool toBool(const std::string &, T &)
Action for creating component actions.
std::unique_ptr< SyntaxTree > _syntax_formatter
Object for holding the syntax parse tree.
std::vector< T > & setVectorParam(const std::string &name)
Holds the syntax in a Json::Value tree.
void extractParams(const std::string &prefix, InputParameters &p)
This function attempts to extract values from the input file based on the contents of the passed para...
std::vector< std::vector< T > > & setDoubleIndexParam(const std::string &name)
FileLineInfo getLineInfo(const std::string &name) const
Gets file and line information where an object was initially registered.
std::shared_ptr< Action > create(const std::string &action, const std::string &action_name, InputParameters ¶meters)
std::vector< std::string > getSyntaxByAction(const std::string &action, const std::string &task="")
Retrieve the syntax associated with the passed in action type string.
auto max(const L &left, const R &right)
std::vector< std::string > split(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
Python like split functions for strings.
std::vector< std::string > errors
void setScalarValueTypeParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, bool in_global, GlobalParamsAction *global_block)
const std::shared_ptr< Parser > _parser
The front parser.
bool isDeprecatedSyntax(const std::string &syntax) const
Returns a Boolean indicating whether the syntax has been deprecated through a call to deprecateAction...
std::vector< std::string > rsplit(const std::string &str, const std::string &delimiter, std::size_t max_count=std::numeric_limits< std::size_t >::max())
TensorValue< Real > RealTensorValue
static InputParameters validParams()
InputParameters & getObjectParams()
Retrieve the parameters of the object to be created by this action.
std::set< std::string > _extracted_vars
The set of all variables extracted from the input file.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void mooseUnused(Args &&... args)
Warning message used to notify the users of unused parts of their input files Really used internally ...
boundary_id_type BoundaryID
constexpr auto merge(std::index_sequence< first... >, std::index_sequence< second... >)
Merge two index sequences into one.
void initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
Creates a syntax formatter for printing.
static InputParameters validParams()
T & setScalarParam(const std::string &name)
An inteface for the _console for outputting to the Console object.
std::vector< std::vector< std::vector< T > > > & setTripleIndexParam(const std::string &name)
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void buildJsonSyntaxTree(JsonSyntaxTree &tree) const
Use MOOSE Factories to construct a parameter tree for documentation or echoing input.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
void errorCheck(const libMesh::Parallel::Communicator &comm, bool warn_unused, bool err_unused)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealEigenMatrix
const auto & registeredObjects() const
Returns a reference to the map from names to RegistryEntryBase pointers.
std::string getPrimaryFileName(bool stripLeadingPath=true) const
Return the primary (first) filename that was parsed.
std::string demangle(const char *name)
std::unique_ptr< hit::Node > _cli_root
void setScalarParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, bool in_global, GlobalParamsAction *global_block)
Helper functions for setting parameters of arbitrary types - bodies are in the .C file since they are...
std::string isAssociated(const std::string &real_id, bool *is_parent, const std::map< std::string, std::set< std::string >> &alt_map={}) const
Method for determining whether a piece of syntax is associated with an Action an optional syntax map ...
bool toBool< bool >(const std::string &s, bool &val)
std::string getTaskName(const std::string &action)
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
unsigned int get(unsigned int i) const
Indexing operator Operator to retrieve the id of an item from the MultiMooseEnum. ...
void setDoubleIndexParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::vector< std::vector< T >>> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting any double indexed type parameter read from the input file or command lin...
std::ostringstream * _current_error_stream
The current stream object used for capturing errors during extraction.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Syntax & _syntax
Reference to an object that defines input file syntax.
std::set< std::string > _used
void setVectorParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::vector< T >> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting any vector type parameter read from the input file or command line...
IntRange< T > make_range(T beg, T end)
int levenshteinDist(const std::string &s1, const std::string &s2)
Computes and returns the Levenshtein distance between strings s1 and s2.
bool verifyMooseObjectTask(const std::string &base, const std::string &task) const
Returns a Boolean indicating whether a task is associated with on of the MOOSE pluggable systems (BAS...
void setVectorComponentParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< std::vector< T >> *param, bool in_global, GlobalParamsAction *global_block)
Template method for setting several multivalue "scalar" type parameter read from the input file or co...
ActionIterator actionBlocksWithActionEnd(const std::string &task)
Factory & _factory
The Factory associated with that MooseApp.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
std::vector< std::string > listValidParams(std::string §ion_name)
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
Builder(MooseApp &app, ActionWarehouse &action_wh, std::shared_ptr< Parser > parser)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
std::vector< std::string > findSimilar(std::string param, std::vector< std::string > options)
T & setParam(const std::string &name)
ActionWarehouse & _action_wh
Action warehouse that will be filled by actions.
std::string deprecatedActionSyntaxMessage(const std::string syntax)
Returns the deprecation message for a given syntax that has been deprecated by deprecateActionSyntax...
ActionIterator actionBlocksWithActionBegin(const std::string &task)
Iterators to the Actions in the warehouse.
bool isSectionActive(std::string path, hit::Node *root)
void ErrorVector unsigned int
auto index_range(const T &sizable)
The Reporter system is comprised of objects that can contain any number of data values.
std::vector< std::string > errors
void remove(const std::string &name)
This function is here to remove parameters of a type so that global parameters can potentially use th...
void walk(const std::string &fullpath, const std::string &nodepath, hit::Node *n)