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);
1074 #ifdef MOOSE_MFEM_ENABLED 1075 setscalar(MFEMScalarCoefficientName,
string);
1076 setscalar(MFEMVectorCoefficientName,
string);
1077 setscalar(MFEMMatrixCoefficientName,
string);
1082 setscalar(Point, Point);
1090 setscalar(ReporterValueName,
string);
1091 setscalar(ParsedFunctionExpression,
string);
1094 setvector(
bool,
bool);
1095 setvector(
Real,
double);
1096 setvector(
int,
int);
1097 setvector(
long,
int);
1098 setvector(
unsigned int,
int);
1107 #if LIBMESH_DOF_ID_BYTES == 8 1108 setvector(uint64_t,
int);
1114 setvector(Point, Point);
1118 setvector(
string,
string);
1119 setvector(FileName,
string);
1120 setvector(FileNameNoExtension,
string);
1121 setvector(RelativeFileName,
string);
1122 setvector(DataFileName,
string);
1123 setvector(MeshFileName,
string);
1124 setvector(MatrixFileName,
string);
1125 setvector(SubdomainName,
string);
1126 setvector(BoundaryName,
string);
1127 setvector(NonlinearVariableName,
string);
1128 setvector(LinearVariableName,
string);
1129 setvector(SolverVariableName,
string);
1130 setvector(AuxVariableName,
string);
1131 setvector(FunctionName,
string);
1132 setvector(ConvergenceName,
string);
1133 setvector(MeshDivisionName,
string);
1134 setvector(UserObjectName,
string);
1135 setvector(IndicatorName,
string);
1136 setvector(MarkerName,
string);
1137 setvector(MultiAppName,
string);
1138 setvector(PostprocessorName, PostprocessorName);
1139 setvector(VectorPostprocessorName,
string);
1140 setvector(OutputName,
string);
1141 setvector(MaterialPropertyName,
string);
1142 setvector(MooseFunctorName,
string);
1143 setvector(MaterialName,
string);
1144 setvector(DistributionName,
string);
1145 setvector(SamplerName,
string);
1146 setvector(TagName,
string);
1147 setvector(VariableName, VariableName);
1148 setvector(MeshGeneratorName,
string);
1149 setvector(ExtraElementIDName,
string);
1151 setvector(CLIArgString,
string);
1152 setvector(ComponentName,
string);
1153 setvector(PhysicsName,
string);
1154 setvector(PositionsName,
string);
1155 setvector(TimesName,
string);
1156 setvector(ReporterValueName,
string);
1157 setvector(ExecutorName,
string);
1158 setvector(NonlinearSystemName,
string);
1159 setvector(LinearSystemName,
string);
1160 setvector(SolverSystemName,
string);
1161 #ifdef MOOSE_MFEM_ENABLED 1162 setvector(MFEMScalarCoefficientName,
string);
1163 setvector(MFEMVectorCoefficientName,
string);
1164 setvector(MFEMMatrixCoefficientName,
string);
1168 setmap(
string,
unsigned int);
1169 setmap(
string,
Real);
1170 setmap(
string,
string);
1171 setmap(
unsigned int,
unsigned int);
1172 setmap(
unsigned long,
unsigned int);
1173 setmap(
unsigned long long,
unsigned int);
1176 setvectorvector(
Real);
1177 setvectorvector(
int);
1178 setvectorvector(
long);
1179 setvectorvector(
unsigned int);
1180 setvectorvector(
unsigned long long);
1183 #if LIBMESH_DOF_ID_BYTES == 8 1184 setvectorvector(uint64_t);
1189 setvectorvector(Point);
1190 setvectorvector(
string);
1191 setvectorvector(FileName);
1192 setvectorvector(FileNameNoExtension);
1193 setvectorvector(DataFileName);
1194 setvectorvector(MeshFileName);
1195 setvectorvector(MatrixFileName);
1196 setvectorvector(SubdomainName);
1197 setvectorvector(BoundaryName);
1198 setvectorvector(VariableName);
1199 setvectorvector(NonlinearVariableName);
1200 setvectorvector(LinearVariableName);
1201 setvectorvector(SolverVariableName);
1202 setvectorvector(AuxVariableName);
1203 setvectorvector(FunctionName);
1204 setvectorvector(ConvergenceName);
1205 setvectorvector(UserObjectName);
1206 setvectorvector(IndicatorName);
1207 setvectorvector(MarkerName);
1208 setvectorvector(MultiAppName);
1209 setvectorvector(PostprocessorName);
1210 setvectorvector(VectorPostprocessorName);
1211 setvectorvector(MarkerName);
1212 setvectorvector(OutputName);
1213 setvectorvector(MaterialPropertyName);
1214 setvectorvector(MooseFunctorName);
1215 setvectorvector(MaterialName);
1216 setvectorvector(DistributionName);
1217 setvectorvector(SamplerName);
1218 setvectorvector(TagName);
1219 #ifdef MOOSE_MFEM_ENABLED 1220 setvectorvector(MFEMScalarCoefficientName);
1221 setvectorvector(MFEMVectorCoefficientName);
1222 setvectorvector(MFEMMatrixCoefficientName);
1226 setvectorvectorvector(
Real);
1227 setvectorvectorvector(
int);
1228 setvectorvectorvector(
long);
1229 setvectorvectorvector(
unsigned int);
1230 setvectorvectorvector(
unsigned long long);
1233 #if LIBMESH_DOF_ID_BYTES == 8 1234 setvectorvectorvector(uint64_t);
1239 setvectorvectorvector(
string);
1240 setvectorvectorvector(FileName);
1241 setvectorvectorvector(FileNameNoExtension);
1242 setvectorvectorvector(DataFileName);
1243 setvectorvectorvector(MeshFileName);
1244 setvectorvectorvector(MatrixFileName);
1245 setvectorvectorvector(SubdomainName);
1246 setvectorvectorvector(BoundaryName);
1247 setvectorvectorvector(VariableName);
1248 setvectorvectorvector(NonlinearVariableName);
1249 setvectorvectorvector(LinearVariableName);
1250 setvectorvectorvector(AuxVariableName);
1251 setvectorvectorvector(FunctionName);
1252 setvectorvectorvector(UserObjectName);
1253 setvectorvectorvector(IndicatorName);
1254 setvectorvectorvector(MarkerName);
1255 setvectorvectorvector(MultiAppName);
1256 setvectorvectorvector(PostprocessorName);
1257 setvectorvectorvector(VectorPostprocessorName);
1258 setvectorvectorvector(MarkerName);
1259 setvectorvectorvector(OutputName);
1260 setvectorvectorvector(MaterialPropertyName);
1261 setvectorvectorvector(MooseFunctorName);
1262 setvectorvectorvector(MaterialName);
1263 setvectorvectorvector(DistributionName);
1264 setvectorvectorvector(SamplerName);
1267 mooseError(
"unsupported type '", par->
type(),
"' for input parameter '", full_name,
"'");
1270 #undef setscalarValueType 1273 #undef setvectorvectorvector 1274 #undef setvectorvector 1292 InputParameters::Parameter<OutFileBase> * scalar_p =
1293 dynamic_cast<InputParameters::Parameter<OutFileBase> *
>(
MooseUtils::get(it.second));
1297 mooseAssert(input_file_name !=
"",
"Input Filename is nullptr");
1298 size_t pos = input_file_name.find_last_of(
'.');
1299 mooseAssert(pos != std::string::npos,
"Unable to determine suffix of input file name");
1300 scalar_p->set() = input_file_name.substr(0, pos) +
"_out";
1301 p.set_attributes(it.first,
false);
1307 if (!error_stream.str().empty())
1311 std::map<std::string, std::pair<std::string, std::string>> auto_build_vectors =
1312 p.getAutoBuildVectors();
1313 for (
const auto & it : auto_build_vectors)
1318 const std::string & base_name = it.second.first;
1319 const std::string & num_repeat = it.second.second;
1321 if (!p.isParamValid(it.first) && p.isParamValid(base_name) && p.isParamValid(num_repeat))
1323 unsigned int vec_size = p.get<
unsigned int>(num_repeat);
1324 const std::string &
name = p.get<std::string>(base_name);
1326 std::vector<VariableName> variable_names(vec_size);
1327 for (
unsigned int i = 0; i < vec_size; ++i)
1329 std::ostringstream oss;
1331 variable_names[i] = oss.str();
1335 p.set<std::vector<VariableName>>(it.first) = variable_names;
1340 template <
typename T>
1354 template <
typename T,
typename Base>
1357 const std::string & short_name,
1358 InputParameters::Parameter<T> * param,
1364 param->set() =
root()->param<Base>(full_name);
1366 catch (hit::Error &
err)
1368 auto strval =
root()->param<std::string>(full_name);
1371 auto & t =
typeid(T);
1372 if (t ==
typeid(
int) || t ==
typeid(
unsigned int) || t ==
typeid(
SubdomainID) ||
1373 t ==
typeid(
BoundaryID) || t ==
typeid(
double))
1377 param->set() = MooseUtils::convert<T>(strval,
true);
1379 catch (std::invalid_argument & )
1381 const std::string format_type = (t ==
typeid(double)) ?
"float" :
"integer";
1385 " syntax for parameter: ",
1392 else if (t ==
typeid(
bool))
1394 bool isbool =
toBool(strval, param->set());
1397 "invalid boolean syntax for parameter: ",
1409 global_block->
remove(short_name);
1414 template <
typename T,
typename UP_T,
typename Base>
1417 const std::string & short_name,
1418 InputParameters::Parameter<T> * param,
1422 setScalarParameter<T, Base>(full_name, short_name, param, in_global, global_block);
1431 template <
typename T,
typename Base>
1434 const std::string & short_name,
1435 InputParameters::Parameter<std::vector<T>> * param,
1440 if (
root()->find(full_name))
1444 auto tmp =
root()->param<std::vector<Base>>(full_name);
1445 for (
auto val : tmp)
1448 catch (hit::Error &
err)
1450 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1459 global_block->
remove(short_name);
1460 global_block->
setVectorParam<T>(short_name).resize(param->get().size());
1461 for (
unsigned int i = 0; i < vec.size(); ++i)
1462 global_block->
setVectorParam<T>(short_name)[i] = param->get()[i];
1466 template <
typename KeyType,
typename MappedType>
1469 const std::string & short_name,
1470 InputParameters::Parameter<std::map<KeyType, MappedType>> * param,
1474 std::map<KeyType, MappedType> the_map;
1475 if (
root()->find(full_name))
1479 const auto & string_vec =
root()->param<std::vector<std::string>>(full_name);
1480 auto it = string_vec.begin();
1481 while (it != string_vec.end())
1483 const auto & string_key = *it;
1485 if (it == string_vec.end())
1488 hit::errormsg(
root()->find(full_name),
1489 "odd number of entries in string vector for map parameter: ",
1492 "an even number or else you will end up with a key without a value!") +
1496 const auto & string_value = *it;
1499 std::pair<KeyType, MappedType> pr;
1503 pr.first = MooseUtils::convert<KeyType>(string_key,
true);
1505 catch (std::invalid_argument & )
1510 " syntax for map parameter ",
1520 pr.second = MooseUtils::convert<MappedType>(string_value,
true);
1522 catch (std::invalid_argument & )
1527 " syntax for map parameter ",
1535 auto insert_pr = the_map.insert(std::move(pr));
1536 if (!insert_pr.second)
1539 "Duplicate map entry for map parameter: ",
1543 " appears multiple times.") +
1549 catch (hit::Error &
err)
1551 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1556 param->set() = the_map;
1560 global_block->
remove(short_name);
1561 auto & global_map = global_block->
setParam<std::map<KeyType, MappedType>>(short_name);
1562 for (
const auto & pair : the_map)
1563 global_map.insert(pair);
1567 template <
typename T>
1570 const std::string & short_name,
1571 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1575 auto &
value = param->set();
1584 std::vector<std::string> outer_string_vectors;
1587 if (!value_string.empty())
1590 const auto outer_vector_size = outer_string_vectors.size();
1591 value.resize(outer_vector_size);
1593 for (
const auto j :
index_range(outer_string_vectors))
1594 if (!MooseUtils::tokenizeAndConvert<T>(outer_string_vectors[j],
value[j]))
1597 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1603 global_block->
remove(short_name);
1605 for (
const auto j :
make_range(outer_vector_size))
1614 template <
typename T>
1617 const std::string & full_name,
1618 const std::string & short_name,
1619 InputParameters::Parameter<std::vector<std::vector<std::vector<T>>>> * param,
1624 const std::string buffer_raw =
root()->param<std::string>(full_name);
1626 if (buffer_raw.find_first_not_of(
' ', 0) == std::string::npos)
1632 buffer.push_back(buffer_raw[0]);
1633 if (buffer[0] ==
'|' || buffer[0] ==
';')
1634 buffer =
' ' + buffer;
1635 for (std::string::size_type i = 1; i < buffer_raw.size(); i++)
1637 if ((buffer_raw[i - 1] ==
'|' || buffer_raw[i - 1] ==
';') &&
1638 (buffer_raw[i] ==
'|' || buffer_raw[i] ==
';'))
1639 buffer.push_back(
' ');
1640 buffer.push_back(buffer_raw[i]);
1642 if (buffer.back() ==
'|' || buffer.back() ==
';')
1643 buffer.push_back(
' ');
1646 std::vector<std::string> first_tokenized_vector;
1647 std::vector<std::vector<std::string>> second_tokenized_vector;
1649 param->set().resize(first_tokenized_vector.size());
1650 second_tokenized_vector.resize(first_tokenized_vector.size());
1651 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1654 if (first_tokenized_vector[j].find_first_not_of(
' ', 0) == std::string::npos)
1656 param->set()[j].resize(0);
1662 param->set()[j].resize(second_tokenized_vector[j].size());
1663 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1664 if (!MooseUtils::tokenizeAndConvert<T>(second_tokenized_vector[j][k], param->set()[j][k]))
1667 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
1675 global_block->
remove(short_name);
1677 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1679 global_block->
setTripleIndexParam<T>(short_name)[j].resize(second_tokenized_vector[j].size());
1680 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1683 for (
unsigned int i = 0; i < param->get()[j][k].size(); ++i)
1690 template <
typename T>
1693 const std::string & short_name,
1694 InputParameters::Parameter<T> * param,
1698 std::vector<double> vec;
1701 vec =
root()->param<std::vector<double>>(full_name);
1703 catch (hit::Error &
err)
1705 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1709 if (vec.size() != LIBMESH_DIM)
1712 "wrong number of values in scalar component parameter ",
1718 " components but should have ",
1725 for (
unsigned int i = 0; i < vec.size(); ++i)
1728 param->set() =
value;
1731 global_block->
remove(short_name);
1736 template <
typename T>
1739 const std::string & short_name,
1740 InputParameters::Parameter<std::vector<T>> * param,
1744 std::vector<double> vec;
1747 vec =
root()->param<std::vector<double>>(full_name);
1749 catch (hit::Error &
err)
1751 _errmsg += hit::errormsg(
root()->find(full_name),
err.what()) +
"\n";
1755 if (vec.size() % LIBMESH_DIM)
1758 "wrong number of values in vector component parameter ",
1762 " is not a multiple of ",
1768 std::vector<T> values;
1769 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1772 for (
int j = 0; j < LIBMESH_DIM; ++j)
1773 value(j) =
Real(vec[i * LIBMESH_DIM + j]);
1774 values.push_back(
value);
1777 param->set() = values;
1781 global_block->
remove(short_name);
1782 global_block->
setVectorParam<T>(short_name).resize(vec.size(), values[0]);
1783 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1788 template <
typename T>
1791 const std::string & full_name,
1792 const std::string & short_name,
1793 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1798 std::string buffer =
root()->param<std::string>(full_name);
1802 std::vector<std::string> first_tokenized_vector;
1804 param->set().resize(first_tokenized_vector.size());
1807 std::vector<std::vector<double>> vecvec(first_tokenized_vector.size());
1808 for (
unsigned j = 0; j < vecvec.size(); ++j)
1809 if (!MooseUtils::tokenizeAndConvert<double>(first_tokenized_vector[j], vecvec[j]))
1812 hit::errormsg(
root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1816 for (
const auto & vec : vecvec)
1817 if (vec.size() % LIBMESH_DIM)
1820 hit::errormsg(
root()->find(full_name),
1821 "wrong number of values in double-indexed vector component parameter ",
1823 ": size of subcomponent ",
1825 " is not a multiple of ",
1832 std::vector<std::vector<T>> values(vecvec.size());
1833 for (
unsigned int id_vec = 0; id_vec < vecvec.size(); ++id_vec)
1834 for (
unsigned int i = 0; i < vecvec[id_vec].size() / LIBMESH_DIM; ++i)
1837 for (
int j = 0; j < LIBMESH_DIM; ++j)
1838 value(j) =
Real(vecvec[id_vec][i * LIBMESH_DIM + j]);
1839 values[id_vec].push_back(
value);
1842 param->set() = values;
1846 global_block->
remove(short_name);
1848 for (
unsigned j = 0; j < vecvec.size(); ++j)
1852 for (
unsigned int i = 0; i < param->get()[j].size() / LIBMESH_DIM; ++i)
1860 Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
1861 const std::string & full_name,
1862 const std::string & short_name,
1863 InputParameters::Parameter<RealVectorValue> * param,
1867 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1872 Builder::setScalarParameter<Point, Point>(
const std::string & full_name,
1873 const std::string & short_name,
1874 InputParameters::Parameter<Point> * param,
1878 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1883 Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
1884 const std::string & full_name,
1885 const std::string & short_name,
1886 InputParameters::Parameter<RealEigenVector> * param,
1890 std::vector<double> vec;
1893 vec = root()->param<std::vector<double>>(full_name);
1895 catch (hit::Error &
err)
1897 _errmsg += hit::errormsg(root()->find(full_name),
err.what()) +
"\n";
1902 for (
unsigned int i = 0; i < vec.size(); ++i)
1905 param->set() =
value;
1908 global_block->remove(short_name);
1915 Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
1916 const std::string & full_name,
1917 const std::string & short_name,
1918 InputParameters::Parameter<RealEigenMatrix> * param,
1923 std::string buffer = root()->param<std::string>(full_name);
1927 std::vector<std::string> first_tokenized_vector;
1930 std::vector<std::vector<Real>> values(first_tokenized_vector.size());
1932 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1934 if (!MooseUtils::tokenizeAndConvert<Real>(first_tokenized_vector[j], values[j]))
1937 hit::errormsg(root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1940 if (j != 0 && values[j].size() != values[0].size())
1943 hit::errormsg(root()->find(full_name),
"invalid format for parameter ", full_name) +
"\n";
1949 for (
unsigned int i = 0; i < values.size(); ++i)
1950 for (
unsigned int j = 0; j < values[i].size(); ++j)
1951 value(i, j) = values[i][j];
1953 param->set() =
value;
1956 global_block->remove(short_name);
1963 Builder::setScalarParameter<MooseEnum, MooseEnum>(
const std::string & full_name,
1964 const std::string & short_name,
1965 InputParameters::Parameter<MooseEnum> * param,
1971 std::string
value = root()->param<std::string>(full_name);
1973 param->set() =
value;
1976 global_block->remove(short_name);
1977 global_block->setScalarParam<
MooseEnum>(short_name) = current_param;
1983 Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
1984 const std::string & full_name,
1985 const std::string & short_name,
1986 InputParameters::Parameter<MultiMooseEnum> * param,
1992 auto vec = root()->param<std::vector<std::string>>(full_name);
1994 std::string raw_values;
1995 for (
unsigned int i = 0; i < vec.size(); ++i)
1996 raw_values +=
' ' + vec[i];
1998 param->set() = raw_values;
2002 global_block->remove(short_name);
2003 global_block->setScalarParam<
MultiMooseEnum>(short_name) = current_param;
2009 Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
2010 const std::string & full_name,
2011 const std::string & short_name,
2012 InputParameters::Parameter<ExecFlagEnum> * param,
2017 auto vec = root()->param<std::vector<std::string>>(full_name);
2019 std::string raw_values;
2020 for (
unsigned int i = 0; i < vec.size(); ++i)
2021 raw_values +=
' ' + vec[i];
2023 param->set() = raw_values;
2027 global_block->remove(short_name);
2028 global_block->setScalarParam<
ExecFlagEnum>(short_name) = current_param;
2034 Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
2035 const std::string & full_name,
2036 const std::string & short_name,
2037 InputParameters::Parameter<RealTensorValue> * param,
2041 auto vec = root()->param<std::vector<double>>(full_name);
2042 if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
2044 _errmsg += hit::errormsg(root()->find(full_name),
2045 "invalid RealTensorValue parameter ",
2050 LIBMESH_DIM * LIBMESH_DIM) +
2056 for (
int i = 0; i < LIBMESH_DIM; ++i)
2057 for (
int j = 0; j < LIBMESH_DIM; ++j)
2058 value(i, j) =
Real(vec[i * LIBMESH_DIM + j]);
2060 param->set() =
value;
2063 global_block->remove(short_name);
2071 Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
2072 const std::string & full_name,
2073 const std::string & short_name,
2074 InputParameters::Parameter<PostprocessorName> * param,
2078 PostprocessorName pps_name = root()->param<std::string>(full_name);
2079 param->set() = pps_name;
2083 global_block->remove(short_name);
2084 global_block->setScalarParam<PostprocessorName>(short_name) = pps_name;
2090 Builder::setScalarParameter<ReporterName, std::string>(
2091 const std::string & full_name,
2092 const std::string & ,
2093 InputParameters::Parameter<ReporterName> * param,
2097 std::vector<std::string> names =
2099 if (names.size() != 2)
2100 _errmsg += hit::errormsg(root()->find(full_name),
2101 "The supplied name ReporterName '",
2103 "' must contain the '/' delimiter.");
2110 Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
2111 const std::string & full_name,
2112 const std::string & short_name,
2113 InputParameters::Parameter<std::vector<RealVectorValue>> * param,
2117 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2122 Builder::setVectorParameter<Point, Point>(
const std::string & full_name,
2123 const std::string & short_name,
2124 InputParameters::Parameter<std::vector<Point>> * param,
2128 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2133 Builder::setVectorParameter<MooseEnum, MooseEnum>(
2134 const std::string & full_name,
2135 const std::string & short_name,
2136 InputParameters::Parameter<std::vector<MooseEnum>> * param,
2140 std::vector<MooseEnum> enum_values = param->get();
2141 std::vector<std::string> values(enum_values.size());
2142 for (
unsigned int i = 0; i < values.size(); ++i)
2143 values[i] = static_cast<std::string>(enum_values[i]);
2149 std::vector<std::string> vec;
2150 if (root()->find(full_name))
2152 vec = root()->param<std::vector<std::string>>(full_name);
2153 param->set().resize(vec.size(), enum_values[0]);
2156 for (
unsigned int i = 0; i < vec.size(); ++i)
2157 param->set()[i] = vec[i];
2161 global_block->remove(short_name);
2162 global_block->setVectorParam<
MooseEnum>(short_name).resize(vec.size(), enum_values[0]);
2163 for (
unsigned int i = 0; i < vec.size(); ++i)
2164 global_block->setVectorParam<
MooseEnum>(short_name)[i] = values[0];
2170 Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
2171 const std::string & full_name,
2172 const std::string & short_name,
2173 InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
2177 const std::vector<MultiMooseEnum> & enum_values = param->get();
2180 std::string buffer = root()->param<std::string>(full_name);
2182 std::vector<std::string> first_tokenized_vector =
MooseUtils::split(buffer,
";");
2183 for (
const auto & i : first_tokenized_vector)
2185 mooseError(
"In " + full_name +
", one entry in the vector is empty. This is not allowed.");
2187 param->set().resize(first_tokenized_vector.size(), enum_values[0]);
2189 std::vector<std::vector<std::string>> vecvec(first_tokenized_vector.size());
2192 MooseUtils::tokenize<std::string>(first_tokenized_vector[i], vecvec[i], 1,
" ");
2193 param->set()[i] = vecvec[i];
2198 global_block->remove(short_name);
2199 global_block->setVectorParam<
MultiMooseEnum>(short_name).resize(vecvec.size(), enum_values[0]);
2200 for (
unsigned int i = 0; i < vecvec.size(); ++i)
2201 global_block->setVectorParam<
MultiMooseEnum>(short_name)[i] = vecvec[i];
2207 Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
2208 const std::string & full_name,
2209 const std::string & short_name,
2210 InputParameters::Parameter<std::vector<PostprocessorName>> * param,
2214 std::vector<std::string> pps_names = root()->param<std::vector<std::string>>(full_name);
2215 unsigned int n = pps_names.
size();
2216 param->set().resize(n);
2218 for (
unsigned int j = 0; j < n; ++j)
2219 param->set()[j] = pps_names[j];
2223 global_block->remove(short_name);
2224 global_block->setVectorParam<PostprocessorName>(short_name).resize(n,
"");
2225 for (
unsigned int j = 0; j < n; ++j)
2226 global_block->setVectorParam<PostprocessorName>(short_name)[j] = pps_names[j];
2236 Builder::setVectorParameter<VariableName, VariableName>(
2237 const std::string & full_name,
2238 const std::string & short_name,
2239 InputParameters::Parameter<std::vector<VariableName>> * param,
2243 auto vec = root()->param<std::vector<std::string>>(full_name);
2244 auto strval = root()->param<std::string>(full_name);
2245 std::vector<VariableName> var_names(vec.size());
2247 bool has_var_names =
false;
2248 for (
unsigned int i = 0; i < vec.size(); ++i)
2250 VariableName var_name = vec[i];
2253 std::istringstream ss(var_name);
2257 if (ss >> real_value && ss.eof())
2258 _current_params->defaultCoupledValue(short_name, real_value, i);
2261 var_names[i] = var_name;
2262 has_var_names =
true;
2268 param->set().resize(vec.size());
2270 for (
unsigned int i = 0; i < vec.size(); ++i)
2271 if (var_names[i] ==
"")
2273 _errmsg += hit::errormsg(root()->find(full_name),
2274 "invalid value for ",
2277 " MOOSE does not currently support a coupled vector where " 2278 "some parameters are ",
2279 "reals and others are variables") +
2284 param->set()[i] = var_names[i];
2290 Builder::setVectorParameter<ReporterName, std::string>(
2291 const std::string & full_name,
2292 const std::string & ,
2293 InputParameters::Parameter<std::vector<ReporterName>> * param,
2297 auto rnames = root()->param<std::vector<std::string>>(full_name);
2298 param->set().resize(rnames.size());
2300 for (
unsigned int i = 0; i < rnames.size(); ++i)
2303 if (names.size() != 2)
2304 _errmsg += hit::errormsg(root()->find(full_name),
2305 "The supplied name ReporterName '",
2307 "' must contain the '/' delimiter.");
2315 Builder::setVectorParameter<CLIArgString, std::string>(
2316 const std::string & full_name,
2317 const std::string & ,
2318 InputParameters::Parameter<std::vector<CLIArgString>> * param,
2323 auto rnames = root()->param<std::vector<std::string>>(full_name);
2324 param->set().resize(rnames.size());
2331 unsigned int i_param = 0;
2332 bool vector_param_detected =
false;
2333 for (
unsigned int i = 0; i < rnames.size(); ++i)
2336 std::vector<std::string> double_split =
2338 std::vector<std::string> single_split =
2340 if (double_split.size() + single_split.size() >= 3)
2343 if ((double_split.size() + single_split.size()) % 2 == 1)
2344 vector_param_detected = !vector_param_detected;
2347 if (vector_param_detected)
2348 param->set()[i_param] += rnames[i] +
' ';
2351 param->set()[i_param] += rnames[i];
2356 param->set().resize(i_param);
2361 Builder::setDoubleIndexParameter<Point>(
2362 const std::string & full_name,
2363 const std::string & short_name,
2364 InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
2368 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)