43 #include "libmesh/parallel.h" 44 #include "libmesh/fparser.hh" 64 hit::Node * n = root->find(path);
67 hit::Node * section = n->parent();
70 auto actives = section->find(
"active");
71 auto inactives = section->find(
"inactive");
74 if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
76 auto vars = section->param<std::vector<std::string>>(
"active");
77 bool have_var =
false;
78 for (
auto & var :
vars)
79 if (n->path() == hit::pathNorm(var))
85 if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
87 auto vars = section->param<std::vector<std::string>>(
"inactive");
88 for (
auto & var :
vars)
89 if (n->path() == hit::pathNorm(var))
98 std::vector<std::string>
99 findSimilar(std::string param, std::vector<std::string> options)
101 std::vector<std::string> candidates;
102 if (options.size() == 0)
106 for (
auto &
opt : options)
110 int dist_cutoff = 1 + param.size() / 5;
111 if (dist > dist_cutoff || dist > mindist)
119 candidates.push_back(
opt);
127 _factory(app.getFactory()),
128 _action_wh(action_wh),
129 _action_factory(app.getActionFactory()),
130 _syntax(_action_wh.syntax()),
132 _root(_parser.getRoot()),
133 _syntax_formatter(nullptr),
134 _current_params(nullptr)
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)
192 "unused parameter '" + fullpath +
"'; did you mean '" + candidates[0] +
"'?", n);
194 errors.emplace_back(
"unused parameter '" + fullpath +
"'", n);
202 return (strip_leading_path ? path.filename() : std::filesystem::absolute(path)).
string();
211 const std::string section_name = n->fullpath();
212 const std::string curr_identifier = n->fullpath();
226 if (
const auto [begin, end] =
_syntax.
getActions(registered_identifier); begin == end)
229 "section '[" + curr_identifier +
230 "]' does not have an associated Action; you likely misspelled the Action/section name " 231 "or the app you are running does not support this Action/syntax",
238 std::set<const Syntax::ActionInfo *> processed_actions;
244 for (; it != end && processed_actions.count(&it->second); ++it)
252 processed_actions.insert(&it->second);
267 params.
set<std::string>(
"task") = it->second._task;
268 params.
set<std::string>(
"registered_identifier") = registered_identifier;
270 if (!(params.
have_parameter<
bool>(
"isObjectAction") && params.
get<
bool>(
"isObjectAction")))
271 params.
set<std::vector<std::string>>(
"control_tags")
275 std::shared_ptr<Action> action_obj =
280 std::shared_ptr<MooseObjectAction> object_action =
287 object_params.set<std::vector<std::string>>(
"control_tags")
291 std::shared_ptr<AddActionComponentAction> component_action =
293 if (component_action)
298 component_params.set<std::vector<std::string>>(
"control_tags")
309 Builder::walk(
const std::string & fullpath,
const std::string & nodepath, hit::Node * n)
315 walkRaw(fullpath, nodepath, n);
339 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
342 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
345 std::copy(syntax.begin(), syntax.end(), std::back_inserter(
_secs_need_first));
349 if (
auto n =
_root.find(sec))
350 walkRaw(n->parent()->fullpath(), n->path(), n);
353 _root.walk(
this, hit::NodeType::Section);
358 std::vector<std::string> messages;
360 messages.push_back(param_message_pair.second);
382 if (!warn_unused && !err_unused)
385 std::vector<hit::ErrorMessage> messages;
400 messages.emplace_back(
"unused command line parameter '" + arg +
"'");
414 "\n\nAppend --allow-unused (or -w) on the command line to ignore unused parameters.");
431 mooseError(
"Unrecognized Syntax Formatter requested");
439 std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
453 if (act_info.
_task ==
"")
456 all_names.push_back(std::make_pair(iter.first, act_info));
460 for (
const auto & act_names : all_names)
462 const auto & act_info = act_names.second;
463 const std::string & action = act_info._action;
464 const std::string & task = act_info._task;
465 const std::string syntax = act_names.first;
479 for (
auto & t : tasks)
492 action_obj_params.
get<
bool>(
"isObjectAction"))
496 auto moose_obj_params = obj->buildParameters();
500 const std::vector<std::string> & buildable_types = action_obj_params.
getBuildableTypes();
503 if ((buildable_types.empty() ||
504 std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
505 buildable_types.end()) &&
506 moose_obj_params.hasBase() &&
514 bool is_action_params =
false;
515 bool is_type =
false;
516 if (syntax[syntax.size() - 1] ==
'*')
521 name = syntax.substr(0, pos - 1) + moose_obj_name;
524 name = syntax.substr(0, pos - 1) +
"/<type>/" + moose_obj_name;
525 is_action_params =
true;
530 name = syntax +
"/<type>/" + moose_obj_name;
533 moose_obj_params.set<std::string>(
"type") = moose_obj_name;
550 if (syntax !=
"ActionComponents/*")
555 for (
auto it = iters.first; it != iters.second; ++it)
558 const auto component_name = it->second;
571 if (syntax[syntax.size() - 1] ==
'*')
573 size_t pos = syntax.size();
574 name = syntax.substr(0, pos - 1) + component_name;
576 component_params.set<std::string>(
"type") = component_name;
584 "AddActionComponentAction",
599 std::vector<std::pair<std::string, Syntax::ActionInfo>> all_names;
609 if (act_info.
_task ==
"")
612 all_names.push_back(std::pair<std::string, Syntax::ActionInfo>(iter.first, act_info));
615 for (
const auto & act_names : all_names)
619 act_names.first, act_names.second._action,
true, &action_obj_params);
621 const std::string & task = act_names.second._task;
622 std::string act_name = act_names.first;
630 action_obj_params.
get<
bool>(
"isObjectAction"))
634 auto moose_obj_params = obj->buildParameters();
639 const std::vector<std::string> & buildable_types = action_obj_params.
getBuildableTypes();
642 if ((buildable_types.empty() ||
643 std::find(buildable_types.begin(), buildable_types.end(), moose_obj_name) !=
644 buildable_types.end()) &&
645 moose_obj_params.hasBase() &&
653 bool is_action_params =
false;
654 if (act_name[act_name.size() - 1] ==
'*')
656 pos = act_name.size();
659 name = act_name.substr(0, pos - 1) + moose_obj_name;
662 name = act_name.substr(0, pos - 1) +
"/<type>/" + moose_obj_name;
663 is_action_params =
true;
668 name = act_name +
"/<type>/" + moose_obj_name;
671 moose_obj_params.set<std::string>(
"type") = moose_obj_name;
692 void Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
693 const std::string & full_name,
694 const std::string & short_name,
695 InputParameters::Parameter<RealVectorValue> * param,
700 void Builder::setScalarParameter<Point, Point>(
const std::string & full_name,
701 const std::string & short_name,
702 InputParameters::Parameter<Point> * param,
707 void Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
708 const std::string & full_name,
709 const std::string & short_name,
710 InputParameters::Parameter<RealEigenVector> * param,
715 void Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
716 const std::string & full_name,
717 const std::string & short_name,
718 InputParameters::Parameter<RealEigenMatrix> * param,
723 void Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
724 const std::string & full_name,
725 const std::string & short_name,
726 InputParameters::Parameter<PostprocessorName> * param,
732 Builder::setScalarParameter<MooseEnum, MooseEnum>(
const std::string & full_name,
733 const std::string & short_name,
734 InputParameters::Parameter<MooseEnum> * param,
739 void Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
740 const std::string & full_name,
741 const std::string & short_name,
742 InputParameters::Parameter<MultiMooseEnum> * param,
747 void Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
748 const std::string & full_name,
749 const std::string & short_name,
750 InputParameters::Parameter<ExecFlagEnum> * param,
755 void Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
756 const std::string & full_name,
757 const std::string & short_name,
758 InputParameters::Parameter<RealTensorValue> * param,
763 void Builder::setScalarParameter<ReporterName, std::string>(
764 const std::string & full_name,
765 const std::string & short_name,
766 InputParameters::Parameter<ReporterName> * param,
772 void Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
773 const std::string & full_name,
774 const std::string & short_name,
775 InputParameters::Parameter<std::vector<RealVectorValue>> * param,
781 Builder::setVectorParameter<Point, Point>(
const std::string & full_name,
782 const std::string & short_name,
783 InputParameters::Parameter<std::vector<Point>> * param,
788 void Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
789 const std::string & full_name,
790 const std::string & short_name,
791 InputParameters::Parameter<std::vector<PostprocessorName>> * param,
796 void Builder::setVectorParameter<MooseEnum, MooseEnum>(
797 const std::string & full_name,
798 const std::string & short_name,
799 InputParameters::Parameter<std::vector<MooseEnum>> * param,
804 void Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
805 const std::string & full_name,
806 const std::string & short_name,
807 InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
812 void Builder::setVectorParameter<VariableName, VariableName>(
813 const std::string & full_name,
814 const std::string & short_name,
815 InputParameters::Parameter<std::vector<VariableName>> * param,
820 void Builder::setVectorParameter<ReporterName, std::string>(
821 const std::string & full_name,
822 const std::string & short_name,
823 InputParameters::Parameter<std::vector<ReporterName>> * param,
828 void Builder::setVectorParameter<CLIArgString, std::string>(
829 const std::string & full_name,
830 const std::string & short_name,
831 InputParameters::Parameter<std::vector<CLIArgString>> * param,
836 void Builder::setDoubleIndexParameter<Point>(
837 const std::string & full_name,
838 const std::string & short_name,
839 InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
846 std::ostringstream error_stream;
847 static const std::string global_params_task =
"set_global_params";
848 static const std::string global_params_block_name =
856 global_params_block = dynamic_cast<GlobalParamsAction *>(*act_iter);
861 for (
const auto & it : p)
863 if (p.shouldIgnore(it.first))
866 const hit::Node * node =
nullptr;
868 bool in_global =
false;
870 const auto found_param =
871 [
this, &found, &node, &p](
const std::string & param_name,
const std::string & full_name)
875 p.set_attributes(param_name,
false);
879 for (
const auto & param_name : p.paramAliases(it.first))
881 std::string full_name = prefix +
"/" + param_name;
884 if (node =
_root.find(full_name); node && node->type() == hit::NodeType::Field)
886 found_param(param_name, full_name);
890 if (
const auto deprecated_message = p.queryDeprecatedParamMessage(param_name))
894 else if (global_params_block)
896 full_name = global_params_block_name +
"/" + param_name;
897 if (node =
_root.find(full_name); node)
899 found_param(param_name, full_name);
906 if (p.isPrivate(param_name) && !in_global)
909 if (std::find_if(
_errors.begin(),
911 [&node](
const auto &
err) {
return err.node == node; }) ==
_errors.end())
912 _errors.emplace_back(
"parameter '" + full_name +
"' is private and cannot be set",
917 else if (p.isPrivate(param_name) && in_global)
920 auto & short_name = param_name;
923 #define setscalarvaltype(ptype, base, range) \ 924 else if (par->type() == demangle(typeid(ptype).name())) \ 925 setScalarValueTypeParameter<ptype, range, base>( \ 928 dynamic_cast<InputParameters::Parameter<ptype> *>(par), \ 930 global_params_block, \ 932 #define setscalar(ptype, base) \ 933 else if (par->type() == demangle(typeid(ptype).name())) \ 934 setScalarParameter<ptype, base>(full_name, \ 936 dynamic_cast<InputParameters::Parameter<ptype> *>(par), \ 939 #define setvector(ptype, base) \ 940 else if (par->type() == demangle(typeid(std::vector<ptype>).name())) \ 941 setVectorParameter<ptype, base>( \ 944 dynamic_cast<InputParameters::Parameter<std::vector<ptype>> *>(par), \ 947 #define setmap(key_type, mapped_type) \ 948 else if (par->type() == demangle(typeid(std::map<key_type, mapped_type>).name())) \ 952 dynamic_cast<InputParameters::Parameter<std::map<key_type, mapped_type>> *>(par), \ 955 #define setvectorvector(ptype) \ 956 else if (par->type() == demangle(typeid(std::vector<std::vector<ptype>>).name())) \ 957 setDoubleIndexParameter<ptype>( \ 960 dynamic_cast<InputParameters::Parameter<std::vector<std::vector<ptype>>> *>(par), \ 963 #define setvectorvectorvector(ptype) \ 964 else if (par->type() == demangle(typeid(std::vector<std::vector<std::vector<ptype>>>).name())) \ 965 setTripleIndexParameter<ptype>( \ 969 InputParameters::Parameter<std::vector<std::vector<std::vector<ptype>>>> *>(par), \ 980 setscalarvaltype(
Real,
double,
Real);
981 setscalarvaltype(
int,
int,
long);
982 setscalarvaltype(
unsigned short,
unsigned int,
long);
983 setscalarvaltype(
long,
int,
long);
984 setscalarvaltype(
unsigned int,
unsigned int,
long);
985 setscalarvaltype(
unsigned long,
unsigned int,
long);
986 setscalarvaltype(
long int, int64_t,
long);
987 setscalarvaltype(
unsigned long long,
unsigned int,
long);
989 setscalar(
bool,
bool);
994 setscalar(
string,
string);
995 setscalar(SubdomainName,
string);
996 setscalar(BoundaryName,
string);
997 setscalar(FileName,
string);
998 setscalar(MeshFileName,
string);
999 setscalar(MatrixFileName,
string);
1000 setscalar(FileNameNoExtension,
string);
1001 setscalar(RelativeFileName,
string);
1002 setscalar(DataFileName,
string);
1003 setscalar(ComponentName,
string);
1004 setscalar(PhysicsName,
string);
1005 setscalar(OutFileBase,
string);
1006 setscalar(VariableName,
string);
1007 setscalar(NonlinearVariableName,
string);
1008 setscalar(LinearVariableName,
string);
1009 setscalar(SolverVariableName,
string);
1010 setscalar(AuxVariableName,
string);
1011 setscalar(FunctionName,
string);
1012 setscalar(ConvergenceName,
string);
1013 setscalar(MeshDivisionName,
string);
1014 setscalar(UserObjectName,
string);
1015 setscalar(VectorPostprocessorName,
string);
1016 setscalar(IndicatorName,
string);
1017 setscalar(MarkerName,
string);
1018 setscalar(MultiAppName,
string);
1019 setscalar(OutputName,
string);
1020 setscalar(MaterialPropertyName,
string);
1021 setscalar(MooseFunctorName,
string);
1022 setscalar(MaterialName,
string);
1023 setscalar(DistributionName,
string);
1024 setscalar(PositionsName,
string);
1025 setscalar(SamplerName,
string);
1026 setscalar(TagName,
string);
1027 setscalar(TimesName,
string);
1028 setscalar(MeshGeneratorName,
string);
1029 setscalar(ExtraElementIDName,
string);
1030 setscalar(PostprocessorName, PostprocessorName);
1031 setscalar(ExecutorName,
string);
1032 setscalar(NonlinearSystemName,
string);
1033 setscalar(LinearSystemName,
string);
1034 setscalar(SolverSystemName,
string);
1035 setscalar(CLIArgString,
string);
1036 #ifdef MOOSE_MFEM_ENABLED 1037 setscalar(MFEMScalarCoefficientName,
string);
1038 setscalar(MFEMVectorCoefficientName,
string);
1039 setscalar(MFEMMatrixCoefficientName,
string);
1044 setscalar(Point, Point);
1052 setscalar(ReporterValueName,
string);
1053 setscalar(ParsedFunctionExpression,
string);
1056 setvector(
bool,
bool);
1057 setvector(
Real,
double);
1058 setvector(
int,
int);
1059 setvector(
long,
int);
1060 setvector(
unsigned int,
int);
1069 #if LIBMESH_DOF_ID_BYTES == 8 1070 setvector(uint64_t,
int);
1076 setvector(Point, Point);
1080 setvector(
string,
string);
1081 setvector(FileName,
string);
1082 setvector(FileNameNoExtension,
string);
1083 setvector(RelativeFileName,
string);
1084 setvector(DataFileName,
string);
1085 setvector(MeshFileName,
string);
1086 setvector(MatrixFileName,
string);
1087 setvector(SubdomainName,
string);
1088 setvector(BoundaryName,
string);
1089 setvector(NonlinearVariableName,
string);
1090 setvector(LinearVariableName,
string);
1091 setvector(SolverVariableName,
string);
1092 setvector(AuxVariableName,
string);
1093 setvector(FunctionName,
string);
1094 setvector(ConvergenceName,
string);
1095 setvector(MeshDivisionName,
string);
1096 setvector(UserObjectName,
string);
1097 setvector(IndicatorName,
string);
1098 setvector(MarkerName,
string);
1099 setvector(MultiAppName,
string);
1100 setvector(PostprocessorName, PostprocessorName);
1101 setvector(VectorPostprocessorName,
string);
1102 setvector(OutputName,
string);
1103 setvector(MaterialPropertyName,
string);
1104 setvector(MooseFunctorName,
string);
1105 setvector(MaterialName,
string);
1106 setvector(DistributionName,
string);
1107 setvector(SamplerName,
string);
1108 setvector(TagName,
string);
1109 setvector(VariableName, VariableName);
1110 setvector(MeshGeneratorName,
string);
1111 setvector(ExtraElementIDName,
string);
1113 setvector(CLIArgString,
string);
1114 setvector(ComponentName,
string);
1115 setvector(PhysicsName,
string);
1116 setvector(PositionsName,
string);
1117 setvector(TimesName,
string);
1118 setvector(ReporterValueName,
string);
1119 setvector(ExecutorName,
string);
1120 setvector(NonlinearSystemName,
string);
1121 setvector(LinearSystemName,
string);
1122 setvector(SolverSystemName,
string);
1123 #ifdef MOOSE_MFEM_ENABLED 1124 setvector(MFEMScalarCoefficientName,
string);
1125 setvector(MFEMVectorCoefficientName,
string);
1126 setvector(MFEMMatrixCoefficientName,
string);
1130 setmap(
string,
unsigned int);
1131 setmap(
string,
Real);
1132 setmap(
string,
string);
1133 setmap(
unsigned int,
unsigned int);
1134 setmap(
unsigned long,
unsigned int);
1135 setmap(
unsigned long long,
unsigned int);
1138 setvectorvector(
Real);
1139 setvectorvector(
int);
1140 setvectorvector(
long);
1141 setvectorvector(
unsigned int);
1142 setvectorvector(
unsigned long long);
1145 #if LIBMESH_DOF_ID_BYTES == 8 1146 setvectorvector(uint64_t);
1151 setvectorvector(Point);
1152 setvectorvector(
string);
1153 setvectorvector(FileName);
1154 setvectorvector(FileNameNoExtension);
1155 setvectorvector(DataFileName);
1156 setvectorvector(MeshFileName);
1157 setvectorvector(MatrixFileName);
1158 setvectorvector(SubdomainName);
1159 setvectorvector(BoundaryName);
1160 setvectorvector(VariableName);
1161 setvectorvector(NonlinearVariableName);
1162 setvectorvector(LinearVariableName);
1163 setvectorvector(SolverVariableName);
1164 setvectorvector(AuxVariableName);
1165 setvectorvector(FunctionName);
1166 setvectorvector(ConvergenceName);
1167 setvectorvector(UserObjectName);
1168 setvectorvector(IndicatorName);
1169 setvectorvector(MarkerName);
1170 setvectorvector(MultiAppName);
1171 setvectorvector(PostprocessorName);
1172 setvectorvector(VectorPostprocessorName);
1173 setvectorvector(MarkerName);
1174 setvectorvector(OutputName);
1175 setvectorvector(MaterialPropertyName);
1176 setvectorvector(MooseFunctorName);
1177 setvectorvector(MaterialName);
1178 setvectorvector(DistributionName);
1179 setvectorvector(SamplerName);
1180 setvectorvector(TagName);
1181 #ifdef MOOSE_MFEM_ENABLED 1182 setvectorvector(MFEMScalarCoefficientName);
1183 setvectorvector(MFEMVectorCoefficientName);
1184 setvectorvector(MFEMMatrixCoefficientName);
1188 setvectorvectorvector(
Real);
1189 setvectorvectorvector(
int);
1190 setvectorvectorvector(
long);
1191 setvectorvectorvector(
unsigned int);
1192 setvectorvectorvector(
unsigned long long);
1195 #if LIBMESH_DOF_ID_BYTES == 8 1196 setvectorvectorvector(uint64_t);
1201 setvectorvectorvector(
string);
1202 setvectorvectorvector(FileName);
1203 setvectorvectorvector(FileNameNoExtension);
1204 setvectorvectorvector(DataFileName);
1205 setvectorvectorvector(MeshFileName);
1206 setvectorvectorvector(MatrixFileName);
1207 setvectorvectorvector(SubdomainName);
1208 setvectorvectorvector(BoundaryName);
1209 setvectorvectorvector(VariableName);
1210 setvectorvectorvector(NonlinearVariableName);
1211 setvectorvectorvector(LinearVariableName);
1212 setvectorvectorvector(AuxVariableName);
1213 setvectorvectorvector(FunctionName);
1214 setvectorvectorvector(UserObjectName);
1215 setvectorvectorvector(IndicatorName);
1216 setvectorvectorvector(MarkerName);
1217 setvectorvectorvector(MultiAppName);
1218 setvectorvectorvector(PostprocessorName);
1219 setvectorvectorvector(VectorPostprocessorName);
1220 setvectorvectorvector(MarkerName);
1221 setvectorvectorvector(OutputName);
1222 setvectorvectorvector(MaterialPropertyName);
1223 setvectorvectorvector(MooseFunctorName);
1224 setvectorvectorvector(MaterialName);
1225 setvectorvectorvector(DistributionName);
1226 setvectorvectorvector(SamplerName);
1230 {{
"unsupported type '" + par->
type() +
"' for input parameter '" + full_name +
"'",
1234 #undef setscalarValueType 1237 #undef setvectorvectorvector 1238 #undef setvectorvector 1256 InputParameters::Parameter<OutFileBase> * scalar_p =
1257 dynamic_cast<InputParameters::Parameter<OutFileBase> *
>(
MooseUtils::get(it.second));
1261 mooseAssert(input_file_name !=
"",
"Input Filename is nullptr");
1262 size_t pos = input_file_name.find_last_of(
'.');
1263 mooseAssert(pos != std::string::npos,
"Unable to determine suffix of input file name");
1264 scalar_p->set() = input_file_name.substr(0, pos) +
"_out";
1265 p.set_attributes(it.first,
false);
1271 std::map<std::string, std::pair<std::string, std::string>> auto_build_vectors =
1272 p.getAutoBuildVectors();
1273 for (
const auto & it : auto_build_vectors)
1278 const std::string & base_name = it.second.first;
1279 const std::string & num_repeat = it.second.second;
1281 if (!p.isParamValid(it.first) && p.isParamValid(base_name) && p.isParamValid(num_repeat))
1283 unsigned int vec_size = p.get<
unsigned int>(num_repeat);
1284 const std::string &
name = p.get<std::string>(base_name);
1286 std::vector<VariableName> variable_names(vec_size);
1287 for (
unsigned int i = 0; i < vec_size; ++i)
1289 std::ostringstream oss;
1291 variable_names[i] = oss.str();
1295 p.set<std::vector<VariableName>>(it.first) = variable_names;
1300 template <
typename T>
1314 template <
typename T,
typename Base>
1317 const std::string & short_name,
1318 InputParameters::Parameter<T> * param,
1322 auto node =
_root.find(full_name,
true);
1325 param->set() = node->param<Base>();
1327 catch (hit::Error &
err)
1329 auto strval = node->param<std::string>();
1331 auto & t =
typeid(T);
1333 if constexpr (std::is_same_v<T, int> || std::is_same_v<T, unsigned int> ||
1334 std::is_same_v<T, SubdomainID> || std::is_same_v<T, BoundaryID> ||
1335 std::is_same_v<T, double>)
1339 param->set() = MooseUtils::convert<T>(strval,
true);
1341 catch (std::invalid_argument & )
1343 const std::string format_type = (t ==
typeid(double)) ?
"float" :
"integer";
1344 _errors.emplace_back(
"invalid " + format_type +
" syntax for parameter: " + full_name +
1345 "='" + strval +
"'",
1349 else if constexpr (std::is_same_v<T, bool>)
1351 if (!
toBool(strval, param->set()))
1353 "invalid boolean syntax for parameter: " + full_name +
"='" + strval +
"'", node);
1361 global_block->
remove(short_name);
1366 template <
typename T,
typename UP_T,
typename Base>
1369 const std::string & short_name,
1370 InputParameters::Parameter<T> * param,
1373 const hit::Node & node)
1375 setScalarParameter<T, Base>(full_name, short_name, param, in_global, global_block);
1383 _errors.emplace_back(error->second, &node);
1386 template <
typename T,
typename Base>
1389 const std::string & short_name,
1390 InputParameters::Parameter<std::vector<T>> * param,
1395 if (
const auto node =
_root.find(full_name))
1399 auto tmp = node->param<std::vector<Base>>();
1400 for (
auto val : tmp)
1403 catch (hit::Error &
err)
1414 global_block->
remove(short_name);
1415 global_block->
setVectorParam<T>(short_name).resize(param->get().size());
1416 for (
unsigned int i = 0; i < vec.size(); ++i)
1417 global_block->
setVectorParam<T>(short_name)[i] = param->get()[i];
1421 template <
typename KeyType,
typename MappedType>
1424 const std::string & short_name,
1425 InputParameters::Parameter<std::map<KeyType, MappedType>> * param,
1429 std::map<KeyType, MappedType> the_map;
1431 if (
const auto node =
_root.find(full_name))
1435 const auto & string_vec = node->param<std::vector<std::string>>();
1436 auto it = string_vec.begin();
1437 while (it != string_vec.end())
1439 const auto & string_key = *it;
1441 if (it == string_vec.end())
1444 "odd number of entries in string vector for map parameter '" + full_name +
1445 "'; there must be " +
1446 "an even number or else you will end up with a key without a value",
1450 const auto & string_value = *it;
1453 std::pair<KeyType, MappedType> pr;
1457 pr.first = MooseUtils::convert<KeyType>(string_key,
true);
1459 catch (std::invalid_argument & )
1461 _errors.emplace_back(
"invalid " + MooseUtils::prettyCppType<KeyType>() +
1462 " syntax for map parameter '" + full_name +
1463 "' key: " + string_key,
1470 pr.second = MooseUtils::convert<MappedType>(string_value,
true);
1472 catch (std::invalid_argument & )
1474 _errors.emplace_back(
"invalid " + MooseUtils::prettyCppType<MappedType>() +
1475 " syntax for map parameter '" + full_name +
1476 "' value: " + string_value,
1481 auto insert_pr = the_map.insert(std::move(pr));
1482 if (!insert_pr.second)
1484 _errors.emplace_back(
"Duplicate map entry for map parameter: '" + full_name +
"'; key '" +
1485 string_key +
"' appears multiple times",
1491 catch (hit::Error &
err)
1498 param->set() = the_map;
1502 global_block->
remove(short_name);
1503 auto & global_map = global_block->
setParam<std::map<KeyType, MappedType>>(short_name);
1504 for (
const auto & pair : the_map)
1505 global_map.insert(pair);
1509 template <
typename T>
1512 const std::string & short_name,
1513 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1517 auto &
value = param->set();
1520 const auto node =
_root.find(full_name,
true);
1527 std::vector<std::string> outer_string_vectors;
1530 if (!value_string.empty())
1533 const auto outer_vector_size = outer_string_vectors.size();
1534 value.resize(outer_vector_size);
1536 for (
const auto j :
index_range(outer_string_vectors))
1537 if (!MooseUtils::tokenizeAndConvert<T>(outer_string_vectors[j],
value[j]))
1539 _errors.emplace_back(
"invalid format for parameter " + full_name, node);
1545 global_block->
remove(short_name);
1547 for (
const auto j :
make_range(outer_vector_size))
1556 template <
typename T>
1559 const std::string & full_name,
1560 const std::string & short_name,
1561 InputParameters::Parameter<std::vector<std::vector<std::vector<T>>>> * param,
1566 auto node =
_root.find(full_name,
true);
1567 const std::string buffer_raw = node->param<std::string>();
1569 if (buffer_raw.find_first_not_of(
' ', 0) == std::string::npos)
1575 buffer.push_back(buffer_raw[0]);
1576 if (buffer[0] ==
'|' || buffer[0] ==
';')
1577 buffer =
' ' + buffer;
1578 for (std::string::size_type i = 1; i < buffer_raw.size(); i++)
1580 if ((buffer_raw[i - 1] ==
'|' || buffer_raw[i - 1] ==
';') &&
1581 (buffer_raw[i] ==
'|' || buffer_raw[i] ==
';'))
1582 buffer.push_back(
' ');
1583 buffer.push_back(buffer_raw[i]);
1585 if (buffer.back() ==
'|' || buffer.back() ==
';')
1586 buffer.push_back(
' ');
1589 std::vector<std::string> first_tokenized_vector;
1590 std::vector<std::vector<std::string>> second_tokenized_vector;
1592 param->set().resize(first_tokenized_vector.size());
1593 second_tokenized_vector.resize(first_tokenized_vector.size());
1594 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1597 if (first_tokenized_vector[j].find_first_not_of(
' ', 0) == std::string::npos)
1599 param->set()[j].resize(0);
1605 param->set()[j].resize(second_tokenized_vector[j].size());
1606 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1607 if (!MooseUtils::tokenizeAndConvert<T>(second_tokenized_vector[j][k], param->set()[j][k]))
1609 _errors.emplace_back(
"invalid format for '" + full_name +
"'", node);
1616 global_block->
remove(short_name);
1618 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1620 global_block->
setTripleIndexParam<T>(short_name)[j].resize(second_tokenized_vector[j].size());
1621 for (
unsigned k = 0; k < second_tokenized_vector[j].size(); ++k)
1624 for (
unsigned int i = 0; i < param->get()[j][k].size(); ++i)
1631 template <
typename T>
1634 const std::string & short_name,
1635 InputParameters::Parameter<T> * param,
1639 auto node =
_root.find(full_name,
true);
1640 std::vector<double> vec;
1643 vec = node->param<std::vector<double>>();
1645 catch (hit::Error &
err)
1651 if (vec.size() != LIBMESH_DIM)
1653 _errors.emplace_back(
"wrong number of values in scalar component parameter '" + full_name +
1654 "': " + short_name +
" was given " + std::to_string(vec.size()) +
1655 " components but should have " + std::to_string(LIBMESH_DIM),
1661 for (
unsigned int i = 0; i < vec.size(); ++i)
1664 param->set() =
value;
1667 global_block->
remove(short_name);
1672 template <
typename T>
1675 const std::string & short_name,
1676 InputParameters::Parameter<std::vector<T>> * param,
1680 auto node =
_root.find(full_name,
true);
1681 std::vector<double> vec;
1684 vec = node->param<std::vector<double>>();
1686 catch (hit::Error &
err)
1692 if (vec.size() % LIBMESH_DIM)
1694 _errors.emplace_back(
"wrong number of values in vector component parameter '" + full_name +
1695 "': size " + std::to_string(vec.size()) +
" is not a multiple of " +
1696 std::to_string(LIBMESH_DIM),
1701 std::vector<T> values;
1702 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1705 for (
int j = 0; j < LIBMESH_DIM; ++j)
1706 value(j) =
Real(vec[i * LIBMESH_DIM + j]);
1707 values.push_back(
value);
1710 param->set() = values;
1714 global_block->
remove(short_name);
1715 global_block->
setVectorParam<T>(short_name).resize(vec.size(), values[0]);
1716 for (
unsigned int i = 0; i < vec.size() / LIBMESH_DIM; ++i)
1721 template <
typename T>
1724 const std::string & full_name,
1725 const std::string & short_name,
1726 InputParameters::Parameter<std::vector<std::vector<T>>> * param,
1731 auto node =
_root.find(full_name,
true);
1732 std::string buffer = node->param<std::string>();
1736 std::vector<std::string> first_tokenized_vector;
1738 param->set().resize(first_tokenized_vector.size());
1741 std::vector<std::vector<double>> vecvec(first_tokenized_vector.size());
1742 for (
unsigned j = 0; j < vecvec.size(); ++j)
1743 if (!MooseUtils::tokenizeAndConvert<double>(first_tokenized_vector[j], vecvec[j]))
1745 _errors.emplace_back(
"invalid format for parameter " + full_name, node);
1749 for (
const auto & vec : vecvec)
1750 if (vec.size() % LIBMESH_DIM)
1752 _errors.emplace_back(
"wrong number of values in double-indexed vector component parameter '" +
1753 full_name +
"': size of subcomponent " + std::to_string(vec.size()) +
1754 " is not a multiple of " + std::to_string(LIBMESH_DIM),
1760 std::vector<std::vector<T>> values(vecvec.size());
1761 for (
unsigned int id_vec = 0; id_vec < vecvec.size(); ++id_vec)
1762 for (
unsigned int i = 0; i < vecvec[id_vec].size() / LIBMESH_DIM; ++i)
1765 for (
int j = 0; j < LIBMESH_DIM; ++j)
1766 value(j) =
Real(vecvec[id_vec][i * LIBMESH_DIM + j]);
1767 values[id_vec].push_back(
value);
1770 param->set() = values;
1774 global_block->
remove(short_name);
1776 for (
unsigned j = 0; j < vecvec.size(); ++j)
1780 for (
unsigned int i = 0; i < param->get()[j].size() / LIBMESH_DIM; ++i)
1788 Builder::setScalarParameter<RealVectorValue, RealVectorValue>(
1789 const std::string & full_name,
1790 const std::string & short_name,
1791 InputParameters::Parameter<RealVectorValue> * param,
1795 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1800 Builder::setScalarParameter<Point, Point>(
const std::string & full_name,
1801 const std::string & short_name,
1802 InputParameters::Parameter<Point> * param,
1806 setScalarComponentParameter(full_name, short_name, param, in_global, global_block);
1811 Builder::setScalarParameter<RealEigenVector, RealEigenVector>(
1812 const std::string & full_name,
1813 const std::string & short_name,
1814 InputParameters::Parameter<RealEigenVector> * param,
1818 std::vector<double> vec;
1821 vec = _root.param<std::vector<double>>(full_name);
1823 catch (hit::Error &
err)
1830 for (
unsigned int i = 0; i < vec.size(); ++i)
1833 param->set() =
value;
1836 global_block->remove(short_name);
1843 Builder::setScalarParameter<RealEigenMatrix, RealEigenMatrix>(
1844 const std::string & full_name,
1845 const std::string & short_name,
1846 InputParameters::Parameter<RealEigenMatrix> * param,
1851 auto node = _root.find(full_name,
true);
1852 std::string buffer = node->param<std::string>();
1856 std::vector<std::string> first_tokenized_vector;
1859 std::vector<std::vector<Real>> values(first_tokenized_vector.size());
1861 for (
unsigned j = 0; j < first_tokenized_vector.size(); ++j)
1863 if (!MooseUtils::tokenizeAndConvert<Real>(first_tokenized_vector[j], values[j]) ||
1864 (j != 0 && values[j].size() != values[0].size()))
1866 _errors.emplace_back(
"invalid format for parameter " + full_name, node);
1872 for (
unsigned int i = 0; i < values.size(); ++i)
1873 for (
unsigned int j = 0; j < values[i].size(); ++j)
1874 value(i, j) = values[i][j];
1876 param->set() =
value;
1879 global_block->remove(short_name);
1886 Builder::setScalarParameter<MooseEnum, MooseEnum>(
const std::string & full_name,
1887 const std::string & short_name,
1888 InputParameters::Parameter<MooseEnum> * param,
1894 std::string
value = _root.param<std::string>(full_name);
1896 param->set() =
value;
1899 global_block->remove(short_name);
1900 global_block->setScalarParam<
MooseEnum>(short_name) = current_param;
1906 Builder::setScalarParameter<MultiMooseEnum, MultiMooseEnum>(
1907 const std::string & full_name,
1908 const std::string & short_name,
1909 InputParameters::Parameter<MultiMooseEnum> * param,
1915 auto vec = _root.param<std::vector<std::string>>(full_name);
1917 std::string raw_values;
1918 for (
unsigned int i = 0; i < vec.size(); ++i)
1919 raw_values +=
' ' + vec[i];
1921 param->set() = raw_values;
1925 global_block->remove(short_name);
1926 global_block->setScalarParam<
MultiMooseEnum>(short_name) = current_param;
1932 Builder::setScalarParameter<ExecFlagEnum, ExecFlagEnum>(
1933 const std::string & full_name,
1934 const std::string & short_name,
1935 InputParameters::Parameter<ExecFlagEnum> * param,
1940 auto vec = _root.param<std::vector<std::string>>(full_name);
1942 std::string raw_values;
1943 for (
unsigned int i = 0; i < vec.size(); ++i)
1944 raw_values +=
' ' + vec[i];
1946 param->set() = raw_values;
1950 global_block->remove(short_name);
1951 global_block->setScalarParam<
ExecFlagEnum>(short_name) = current_param;
1957 Builder::setScalarParameter<RealTensorValue, RealTensorValue>(
1958 const std::string & full_name,
1959 const std::string & short_name,
1960 InputParameters::Parameter<RealTensorValue> * param,
1964 auto node = _root.
find(full_name,
true);
1965 auto vec = node->param<std::vector<double>>();
1966 if (vec.size() != LIBMESH_DIM * LIBMESH_DIM)
1968 _errors.emplace_back(
"invalid RealTensorValue parameter '" + full_name +
"': size is " +
1969 std::to_string(vec.size()) +
" but should be " +
1970 std::to_string(LIBMESH_DIM * LIBMESH_DIM),
1976 for (
int i = 0; i < LIBMESH_DIM; ++i)
1977 for (
int j = 0; j < LIBMESH_DIM; ++j)
1978 value(i, j) =
Real(vec[i * LIBMESH_DIM + j]);
1980 param->set() =
value;
1983 global_block->remove(short_name);
1991 Builder::setScalarParameter<PostprocessorName, PostprocessorName>(
1992 const std::string & full_name,
1993 const std::string & short_name,
1994 InputParameters::Parameter<PostprocessorName> * param,
1998 PostprocessorName pps_name = _root.param<std::string>(full_name);
1999 param->set() = pps_name;
2003 global_block->remove(short_name);
2004 global_block->setScalarParam<PostprocessorName>(short_name) = pps_name;
2010 Builder::setScalarParameter<ReporterName, std::string>(
2011 const std::string & full_name,
2012 const std::string & ,
2013 InputParameters::Parameter<ReporterName> * param,
2017 auto node = _root.find(full_name,
true);
2018 std::vector<std::string> names =
MooseUtils::rsplit(node->param<std::string>(),
"/", 2);
2019 if (names.size() != 2)
2020 _errors.emplace_back(
2021 "The supplied name ReporterName '" + full_name +
"' must contain the '/' delimiter.", node);
2028 Builder::setVectorParameter<RealVectorValue, RealVectorValue>(
2029 const std::string & full_name,
2030 const std::string & short_name,
2031 InputParameters::Parameter<std::vector<RealVectorValue>> * param,
2035 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2040 Builder::setVectorParameter<Point, Point>(
const std::string & full_name,
2041 const std::string & short_name,
2042 InputParameters::Parameter<std::vector<Point>> * param,
2046 setVectorComponentParameter(full_name, short_name, param, in_global, global_block);
2051 Builder::setVectorParameter<MooseEnum, MooseEnum>(
2052 const std::string & full_name,
2053 const std::string & short_name,
2054 InputParameters::Parameter<std::vector<MooseEnum>> * param,
2058 std::vector<MooseEnum> enum_values = param->get();
2059 std::vector<std::string> values(enum_values.size());
2060 for (
unsigned int i = 0; i < values.size(); ++i)
2061 values[i] = static_cast<std::string>(enum_values[i]);
2067 std::vector<std::string> vec;
2068 if (
auto node = _root.find(full_name,
true))
2070 vec = node->param<std::vector<std::string>>();
2071 param->set().resize(vec.size(), enum_values[0]);
2074 for (
unsigned int i = 0; i < vec.size(); ++i)
2075 param->set()[i] = vec[i];
2079 global_block->remove(short_name);
2080 global_block->setVectorParam<
MooseEnum>(short_name).resize(vec.size(), enum_values[0]);
2081 for (
unsigned int i = 0; i < vec.size(); ++i)
2082 global_block->setVectorParam<
MooseEnum>(short_name)[i] = values[0];
2088 Builder::setVectorParameter<MultiMooseEnum, MultiMooseEnum>(
2089 const std::string & full_name,
2090 const std::string & short_name,
2091 InputParameters::Parameter<std::vector<MultiMooseEnum>> * param,
2095 const auto node = _root.
find(full_name,
true);
2096 const std::vector<MultiMooseEnum> & enum_values = param->get();
2099 std::string buffer = node->param<std::string>();
2101 bool has_empty =
false;
2103 for (
const auto i :
index_range(first_tokenized_vector))
2105 const auto & entry = first_tokenized_vector[i];
2109 _errors.emplace_back(
"entry " + std::to_string(i) +
" in '" + node->fullpath() +
"' is empty",
2117 param->set().resize(first_tokenized_vector.size(), enum_values[0]);
2119 std::vector<std::vector<std::string>> vecvec(first_tokenized_vector.size());
2122 MooseUtils::tokenize<std::string>(first_tokenized_vector[i], vecvec[i], 1,
" ");
2123 param->set()[i] = vecvec[i];
2128 global_block->remove(short_name);
2129 global_block->setVectorParam<
MultiMooseEnum>(short_name).resize(vecvec.size(), enum_values[0]);
2130 for (
unsigned int i = 0; i < vecvec.size(); ++i)
2131 global_block->setVectorParam<
MultiMooseEnum>(short_name)[i] = vecvec[i];
2137 Builder::setVectorParameter<PostprocessorName, PostprocessorName>(
2138 const std::string & full_name,
2139 const std::string & short_name,
2140 InputParameters::Parameter<std::vector<PostprocessorName>> * param,
2144 std::vector<std::string> pps_names = _root.param<std::vector<std::string>>(full_name);
2145 unsigned int n = pps_names.
size();
2146 param->set().resize(n);
2148 for (
unsigned int j = 0; j < n; ++j)
2149 param->set()[j] = pps_names[j];
2153 global_block->remove(short_name);
2154 global_block->setVectorParam<PostprocessorName>(short_name).resize(n,
"");
2155 for (
unsigned int j = 0; j < n; ++j)
2156 global_block->setVectorParam<PostprocessorName>(short_name)[j] = pps_names[j];
2166 Builder::setVectorParameter<VariableName, VariableName>(
2167 const std::string & full_name,
2168 const std::string & short_name,
2169 InputParameters::Parameter<std::vector<VariableName>> * param,
2173 auto node = _root.find(full_name,
true);
2174 auto vec = node->param<std::vector<std::string>>();
2175 auto strval = node->param<std::string>();
2176 std::vector<VariableName> var_names(vec.size());
2178 bool has_var_names =
false;
2179 for (
unsigned int i = 0; i < vec.size(); ++i)
2181 VariableName var_name = vec[i];
2184 std::istringstream ss(var_name);
2188 if (ss >> real_value && ss.eof())
2189 _current_params->defaultCoupledValue(short_name, real_value, i);
2192 var_names[i] = var_name;
2193 has_var_names =
true;
2199 param->set().resize(vec.size());
2201 for (
unsigned int i = 0; i < vec.size(); ++i)
2202 if (var_names[i] ==
"")
2203 _errors.emplace_back(
"invalid value for '" + full_name +
2204 "': coupled vectors where some parameters are reals and others " 2205 "are variables are not supported",
2208 param->set()[i] = var_names[i];
2214 Builder::setVectorParameter<ReporterName, std::string>(
2215 const std::string & full_name,
2216 const std::string & ,
2217 InputParameters::Parameter<std::vector<ReporterName>> * param,
2221 auto node = _root.find(full_name,
true);
2222 auto rnames = node->param<std::vector<std::string>>();
2223 param->set().resize(rnames.size());
2225 for (
unsigned int i = 0; i < rnames.size(); ++i)
2228 if (names.size() != 2)
2229 _errors.emplace_back(
"the supplied name ReporterName '" + rnames[i] +
2230 "' must contain the '/' delimiter",
2239 Builder::setVectorParameter<CLIArgString, std::string>(
2240 const std::string & full_name,
2241 const std::string & ,
2242 InputParameters::Parameter<std::vector<CLIArgString>> * param,
2247 auto rnames = _root.param<std::vector<std::string>>(full_name);
2248 param->set().resize(rnames.size());
2255 unsigned int i_param = 0;
2256 bool vector_param_detected =
false;
2257 for (
unsigned int i = 0; i < rnames.size(); ++i)
2260 std::vector<std::string> double_split =
2262 std::vector<std::string> single_split =
2264 if (double_split.size() + single_split.size() >= 3)
2267 if ((double_split.size() + single_split.size()) % 2 == 1)
2268 vector_param_detected = !vector_param_detected;
2271 if (vector_param_detected)
2272 param->set()[i_param] += rnames[i] +
' ';
2275 param->set()[i_param] += rnames[i];
2280 param->set().resize(i_param);
2285 Builder::setDoubleIndexParameter<Point>(
2286 const std::string & full_name,
2287 const std::string & short_name,
2288 InputParameters::Parameter<std::vector<std::vector<Point>>> * param,
2292 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...
void addSyntaxType(const std::string &path, const std::string type)
Add an associated type to a block.
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
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
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...
void walkRaw(std::string fullpath, std::string nodepath, hit::Node *n)
void parseError(std::vector< hit::ErrorMessage > messages) const
Helper for throwing an error with the given messages.
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 ...
Parser & _parser
The front parser.
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.
void setScalarValueTypeParameter(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, bool in_global, GlobalParamsAction *global_block, const hit::Node &node)
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...
void addActionTask(const std::string &path, const std::string &action, const std::string &task, const FileLineInfo &lineinfo)
Add a task to the tree.
std::shared_ptr< CommandLine > commandLine() const
Get the command line.
std::vector< std::string > _secs_need_first
The sections that we need to execute first (read during the final walk)
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.
Builder(MooseApp &app, ActionWarehouse &action_wh, Parser &parser)
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.
const std::set< std::string > & getExtractedVars() const
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.
static void appendErrorMessages(std::vector< hit::ErrorMessage > &to, const std::vector< hit::ErrorMessage > &from)
Helper for accumulating errors from a walker into an accumulation of errors.
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.
hit::Node & _root
The root node from the Parser.
std::set< std::string > _extracted_vars
The set of all variables extracted from the input file.
bool addParameters(const std::string &parent_path, const std::string &path, bool is_type, const std::string &action, bool is_action, InputParameters *params, const FileLineInfo &lineinfo, const std::string &classname)
Add parameters to the tree.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static std::string joinErrorMessages(const std::vector< hit::ErrorMessage > &error_messages)
Helper for combining error messages into a single, newline separated message.
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
void initSyntaxFormatter(SyntaxFormatterType type, bool dump_mode)
Creates a syntax formatter for printing.
bool getThrowOnError() const
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::vector< hit::ErrorMessage > errors
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...
void mooseDeprecatedStream(S &oss, const bool expired, const bool print_title, Args &&... args)
std::vector< hit::ErrorMessage > _errors
The errors accumulated during the walk.
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...
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...
const hit::Node & getCommandLineRoot() const
IntRange< T > make_range(T beg, T end)
void addGlobal()
Add the global section to the output.
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...
std::filesystem::path getLastInputFilePath() const
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)
std::unordered_map< std::string, std::string > _deprecated_params
Deprecation warnings.
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.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
bool isSectionActive(std::string path, hit::Node *root)
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
auto index_range(const T &sizable)
The Reporter system is comprised of objects that can contain any number of data values.
Class for parsing input files.
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)