https://mooseframework.inl.gov
InputParameters.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "MooseUtils.h"
14 #include "MooseError.h"
15 #include "MooseTypes.h"
16 #include "MultiMooseEnum.h"
17 #include "ExecFlagEnum.h"
18 #include "Conversion.h"
19 #include "DataFileUtils.h"
20 
21 #include "libmesh/parameters.h"
22 
23 #ifdef LIBMESH_HAVE_FPARSER
24 #include "libmesh/fparser.hh"
25 #else
26 template <typename T>
28 {
29 }
30 #endif
31 
32 #include <tuple>
33 #include <unordered_map>
34 #include <mutex>
35 #include <optional>
36 #include <filesystem>
37 #include <regex>
38 
39 #include <gtest/gtest.h>
40 
41 // Forward declarations
42 class Action;
43 class ActionFactory;
44 class Factory;
45 class FEProblemBase;
46 class InputParameters;
47 class MooseEnum;
48 class MooseObject;
49 class MultiMooseEnum;
50 class Problem;
51 namespace hit
52 {
53 class Node;
54 }
55 namespace Moose
56 {
57 class Builder;
58 }
59 class CommandLine;
60 
66 {
67 public:
68  InputParameters(const InputParameters & rhs);
69  InputParameters(const Parameters & rhs);
70 
71  virtual ~InputParameters() = default;
72 
73  virtual void clear() override;
74 
79  {
81  {
85  };
86 
88  std::string syntax;
90  std::vector<std::string> switches;
94  bool required;
96  bool set_by_command_line = false;
98  bool global = false;
99  };
100 
106  {
107  friend class Action;
108  friend class ActionFactory;
109  friend class Moose::Builder;
110  friend class Factory;
111  friend class FEProblemBase;
112  friend class InputParameters;
113  FRIEND_TEST(InputParametersTest, fileNames);
116  };
117 
123  {
124  friend class Moose::Builder;
125  FRIEND_TEST(InputParametersTest, fileNames);
128  };
129 
137  template <typename T>
139  {
140  static constexpr bool value =
141  std::is_same_v<T, std::string> || std::is_same_v<T, std::vector<std::string>> ||
142  std::is_same_v<T, Real> || std::is_same_v<T, unsigned int> || std::is_same_v<T, int> ||
143  std::is_same_v<T, bool> || std::is_same_v<T, MooseEnum>;
144  };
145 
150  void addClassDescription(const std::string & doc_string);
151 
155  std::string getClassDescription() const;
156 
160  virtual void set_attributes(const std::string & name, bool inserted_only) override;
161 
165  std::optional<std::string> queryDeprecatedParamMessage(const std::string & name) const;
166 
168  template <typename T>
169  void setHelper(const std::string & name);
170 
186  template <typename T>
187  T & set(const std::string & name, bool quiet_mode = false);
188 
200  template <typename T, typename... Ts>
201  void setParameters(const std::string & name, const T & value, Ts... extra_input_parameters);
202 
210  template <typename T, typename UP_T>
212  std::optional<std::pair<bool, std::string>> rangeCheck(const std::string & full_name,
213  const std::string & short_name,
214  InputParameters::Parameter<T> * param,
215  const bool include_param_path = true);
216  template <typename T, typename UP_T>
217  std::optional<std::pair<bool, std::string>>
218  rangeCheck(const std::string & full_name,
219  const std::string & short_name,
220  InputParameters::Parameter<std::vector<T>> * param,
221  const bool include_param_path = true);
223 
227  template <typename T>
228  T getCheckedPointerParam(const std::string & name, const std::string & error_string = "") const;
229 
235  template <typename T>
236  void addRequiredParam(const std::string & name, const std::string & doc_string);
237 
242  template <typename T>
243  void
244  addRequiredParam(const std::string & name, const T & moose_enum, const std::string & doc_string);
245 
247 
253  template <typename T, typename S>
254  void addParam(const std::string & name, const S & value, const std::string & doc_string);
255  template <typename T>
256  void addParam(const std::string & name, const std::string & doc_string);
258 
262  template <typename T>
263  void addParam(const std::string & name,
264  const std::initializer_list<typename T::value_type> & value,
265  const std::string & doc_string)
266  {
267  addParam<T>(name, T{value}, doc_string);
268  }
269 
271  // BEGIN RANGE CHECKED PARAMETER METHODS
276  template <typename T>
277  void addRequiredRangeCheckedParam(const std::string & name,
278  const std::string & parsed_function,
279  const std::string & doc_string);
280  template <typename T>
281  void addRangeCheckedParam(const std::string & name,
282  const T & value,
283  const std::string & parsed_function,
284  const std::string & doc_string);
285  template <typename T>
286  void addRangeCheckedParam(const std::string & name,
287  const std::string & parsed_function,
288  const std::string & doc_string);
289  // END RANGE CHECKED PARAMETER METHODS
291 
296  template <typename T>
297  void addRequiredCustomTypeParam(const std::string & name,
298  const std::string & custom_type,
299  const std::string & doc_string);
300  template <typename T>
301  void addCustomTypeParam(const std::string & name,
302  const T & value,
303  const std::string & custom_type,
304  const std::string & doc_string);
305  template <typename T>
306  void addCustomTypeParam(const std::string & name,
307  const std::string & custom_type,
308  const std::string & doc_string);
309  template <typename T>
310  void addDeprecatedCustomTypeParam(const std::string & name,
311  const std::string & custom_type,
312  const std::string & doc_string,
313  const std::string & deprecation_msg);
314 
321  template <typename T>
322  void addPrivateParam(const std::string & name, const T & value);
323  template <typename T>
324  void addPrivateParam(const std::string & name);
325 
335  template <typename T>
336  void addRequiredCommandLineParam(const std::string & name,
337  const std::string & syntax,
338  const std::string & doc_string);
339  template <typename T>
340  void addCommandLineParam(const std::string & name,
341  const std::string & syntax,
342  const std::string & doc_string);
343  template <typename T>
344  void addCommandLineParam(const std::string & name,
345  const std::string & syntax,
346  const T & value,
347  const std::string & doc_string);
348  template <typename T>
349  void addCommandLineParam(const std::string & name,
350  const std::string & syntax,
351  const std::initializer_list<typename T::value_type> & value,
352  const std::string & doc_string)
353  {
354  addCommandLineParam<T>(name, syntax, T{value}, doc_string);
355  }
356 
374  template <typename T>
375  void addOptionalValuedCommandLineParam(const std::string & name,
376  const std::string & syntax,
377  const T & value,
378  const std::string & doc_string);
379 
385  void setGlobalCommandLineParam(const std::string & name);
386 
394  template <typename T>
395  void addDeprecatedParam(const std::string & name,
396  const T & value,
397  const std::string & doc_string,
398  const std::string & deprecation_message);
399 
400  template <typename T>
401  void addDeprecatedParam(const std::string & name,
402  const std::string & doc_string,
403  const std::string & deprecation_message);
404 
414  template <typename T>
415  void checkConsistentType(const std::string & name) const;
416 
420  bool isCommandLineParameter(const std::string & name) const;
421 
427  std::optional<InputParameters::CommandLineMetadata>
428  queryCommandLineMetadata(const std::string & name) const;
429 
434  getCommandLineMetadata(const std::string & name) const;
435 
441  {
442  friend class CommandLine;
443  FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam);
446  };
452  void commandLineParamSet(const std::string & name, const CommandLineParamSetKey);
453 
457  const std::string & getDescription(const std::string & name) const;
458 
464  void addParamNamesToGroup(const std::string & space_delim_names, const std::string group_name);
465 
471  void renameParameterGroup(const std::string & old_name, const std::string & new_name);
472 
477  std::string getGroupName(const std::string & param_name) const;
478 
485  template <typename T>
486  void suppressParameter(const std::string & name);
487 
492  template <typename T>
493  void makeParamRequired(const std::string & name);
494 
499  template <typename T>
500  void makeParamNotRequired(const std::string & name);
501 
507  void addCoupledVar(const std::string & name, const std::string & doc_string);
508 
516  void addDeprecatedCoupledVar(const std::string & old_name,
517  const std::string & new_name,
518  const std::string & removal_date = "");
519 
528  void addCoupledVar(const std::string & name, const Real value, const std::string & doc_string);
529 
538  void addCoupledVar(const std::string & name,
539  const std::vector<Real> & value,
540  const std::string & doc_string);
541 
543 
560  void addCoupledVarWithAutoBuild(const std::string & name,
561  const std::string & base_name,
562  const std::string & num_name,
563  const std::string & doc_string);
564  void addRequiredCoupledVarWithAutoBuild(const std::string & name,
565  const std::string & base_name,
566  const std::string & num_name,
567  const std::string & doc_string);
569 
575  std::string getMooseType(const std::string & name) const;
576  std::vector<std::string> getVecMooseType(const std::string & name) const;
577 
585  bool isMooseBaseObject() const;
589  const std::string & getObjectType() const;
593  const std::string & getObjectName() const;
594 
604  void addRequiredCoupledVar(const std::string & name, const std::string & doc_string);
605 
609  std::string getDocString(const std::string & name) const;
610 
618  void setDocString(const std::string & name, const std::string & doc);
619 
623  std::string getDocUnit(const std::string & name) const;
624 
631  void setDocUnit(const std::string & name, const std::string & doc_unit);
632 
636  bool isParamRequired(const std::string & name) const;
637 
641  void makeParamNotRequired(const std::string & name);
642 
648  bool isParamValid(const std::string & name) const;
649 
655  bool isParamSetByAddParam(const std::string & name) const;
656 
660  bool isParamDeprecated(const std::string & name) const;
661 
666  bool areAllRequiredParamsValid() const;
667 
671  std::string type(const std::string & name) const;
672 
676  bool isPrivate(const std::string & name) const;
677 
681  void declareControllable(const std::string & name, std::set<ExecFlagType> execute_flags = {});
682 
686  void markControlled(const std::string & name);
687 
691  bool isControllable(const std::string & name) const;
692 
696  const std::set<ExecFlagType> & getControllableExecuteOnTypes(const std::string & name) const;
697 
703  void registerBase(const std::string & value);
704 
710  bool hasBase() const;
711 
717  const std::string & getBase() const;
718 
730  void registerSystemAttributeName(const std::string & value);
731 
736  const std::string & getSystemAttributeName() const;
737 
745  void registerBuildableTypes(const std::string & names);
746 
762  const std::string & name,
764  Moose::RelationshipManagerInputParameterCallback input_parameter_callback = nullptr);
765 
770 
774  const std::vector<std::string> & getBuildableTypes() const;
775 
779  const std::vector<std::tuple<std::string,
783 
785 
789  void collapseSyntaxNesting(bool collapse);
790  bool collapseSyntaxNesting() const;
792 
794 
798  void mooseObjectSyntaxVisibility(bool visibility);
799  bool mooseObjectSyntaxVisibility() const;
801 
803 
806  using Parameters::operator=;
807  using Parameters::operator+=;
811 
818  void checkParams(const std::string & parsing_syntax);
819 
827  void finalize(const std::string & parsing_syntax);
828 
842  std::filesystem::path
843  getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
844 
849  inline std::set<std::string>::const_iterator coupledVarsBegin() const
850  {
851  return _coupled_vars.begin();
852  }
853  inline std::set<std::string>::const_iterator coupledVarsEnd() const
854  {
855  return _coupled_vars.end();
856  }
857 
861  const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
862 
866  const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
867  {
869  }
870 
872  bool isRangeChecked(const std::string & param_name) const;
873 
875  std::string rangeCheckedFunction(const std::string & name) const;
876 
878  bool hasDefault(const std::string & param_name) const;
879 
885  bool hasCoupledValue(const std::string & coupling_name) const;
886 
892  bool hasDefaultCoupledValue(const std::string & coupling_name) const;
893 
900  Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
901 
907  unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
908 
916  void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
917 
921  std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
922 
923  // BEGIN APPLY PARAMETER METHODS
941  void applyParameters(const InputParameters & common,
942  const std::vector<std::string> & exclude = {},
943  const bool allow_private = false);
944 
962  void applySpecificParameters(const InputParameters & common,
963  const std::vector<std::string> & include,
964  bool allow_private = false);
965 
978  void applyParameter(const InputParameters & common,
979  const std::string & common_name,
980  bool allow_private = false,
981  bool override_default = false);
982  // END APPLY PARAMETER METHODS
983 
994  void applyCoupledVar(const InputParameters & common, const std::string & var_name);
995 
999  bool paramSetByUser(const std::string & name) const;
1000 
1005  bool isParamSetByUser(const std::string & name) const;
1006 
1012  bool isParamDefined(const std::string & name) const;
1013 
1015  /*
1016  * These methods are here to retrieve parameters for scalar and vector types respectively. We will
1017  * throw errors
1018  * when returning most scalar and vector types.
1019  */
1020  template <typename T>
1021  static const T & getParamHelper(const std::string & name, const InputParameters & pars);
1023 
1024  using Parameters::get;
1025 
1027  template <typename R1,
1028  typename R2,
1029  typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1031  std::vector<R1>>::type,
1032  typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1034  std::vector<R2>>::type>
1035  std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
1036 
1040  std::set<std::string> getParametersList() const;
1041 
1045  std::set<std::string> getControllableParameters() const;
1046 
1050  std::set<std::string> getGroupParameters(const std::string & group) const;
1051 
1056  void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
1057 
1062  std::set<std::string> reservedValues(const std::string & name) const;
1063 
1068  std::string blockLocation() const;
1069 
1074  std::string blockFullpath() const;
1075 
1079  const hit::Node * getHitNode(const std::string & param) const;
1085  void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
1086 
1091  std::string inputLocation(const std::string & param) const;
1092 
1097  std::string paramFullpath(const std::string & param) const;
1098 
1102  std::string paramLocationPrefix(const std::string & param) const;
1103 
1111  template <typename... Args>
1112  std::string paramMessage(const std::string & param, Args... args) const;
1113 
1117  template <typename... Args>
1118  [[noreturn]] void mooseError(Args &&... args) const;
1119 
1124  template <typename... Args>
1125  [[noreturn]] void paramError(const std::string & param, Args... args) const;
1126 
1131  std::string rawParamVal(const std::string & param) const;
1132 
1137  template <typename T>
1138  void ignoreParameter(const std::string & name);
1139 
1144  bool shouldIgnore(const std::string & name);
1145 
1149  template <typename T>
1150  bool isType(const std::string & name) const;
1151 
1158  std::string varName(const std::string & var_param_name,
1159  const std::string & moose_object_with_var_param_name) const;
1160 
1168  void renameParam(const std::string & old_name,
1169  const std::string & new_name,
1170  const std::string & new_docstring);
1171 
1178  void renameCoupledVar(const std::string & old_name,
1179  const std::string & new_name,
1180  const std::string & new_docstring);
1181 
1182  void deprecateParam(const std::string & old_name,
1183  const std::string & new_name,
1184  const std::string & removal_date);
1185 
1186  void deprecateCoupledVar(const std::string & old_name,
1187  const std::string & new_name,
1188  const std::string & removal_date);
1189 
1196  std::string checkForRename(const std::string & name) const;
1197 
1204  template <typename T>
1205  const T & get(std::string_view name) const;
1206 
1215  template <typename T>
1216  bool have_parameter(std::string_view name) const;
1217 
1225  template <typename T>
1226  void transferParam(const InputParameters & source_param,
1227  const std::string & name,
1228  const std::string & new_name = "",
1229  const std::string & new_description = "");
1230 
1243  std::vector<std::string> paramAliases(const std::string & param_name) const;
1244 
1249  const hit::Node * getHitNode() const { return _hit_node; }
1257  void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1258 
1262  bool isFinalized() const { return _finalized; }
1263 
1267  std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1268 
1269 private:
1270  // Private constructor so that InputParameters can only be created in certain places.
1271  InputParameters();
1272 
1276  void setParameters() {}
1277 
1278  template <typename T>
1279  static constexpr bool isFunctorNameType();
1280 
1284  template <typename T>
1285  std::string appendFunctorDescription(const std::string & doc_string) const;
1286 
1290  void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1291 
1292  void renameParamInternal(const std::string & old_name,
1293  const std::string & new_name,
1294  const std::string & docstring,
1295  const std::string & removal_date);
1296 
1297  void renameCoupledVarInternal(const std::string & old_name,
1298  const std::string & new_name,
1299  const std::string & docstring,
1300  const std::string & removal_date);
1301 
1308  std::pair<std::string, const hit::Node *> paramMessageContext(const std::string & param) const;
1314  std::string paramMessagePrefix(const std::string & param) const;
1315 
1316  struct Metadata
1317  {
1318  std::string _doc_string;
1320  std::string _doc_unit;
1322  std::string _custom_type;
1324  std::optional<CommandLineMetadata> _cl_data;
1326  std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1328  std::string _group;
1330  std::string _range_function;
1332  std::pair<std::string, std::string> _autobuild_vecs;
1334  bool _required = false;
1340  bool _valid = false;
1342  bool _is_private = false;
1345  std::vector<Real> _coupled_default = {0};
1347  bool _set_by_add_param = false;
1349  std::set<std::string> _reserved_values;
1353  const hit::Node * _hit_node;
1355  bool _controllable = false;
1357  std::set<ExecFlagType> _controllable_flags;
1359  bool _ignore = false;
1360  };
1361 
1362  Metadata & at(const std::string & param_name)
1363  {
1364  const auto param = checkForRename(param_name);
1365  if (_params.count(param) == 0)
1366  mooseError("param '", param, "' not present in InputParams");
1367  return _params[param];
1368  }
1369  const Metadata & at(const std::string & param_name) const
1370  {
1371  const auto param = checkForRename(param_name);
1372  if (_params.count(param) == 0)
1373  mooseError("param '", param, "' not present in InputParams");
1374  return _params.at(param);
1375  }
1376 
1387 
1391  void checkParamName(const std::string & name) const;
1392 
1397  template <typename T, typename S>
1398  void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1399 
1408  template <typename T>
1409  void addCommandLineParamHelper(const std::string & name,
1410  const std::string & syntax,
1411  const bool required,
1412  const bool value_required);
1413 
1418  [[noreturn]] void callMooseError(std::string msg,
1419  const bool with_prefix = true,
1420  const hit::Node * node = nullptr) const;
1421 
1424  std::map<std::string, Metadata> _params;
1425 
1427  std::set<std::string> _coupled_vars;
1428 
1431  std::string _class_description;
1432 
1435  std::vector<std::string> _buildable_types;
1436 
1441  std::vector<std::tuple<std::string,
1445 
1449 
1452 
1456 
1459 
1461  std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1462 
1467  std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1468 
1471  std::multimap<std::string, std::string> _new_to_old_names;
1472 
1474  const hit::Node * _hit_node;
1475 
1478 
1479  // These are the only objects allowed to _create_ InputParameters
1482  friend class Parser;
1483  // for the printInputFile function in the action warehouse
1484  friend class ActionWarehouse;
1485 };
1486 
1487 template <typename T>
1488 void
1489 InputParameters::setHelper(const std::string & /*name*/)
1490 {
1491 }
1492 
1493 // Template and inline function implementations
1494 template <typename T>
1495 T &
1496 InputParameters::set(const std::string & name_in, bool quiet_mode)
1497 {
1498  const auto name = checkForRename(name_in);
1499 
1501  checkConsistentType<T>(name);
1502 
1503  T & result = this->Parameters::set<T>(name);
1504 
1505  if (quiet_mode)
1506  _params[name]._set_by_add_param = true;
1507 
1508  setHelper<T>(name);
1509 
1510  return result;
1511 }
1512 
1513 template <typename T, typename... Ts>
1514 void
1515 InputParameters::setParameters(const std::string & name,
1516  const T & value,
1517  Ts... extra_input_parameters)
1518 {
1519  this->set<T>(name) = value;
1520  this->setParameters(extra_input_parameters...);
1521 }
1522 
1523 template <typename T, typename UP_T>
1524 std::optional<std::pair<bool, std::string>>
1525 InputParameters::rangeCheck(const std::string & full_name,
1526  const std::string & short_name,
1527  InputParameters::Parameter<std::vector<T>> * param,
1528  const bool include_param_path)
1529 {
1530  mooseAssert(param, "Parameter is NULL");
1531 
1532  if (!isParamValid(short_name))
1533  return {};
1534 
1535  const auto & range_function = _params[short_name]._range_function;
1536  if (range_function.empty())
1537  return {};
1538 
1551  std::vector<std::string> vars;
1552  if (fp.ParseAndDeduceVariables(range_function, vars) != -1) // -1 for success
1553  return {{false,
1554  "Error parsing expression '" + range_function + "' for parameter " + short_name + ""}};
1555 
1556  // Fparser parameter buffer
1557  std::vector<UP_T> parbuf(vars.size());
1558 
1559  // parameter vector
1560  const std::vector<T> & value = param->set();
1561 
1562  // iterate over all vector values (maybe ;)
1563  bool need_to_iterate = false;
1564  unsigned int i = 0;
1565  do
1566  {
1567  // set parameters
1568  for (unsigned int j = 0; j < vars.size(); j++)
1569  {
1570  if (vars[j] == short_name)
1571  {
1572  if (value.size() == 0)
1573  return {{true, "Range checking empty vector '" + range_function + "'"}};
1574 
1575  parbuf[j] = value[i];
1576  need_to_iterate = true;
1577  }
1578  else if (vars[j] == short_name + "_size")
1579  parbuf[j] = value.size();
1580  else
1581  {
1582  if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1583  return {{false, "Error parsing expression '" + range_function + "'"}};
1584  std::istringstream iss(vars[j]);
1585  iss.seekg(short_name.size() + 1);
1586 
1587  size_t index;
1588  if (iss >> index && iss.eof())
1589  {
1590  if (index >= value.size())
1591  return {{true,
1592  "Error parsing expression '" + range_function + "'; out of range variable '" +
1593  vars[j] + "'"}};
1594  parbuf[j] = value[index];
1595  }
1596  else
1597  return {{false,
1598  "Error parsing expression '" + range_function + "'; invalid variable '" +
1599  vars[j] + "'"}};
1600  }
1601  }
1602 
1603  // ensure range-checked input file parameter comparison functions
1604  // do absolute floating point comparisons instead of using a default epsilon.
1605  auto tmp_eps = fp.epsilon();
1606  fp.setEpsilon(0);
1607  UP_T result = fp.Eval(&parbuf[0]);
1608  fp.setEpsilon(tmp_eps);
1609 
1610  // test function using the parameters determined above
1611  if (fp.EvalError())
1612  return {{false, "Error evaluating expression '" + range_function + "'"}};
1613 
1614  if (!result)
1615  {
1616  std::ostringstream oss;
1617  oss << "Range check failed";
1618  if (include_param_path)
1619  oss << " for parameter " << full_name;
1620  oss << "; expression = '" << range_function << "'";
1621  if (need_to_iterate)
1622  oss << ", component " << i;
1623  return {{true, oss.str()}};
1624  }
1625 
1626  } while (need_to_iterate && ++i < value.size());
1627 
1628  return {};
1629 }
1630 
1631 template <typename T, typename UP_T>
1632 std::optional<std::pair<bool, std::string>>
1633 InputParameters::rangeCheck(const std::string & full_name,
1634  const std::string & short_name,
1635  InputParameters::Parameter<T> * param,
1636  const bool include_param_path)
1637 {
1638  mooseAssert(param, "Parameter is NULL");
1639 
1640  if (!isParamValid(short_name))
1641  return {};
1642 
1643  const auto & range_function = _params[short_name]._range_function;
1644  if (range_function.empty())
1645  return {};
1646 
1647  // Parse the expression
1649  if (fp.Parse(range_function, short_name) != -1) // -1 for success
1650  return {{false,
1651  "Error parsing expression '" + range_function + "'" + " for parameter " + short_name}};
1652 
1653  // ensure range-checked input file parameter comparison functions
1654  // do absolute floating point comparisons instead of using a default epsilon.
1655  auto tmp_eps = fp.epsilon();
1656  fp.setEpsilon(0);
1657  // We require a non-const value for the implicit upscaling of the parameter type
1658  std::vector<UP_T> value(1, param->set());
1659  UP_T result = fp.Eval(&value[0]);
1660  fp.setEpsilon(tmp_eps);
1661 
1662  if (fp.EvalError())
1663  return {{true,
1664  "Error evaluating expression '" + range_function + "' for parameter " + short_name +
1665  "; perhaps you used the wrong variable name?"}};
1666 
1667  if (!result)
1668  {
1669  std::ostringstream oss;
1670  oss << "Range check failed";
1671  if (include_param_path)
1672  oss << " for parameter " << full_name;
1673  oss << "; expression = '" << range_function << "', value = " << value[0];
1674  return {{true, oss.str()}};
1675  }
1676 
1677  return {};
1678 }
1679 
1680 template <typename T>
1681 T
1682 InputParameters::getCheckedPointerParam(const std::string & name_in,
1683  const std::string & error_string) const
1684 {
1685  const auto name = checkForRename(name_in);
1686 
1687  T param = this->get<T>(name);
1688 
1689  // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1690  // template type to this method
1691  if (!param)
1692  mooseError("Parameter ", name, " is NULL.\n", error_string);
1693  return this->get<T>(name);
1694 }
1695 
1696 template <typename T>
1697 void
1698 InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1699 {
1701  checkConsistentType<T>(name);
1702 
1703  InputParameters::insert<T>(name);
1704  auto & metadata = _params[name];
1705  metadata._required = true;
1706  if constexpr (isFunctorNameType<T>())
1707  metadata._doc_string = appendFunctorDescription<T>(doc_string);
1708  else
1709  metadata._doc_string = doc_string;
1710 }
1711 
1712 template <typename T>
1713 void
1714 InputParameters::addRequiredParam(const std::string & /*name*/,
1715  const T & /*value*/,
1716  const std::string & /*doc_string*/)
1717 {
1718  mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1719  "use addParam instead");
1720 }
1721 
1722 template <typename T, typename S>
1723 void
1724 InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1725 {
1727  checkConsistentType<T>(name);
1728 
1729  T & l_value = InputParameters::set<T>(name);
1730  auto & metadata = _params[name];
1731  if constexpr (isFunctorNameType<T>())
1732  metadata._doc_string = appendFunctorDescription<T>(doc_string);
1733  else
1734  metadata._doc_string = doc_string;
1735 
1736  // Set the parameter now
1737  setParamHelper(name, l_value, value);
1738 
1739  /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1740  the list whenever
1741  it changes, see set_attributes */
1742  metadata._set_by_add_param = true;
1743 }
1744 
1745 template <typename T>
1746 void
1747 InputParameters::addParam(const std::string & name, const std::string & doc_string)
1748 {
1750  checkConsistentType<T>(name);
1751 
1752  InputParameters::insert<T>(name);
1753  if constexpr (isFunctorNameType<T>())
1754  _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1755  else
1756  _params[name]._doc_string = doc_string;
1757 }
1758 
1759 template <typename T, typename S>
1760 void
1761 InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1762 {
1763  l_value = r_value;
1764 }
1765 
1766 template <typename T>
1767 void
1769  const std::string & syntax,
1770  const bool required,
1771  const bool value_required)
1772 {
1773  static_assert(isValidCommandLineType<T>::value,
1774  "This type is not a supported command line parameter type. See "
1775  "CommandLine::populateCommandLineParams to add it as a supported type.");
1776 
1777  auto & cl_data = at(name)._cl_data;
1778  cl_data = CommandLineMetadata();
1779 
1780  // Split up the syntax by whitespace
1781  std::vector<std::string> syntax_split;
1782  MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1783 
1784  // Set the single syntax string as the combined syntax with removed whitespace
1785  cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1786  mooseAssert(cl_data->syntax.size(), "Empty token");
1787 
1788  // Set the switches; only parse those that begin with "-" as we also
1789  // provide examples within the syntax
1790  for (const auto & val : syntax_split)
1791  if (val.rfind("-", 0) == 0)
1792  {
1793  if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1794  mooseError("The switch '",
1795  val,
1796  "' for the command line parameter '",
1797  name,
1798  "' is invalid. It must begin with an alphabetical character.");
1799 
1800  cl_data->switches.push_back(val);
1802  }
1803 
1804  cl_data->required = required;
1805  cl_data->global = false;
1806 
1807  // No arguments needed for a boolean parameter
1808  if constexpr (std::is_same_v<T, bool>)
1809  {
1810  (void)value_required; // purposely unused; doesn't take a value
1811  cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1812  }
1813  // MooseEnums require a value
1814  else if constexpr (std::is_same_v<T, MooseEnum>)
1815  {
1816  (void)value_required; // purposely unused; always required
1817  cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1818  }
1819  // The user didn't specify a default, so a value is required
1820  else if (value_required)
1821  cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1822  // Otherwise, it's optional (user specified a default)
1823  else
1824  cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1825 }
1826 
1827 template <typename T>
1828 void
1830  const std::string & parsed_function,
1831  const std::string & doc_string)
1832 {
1833  addRequiredParam<T>(name, doc_string);
1834  _params[name]._range_function = parsed_function;
1835 }
1836 
1837 template <typename T>
1838 void
1839 InputParameters::addRangeCheckedParam(const std::string & name,
1840  const T & value,
1841  const std::string & parsed_function,
1842  const std::string & doc_string)
1843 {
1844  addParam<T>(name, value, doc_string);
1845  _params[name]._range_function = parsed_function;
1846 }
1847 
1848 template <typename T>
1849 void
1850 InputParameters::addRangeCheckedParam(const std::string & name,
1851  const std::string & parsed_function,
1852  const std::string & doc_string)
1853 {
1854  addParam<T>(name, doc_string);
1855  _params[name]._range_function = parsed_function;
1856 }
1857 
1858 template <typename T>
1859 void
1861  const std::string & custom_type,
1862  const std::string & doc_string)
1863 {
1864  addRequiredParam<T>(name, doc_string);
1865  _params[name]._custom_type = custom_type;
1866 }
1867 
1868 template <typename T>
1869 void
1870 InputParameters::addCustomTypeParam(const std::string & name,
1871  const T & value,
1872  const std::string & custom_type,
1873  const std::string & doc_string)
1874 {
1875  addParam<T>(name, value, doc_string);
1876  _params[name]._custom_type = custom_type;
1877 }
1878 
1879 template <typename T>
1880 void
1881 InputParameters::addCustomTypeParam(const std::string & name,
1882  const std::string & custom_type,
1883  const std::string & doc_string)
1884 {
1885  addParam<T>(name, doc_string);
1886  _params[name]._custom_type = custom_type;
1887 }
1888 
1889 template <typename T>
1890 void
1892  const std::string & custom_type,
1893  const std::string & doc_string,
1894  const std::string & deprecation_message)
1895 {
1896  _show_deprecated_message = false;
1897  addParam<T>(name, doc_string);
1898  auto & metadata = _params[name];
1899  metadata._custom_type = custom_type;
1900 
1901  metadata._deprecation_message = deprecation_message;
1902  _show_deprecated_message = true;
1903 }
1904 
1905 template <typename T>
1906 void
1907 InputParameters::addPrivateParam(const std::string & name)
1908 {
1910  checkConsistentType<T>(name);
1911 
1912  InputParameters::insert<T>(name);
1913  _params[name]._is_private = true;
1914 }
1915 
1916 template <typename T>
1917 void
1918 InputParameters::addPrivateParam(const std::string & name, const T & value)
1919 {
1921  checkConsistentType<T>(name);
1922 
1923  InputParameters::set<T>(name) = value;
1924  auto & metadata = _params[name];
1925  metadata._is_private = true;
1926  metadata._set_by_add_param = true;
1927 }
1928 
1929 template <typename T>
1930 void
1932  const std::string & syntax,
1933  const std::string & doc_string)
1934 {
1935  static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
1936 
1937  addRequiredParam<T>(name, doc_string);
1938  addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
1939 }
1940 
1941 template <typename T>
1942 void
1943 InputParameters::addCommandLineParam(const std::string & name,
1944  const std::string & syntax,
1945  const std::string & doc_string)
1946 {
1947  static_assert(!std::is_same_v<T, MooseEnum>,
1948  "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
1949  "MooseEnum requires initialization");
1950 
1951  auto constexpr is_bool = std::is_same_v<T, bool>;
1952  if constexpr (is_bool)
1953  addParam<T>(name, false, doc_string);
1954  else
1955  addParam<T>(name, doc_string);
1956 
1957  addCommandLineParamHelper<T>(
1958  name, syntax, /* required = */ false, /* value_required = */ !is_bool);
1959 }
1960 
1961 template <typename T>
1962 void
1963 InputParameters::addCommandLineParam(const std::string & name,
1964  const std::string & syntax,
1965  const T & value,
1966  const std::string & doc_string)
1967 {
1968  if constexpr (std::is_same_v<T, bool>)
1969  mooseAssert(!value, "Default for bool must be false");
1970 
1971  addParam<T>(name, value, doc_string);
1972  addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
1973 }
1974 
1975 template <typename T>
1976 void
1978  const std::string & syntax,
1979  const T & value,
1980  const std::string & doc_string)
1981 {
1982  mooseAssert(name == "mesh_only" || name == "recover" || name == "run",
1983  "Not supported for new parameters");
1984  static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
1985  addParam<T>(name, value, doc_string);
1986  addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
1987 }
1988 
1989 template <typename T>
1990 void
1991 InputParameters::checkConsistentType(const std::string & name_in) const
1992 {
1993  const auto name = checkForRename(name_in);
1994 
1995  // If we don't currently have the Parameter, can't be any inconsistency
1997  if (it == _values.end())
1998  return;
1999 
2000  // Now, if we already have the Parameter, but it doesn't have the
2001  // right type, throw an error.
2002  if (!this->Parameters::have_parameter<T>(name))
2003  mooseError("Attempting to set parameter \"",
2004  name,
2005  "\" with type (",
2006  libMesh::demangle(typeid(T).name()),
2007  ")\nbut the parameter already exists as type (",
2008  it->second->type(),
2009  ")");
2010 }
2011 
2012 template <typename T>
2013 void
2014 InputParameters::suppressParameter(const std::string & name_in)
2015 {
2016  const auto name = checkForRename(name_in);
2017  if (!this->have_parameter<T>(name))
2018  mooseError("Unable to suppress nonexistent parameter: ", name);
2019 
2020  auto & metadata = _params[name];
2021  metadata._required = false;
2022  metadata._is_private = true;
2023  metadata._controllable = false;
2024 }
2025 
2026 template <typename T>
2027 void
2028 InputParameters::ignoreParameter(const std::string & name_in)
2029 {
2030  const auto name = checkForRename(name_in);
2031  suppressParameter<T>(name);
2032  _params[name]._ignore = true;
2033 }
2034 
2035 template <typename T>
2036 void
2037 InputParameters::makeParamRequired(const std::string & name_in)
2038 {
2039  const auto name = checkForRename(name_in);
2040 
2041  if (!this->have_parameter<T>(name))
2042  mooseError("Unable to require nonexistent parameter: ", name);
2043 
2044  _params[name]._required = true;
2045 }
2046 
2047 template <typename T>
2048 void
2049 InputParameters::makeParamNotRequired(const std::string & name_in)
2050 {
2051  const auto name = checkForRename(name_in);
2052 
2053  if (!this->have_parameter<T>(name))
2054  mooseError("Unable to un-require nonexistent parameter: ", name);
2055 
2056  _params[name]._required = false;
2057 }
2058 
2059 template <typename T>
2060 void
2061 InputParameters::addDeprecatedParam(const std::string & name,
2062  const T & value,
2063  const std::string & doc_string,
2064  const std::string & deprecation_message)
2065 {
2066  _show_deprecated_message = false;
2067  mooseAssert(!_old_to_new_name_and_dep.count(name),
2068  "Attempting to deprecate via addDeprecatedParam the parameter, '"
2069  << name << "', already deprecated via deprecateParam or renamed via renameParam");
2070  addParam<T>(name, value, doc_string);
2071 
2072  _params[name]._deprecation_message = deprecation_message;
2073  _show_deprecated_message = true;
2074 }
2075 
2076 template <typename T>
2077 void
2078 InputParameters::addDeprecatedParam(const std::string & name,
2079  const std::string & doc_string,
2080  const std::string & deprecation_message)
2081 {
2082  _show_deprecated_message = false;
2083  mooseAssert(!_old_to_new_name_and_dep.count(name),
2084  "Attempting to deprecate via addDeprecatedParam the parameter, '"
2085  << name << "', already deprecated via deprecateParam or renamed via renameParam");
2086  addParam<T>(name, doc_string);
2087 
2088  _params[name]._deprecation_message = deprecation_message;
2089  _show_deprecated_message = true;
2090 }
2091 
2092 // Forward declare MooseEnum specializations for add*Param
2093 template <>
2094 void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2095  const MooseEnum & moose_enum,
2096  const std::string & doc_string);
2097 
2098 template <>
2099 void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2100  const MultiMooseEnum & moose_enum,
2101  const std::string & doc_string);
2102 
2103 template <>
2104 void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2105  const std::string & name,
2106  const std::vector<MooseEnum> & moose_enums,
2107  const std::string & doc_string);
2108 
2109 template <>
2110 void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2111  const std::string & name,
2112  const std::vector<MultiMooseEnum> & moose_enums,
2113  const std::string & doc_string);
2114 
2115 template <>
2116 void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2117  const std::string & /*doc_string*/);
2118 
2119 template <>
2120 void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2121  const std::string & /*doc_string*/);
2122 
2123 template <>
2124 void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2125  const std::string & /*doc_string*/);
2126 
2127 template <>
2128 void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2129  const std::string & /*doc_string*/);
2130 
2131 template <>
2132 void
2133 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2134  const std::string & /*doc_string*/);
2135 
2136 template <>
2137 void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2138 
2139 template <>
2140 void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2141 
2142 template <>
2143 void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2144  const std::string & /*doc_string*/,
2145  const std::string & /*deprecation_message*/);
2146 
2147 template <>
2148 void
2149 InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2150  const std::string & /*doc_string*/,
2151  const std::string & /*deprecation_message*/);
2152 
2153 template <>
2154 void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2155  const std::string & /*name*/,
2156  const std::string & /*doc_string*/,
2157  const std::string & /*deprecation_message*/);
2158 
2159 // Forward declare specializations for setParamHelper
2160 template <>
2161 void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2162  PostprocessorName & l_value,
2163  const Real & r_value);
2164 
2165 template <>
2166 void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2167  PostprocessorName & l_value,
2168  const int & r_value);
2169 
2170 template <>
2171 void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2172  FunctionName & l_value,
2173  const Real & r_value);
2174 
2175 template <>
2176 void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2177  FunctionName & l_value,
2178  const int & r_value);
2179 
2180 template <>
2181 void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2182  MaterialPropertyName & l_value,
2183  const Real & r_value);
2184 
2185 template <>
2186 void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2187  MaterialPropertyName & l_value,
2188  const int & r_value);
2189 
2190 template <>
2191 void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2192  MooseFunctorName & l_value,
2193  const Real & r_value);
2194 
2195 template <>
2196 void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2197  MooseFunctorName & l_value,
2198  const int & r_value);
2199 
2200 template <typename T>
2201 const T &
2202 InputParameters::getParamHelper(const std::string & name_in, const InputParameters & pars)
2203 {
2204  const auto name = pars.checkForRename(name_in);
2205 
2206  if (!pars.isParamValid(name))
2207  pars.mooseError("The parameter \"", name, "\" is being retrieved before being set.");
2208 
2209  return pars.get<T>(name);
2210 }
2211 
2212 // Declare specializations so we don't fall back on the generic
2213 // implementation, but the definition will be in InputParameters.C so
2214 // we won't need to bring in *MooseEnum header files here.
2215 template <>
2216 const MooseEnum & InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2217  const InputParameters & pars);
2218 
2219 template <>
2220 const MultiMooseEnum &
2221 InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2222  const InputParameters & pars);
2223 
2224 template <typename R1, typename R2, typename V1, typename V2>
2225 std::vector<std::pair<R1, R2>>
2226 InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2227 {
2228  const auto param1 = checkForRename(param1_in);
2229  const auto param2 = checkForRename(param2_in);
2230 
2231  const auto & v1 = get<V1>(param1);
2232  const auto & v2 = get<V2>(param2);
2233 
2234  auto controllable = getControllableParameters();
2235  if (controllable.count(param1) || controllable.count(param2))
2236  mooseError("Parameters ",
2237  param1,
2238  " and/or ",
2239  param2 + " are controllable parameters and cannot be retireved using "
2240  "the MooseObject::getParam/InputParameters::get methods for pairs");
2241 
2242  if (v1.size() != v2.size())
2243  paramError(param1,
2244  "Vector parameters ",
2245  param1,
2246  "(size: ",
2247  v1.size(),
2248  ") and " + param2,
2249  "(size: ",
2250  v2.size(),
2251  ") are of different lengths \n");
2252 
2253  std::vector<std::pair<R1, R2>> parameter_pairs;
2254  auto i1 = v1.begin();
2255  auto i2 = v2.begin();
2256  for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2257  parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2258  return parameter_pairs;
2259 }
2260 
2262 
2263 template <typename T>
2264 bool
2265 InputParameters::isType(const std::string & name_in) const
2266 {
2267  const auto name = checkForRename(name_in);
2268 
2269  if (!_params.count(name))
2270  mooseError("Parameter \"", name, "\" is not valid.");
2271  return have_parameter<T>(name);
2272 }
2273 
2274 template <typename T>
2275 const T &
2276 InputParameters::get(std::string_view name_in) const
2277 {
2278  const auto name = checkForRename(std::string(name_in));
2279 
2280  return Parameters::get<T>(name);
2281 }
2282 
2283 template <typename T>
2284 bool
2285 InputParameters::have_parameter(std::string_view name_in) const
2286 {
2287  const auto name = checkForRename(std::string(name_in));
2288 
2289  return Parameters::have_parameter<T>(name);
2290 }
2291 
2292 template <typename T>
2293 void
2295  const std::string & name_in,
2296  const std::string & new_name,
2297  const std::string & new_description)
2298 {
2299  const auto name = source_params.checkForRename(std::string(name_in));
2300  const auto p_name = new_name.empty() ? name_in : new_name;
2301  if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledValue(name))
2302  mooseError("The '",
2303  name_in,
2304  "' parameter could not be transferred because it does not exist with type '",
2305  MooseUtils::prettyCppType<T>(),
2306  "' in the source parameters");
2307  if (name != name_in)
2308  mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2309  " in the source parameters. The new name should likely be used for the parameter "
2310  "transfer instead.");
2311  const std::string description =
2312  new_description.empty() ? source_params.getDescription(name) : new_description;
2313 
2314  if (source_params.isParamRequired(name))
2315  {
2316  // Check for a variable parameter
2317  if (source_params.hasCoupledValue(name))
2318  addRequiredCoupledVar(p_name, description);
2319  // Enums parameters have a default list of options
2320  else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2321  addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2322  else if (source_params.isRangeChecked(name))
2323  addRequiredRangeCheckedParam<T>(
2324  p_name, source_params.rangeCheckedFunction(name), description);
2325  else
2326  addRequiredParam<T>(p_name, description);
2327  }
2328  else
2329  {
2330  // Check for a variable parameter
2331  if (source_params.hasCoupledValue(name))
2332  {
2333  if (!source_params.hasDefaultCoupledValue(name))
2334  addCoupledVar(p_name, description);
2335  else if (source_params.numberDefaultCoupledValues(name) == 1)
2336  addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2337  else
2338  {
2339  std::vector<Real> coupled_values;
2340  for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2341  coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2342  addCoupledVar(p_name, coupled_values, description);
2343  }
2344  }
2345  else if (source_params.isRangeChecked(name))
2346  {
2347  if (source_params.hasDefault(name))
2348  addRangeCheckedParam<T>(p_name,
2349  source_params.get<T>(name),
2350  source_params.rangeCheckedFunction(name),
2351  description);
2352  else
2353  addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2354  }
2355  else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2356  addParam<T>(p_name, source_params.get<T>(name), description);
2357  else
2358  {
2359  if (source_params.hasDefault(name))
2360  addParam<T>(p_name, source_params.get<T>(name), description);
2361  else
2362  addParam<T>(p_name, description);
2363  }
2364  }
2365 
2366  // Copy other attributes
2367  if (source_params.isPrivate(name))
2368  _params[p_name]._is_private = true;
2369  if (source_params.isControllable(name))
2370  _params[p_name]._controllable = true;
2371 }
2372 
2373 template <typename... Args>
2374 [[noreturn]] void
2375 InputParameters::mooseError(Args &&... args) const
2376 {
2377  std::ostringstream oss;
2378  moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2379  callMooseError(oss.str());
2380 }
2381 
2382 template <typename... Args>
2383 std::string
2384 InputParameters::paramMessage(const std::string & param, Args... args) const
2385 {
2386  std::ostringstream oss;
2387  moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2388  return paramMessagePrefix(param) + oss.str();
2389 }
2390 
2391 template <typename... Args>
2392 [[noreturn]] void
2393 InputParameters::paramError(const std::string & param, Args... args) const
2394 {
2395  std::ostringstream oss;
2396  moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
2397  const auto [prefix, node] = paramMessageContext(param);
2398 
2399  Moose::show_trace = false;
2400  callMooseError(prefix + oss.str(), false, node);
2401  Moose::show_trace = true;
2402 }
2403 
2404 namespace Moose
2405 {
2406 namespace internal
2407 {
2408 template <typename T>
2409 constexpr T *
2411 {
2412  return nullptr;
2413 }
2414 
2415 #ifdef MOOSE_MFEM_ENABLED
2416 
2417 template <typename T>
2418 constexpr bool
2420 {
2421  return std::is_same_v<T, MFEMScalarCoefficientName> ||
2422  std::is_same_v<T, MFEMVectorCoefficientName>;
2423 }
2424 
2425 template <typename T, typename A>
2426 constexpr bool
2427 isMFEMFunctorNameTypeHelper(std::vector<T, A> *)
2428 {
2429  return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2430 }
2431 
2432 #endif
2433 
2434 template <typename T>
2435 constexpr bool
2437 {
2438  return std::is_same_v<T, MooseFunctorName>
2439 #ifdef MOOSE_MFEM_ENABLED
2440  || std::is_same_v<T, MFEMScalarCoefficientName>
2441 #endif
2442  ;
2443 }
2444 
2445 template <typename T, typename A>
2446 constexpr bool
2447 isScalarFunctorNameTypeHelper(std::vector<T, A> *)
2448 {
2449  return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2450 }
2451 
2452 template <typename T>
2453 constexpr bool
2455 {
2456 #ifdef MOOSE_MFEM_ENABLED
2457  return std::is_same_v<T, MFEMVectorCoefficientName>;
2458 #else
2459  return false;
2460 #endif
2461 }
2462 
2463 template <typename T, typename A>
2464 constexpr bool
2465 isVectorFunctorNameTypeHelper(std::vector<T, A> *)
2466 {
2467  return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2468 }
2469 
2470 template <typename T>
2471 constexpr bool
2473 {
2475 }
2476 }
2477 }
2478 
2479 template <typename T>
2480 constexpr bool
2482 {
2483  return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2484 }
2485 
2486 template <typename T>
2487 std::string
2488 InputParameters::appendFunctorDescription(const std::string & doc_string) const
2489 {
2490  auto numeric_value_type = []()
2491  {
2493  Moose::internal::getNullptrExample<T>()))
2494  return "number";
2496  Moose::internal::getNullptrExample<T>()))
2497  return "numeric vector value (enclosed in curly braces)";
2498  else
2499  {
2500  mooseAssert(false, "We control instantiations of this method");
2501  return "";
2502  }
2503  };
2504 
2505  return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2506  (
2507 #ifdef MOOSE_MFEM_ENABLED
2508  Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2509  ? "an MFEM"
2510  :
2511 #endif
2512  "a functor") +
2513  " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2514 }
std::multimap< std::string, std::string > _new_to_old_names
A map from derived-class/blessed parameter names to associated base-class/deprecated parameter names...
std::string name(const ElemQuality q)
std::optional< std::string > queryDeprecatedParamMessage(const std::string &name) const
void mooseStreamAll(std::ostringstream &ss)
All of the following are not meant to be called directly - they are called by the normal macros (moos...
Definition: MooseError.C:100
std::string paramMessage(const std::string &param, Args... args) const
std::string getMooseType(const std::string &name) const
Utility functions for retrieving one of the MooseTypes variables into the common "string" base class...
Determines whether or not the given type is a type that is supported for a command line parameter...
bool isRangeChecked(const std::string &param_name) const
Return whether a parameter has a range check.
void renameParam(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
Rename a parameter and provide a new documentation string.
void setParameters()
Method to terminate the recursive setParameters definition.
bool isParamDefined(const std::string &name) const
Method returns true if the parameter is defined for any type.
void addCommandLineParamHelper(const std::string &name, const std::string &syntax, const bool required, const bool value_required)
Helper for all of the addCommandLineParam() calls, which sets up _cl_data in the metadata.
void clearRelationshipManagers()
Clears all currently registered RelationshipManagers.
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
Definition: Moose.C:783
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
These methods add an range checked parameters.
void setGlobalCommandLineParam(const std::string &name)
Sets the command line parameter with name as global.
bool hasCoupledValue(const std::string &coupling_name) const
Return whether or not the coupled variable exists.
Storage container for all InputParamter objects.
bool set_by_command_line
Whether or not the parameter was set by the CommandLine.
constexpr bool isVectorFunctorNameTypeHelper(T *)
bool _allow_copy
A flag for toggling the error message in the copy constructor.
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 ...
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
bool required
Whether or not the argument is required.
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:964
InputParameters & operator=(const InputParameters &rhs)
void setDocUnit(const std::string &name, const std::string &doc_unit)
Set the unit string of a parameter.
std::map< std::string, std::pair< std::string, std::string > > getAutoBuildVectors() const
Returns the auto build vectors for all parameters.
std::string appendFunctorDescription(const std::string &doc_string) const
Appends description of what a functor is to a doc string.
std::string _custom_type
The custom type that will be printed in the YAML dump for a parameter if supplied.
std::set< std::string > getParametersList() const
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Enable support for initializer lists as default arguments for container type.
constexpr bool isMFEMFunctorNameTypeHelper(T *)
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
void applySpecificParameters(const InputParameters &common, const std::vector< std::string > &include, bool allow_private=false)
Method for applying common parameters.
void setDocString(const std::string &name, const std::string &doc)
Set the doc string of a parameter.
void addPrivateParam(const std::string &name, const T &value)
These method add a parameter to the InputParameters object which can be retrieved like any other para...
bool isParamDeprecated(const std::string &name) const
Returns True if the parameters is deprecated.
const std::vector< std::tuple< std::string, Moose::RelationshipManagerType, Moose::RelationshipManagerInputParameterCallback > > & getBuildableRelationshipManagerTypes() const
Returns the list of buildable (or required) RelationshipManager object types for this object...
const std::string & getObjectName() const
bool isControllable(const std::string &name) const
Returns a Boolean indicating whether the specified parameter is controllable.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
std::set< ExecFlagType > _controllable_flags
Controllable execute flag restriction.
FRIEND_TEST(InputParametersTest, fileNames)
const hit::Node * _hit_node
Original location of parameter node; used for error messages.
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:367
char ** vars
std::unordered_map< std::string, std::string > _new_to_deprecated_coupled_vars
A map from deprecated coupled variable names to the new blessed name.
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
const std::vector< std::string > & getBuildableTypes() const
Returns the list of buildable types as a std::vector<std::string>
void addCustomTypeParam(const std::string &name, const T &value, const std::string &custom_type, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Class that hold the whole problem being solved.
Definition: Problem.h:19
void setDeprecatedVarDocString(const std::string &new_name, const std::string &doc_string)
Private method for setting deprecated coupled variable documentation strings.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam)
InputParameters & operator+=(const InputParameters &rhs)
const std::set< std::string > & getCoupledVariableParamNames() const
Return the coupled variable parameter names.
ArgumentType argument_type
The type of argument.
std::optional< Moose::DataFileUtils::Path > _data_file_name_path
The searched path information pertaining to a DataFileName parameter.
void registerSystemAttributeName(const std::string &value)
This method is used to define the MOOSE system name that is used by the TheWarehouse object for stori...
Class that is used as a parameter to setHitNode() that allows only relevant classes to set the hit no...
bool _ignore
whether user setting of this parameter should be ignored
Storage for action instances.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
Method for applying common parameters.
void renameCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &new_docstring)
Rename a coupled variable and provide a new documentation string.
std::set< std::string >::const_iterator coupledVarsBegin() const
Methods returning iterators to the coupled variables names stored in this InputParameters object...
bool hasBase() const
void applyCoupledVar(const InputParameters &common, const std::string &var_name)
Apply properties of a single coupled variable in common, to a single coupled variable stored in this ...
friend InputParameters emptyInputParameters()
void registerBuildableTypes(const std::string &names)
This method is here to indicate which Moose types a particular Action may build.
const std::unordered_map< std::string, std::string > & getNewToDeprecatedVarMap() const
Return the new to deprecated variable name map.
bool isPrivate(const std::string &name) const
Returns a Boolean indicating whether the specified parameter is private or not.
void mooseError(Args &&... args) const
Emits an error prefixed with the object information, if available.
void callMooseError(std::string msg, const bool with_prefix=true, const hit::Node *node=nullptr) const
Internal helper for calling back to mooseError(), ideally from the underlying MooseBase object if it ...
void checkConsistentType(const std::string &name) const
This method checks to make sure that we aren&#39;t adding a parameter with the same name but a different ...
std::vector< std::string > paramAliases(const std::string &param_name) const
Return all the aliased names associated with param_name.
void addRelationshipManager(const std::string &name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback input_parameter_callback=nullptr)
Tells MOOSE about a RelationshipManager that this object needs.
void renameParameterGroup(const std::string &old_name, const std::string &new_name)
This method renames a parameter group.
std::set< std::string > _reserved_values
The reserved option names for a parameter.
void finalize(const std::string &parsing_syntax)
Finalizes the parameters, which must be done before constructing any objects with these parameters (t...
void addRequiredCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
Add parameters for retrieval from the command line.
const std::string & getBase() const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for actions.
Definition: Action.h:33
bool global
Whether or not the parameter is global (passed to MultiApps)
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
std::optional< std::pair< bool, std::string > > rangeCheck(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, const bool include_param_path=true)
Runs a range on the supplied parameter if it exists and throws an error if that check fails...
InputParameters emptyInputParameters()
void checkParamName(const std::string &name) const
Make sure the parameter name doesn&#39;t have any invalid characters.
void renameParamInternal(const std::string &old_name, const std::string &new_name, const std::string &docstring, const std::string &removal_date)
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn&#39;t required or valid in the derived class...
This class wraps provides and tracks access to command line parameters.
Definition: CommandLine.h:29
bool mooseObjectSyntaxVisibility() const
unsigned int numberDefaultCoupledValues(const std::string &coupling_name) const
Get the number of defaulted coupled value entries.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
MPI_Status status
const std::string & getDescription(const std::string &name) const
Get the documentation string for a parameter.
void paramError(const std::string &param, Args... args) const
Emits a parameter error prefixed with the parameter location and object information if available...
Structure for storing information about a command line parameter.
bool isParamSetByAddParam(const std::string &name) const
Returns whether or not the parameter was set due to addParam.
void commandLineParamSet(const std::string &name, const CommandLineParamSetKey)
Marks the command line parameter name as set by the CommandLine.
bool _show_deprecated_message
Flag for disabling deprecated parameters message, this is used by applyParameters to avoid dumping me...
void ignoreParameter(const std::string &name)
Informs this object that values for this parameter set from the input file or from the command line s...
bool _required
True for parameters that are required (i.e. will cause an abort if not supplied)
std::string _range_function
The map of functions used for range checked parameters.
bool _collapse_nesting
This parameter collapses one level of nesting in the syntax blocks.
std::string getDocString(const std::string &name) const
Returns the documentation string for the specified parameter name.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::string syntax
The syntax for the parameter.
void deprecateParam(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
std::set< std::string >::const_iterator coupledVarsEnd() const
Class that is used as a parameter to commandLineParamSet() that allows only the CommandLine to set th...
std::string getDocUnit(const std::string &name) const
Returns the documentation unit string for the specified parameter name.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:27
bool shouldIgnore(const std::string &name)
Whether to ignore the value of an input parameter set in the input file or from the command line...
std::pair< std::string, const hit::Node * > paramMessageContext(const std::string &param) const
Get the context associated with a parameter for a message.
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Definition: MooseTypes.h:990
bool hasDefaultCoupledValue(const std::string &coupling_name) const
Return whether or not the requested parameter has a default coupled value.
void setHelper(const std::string &name)
This functions is called in set as a &#39;callback&#39; to avoid code duplication.
void markControlled(const std::string &name)
Marker a parameter that has been changed by the Control system (this is for output purposes) ...
bool areAllRequiredParamsValid() const
This method returns true if all of the parameters in this object are valid (i.e.
static constexpr bool isFunctorNameType()
std::string rawParamVal(const std::string &param) const
Real defaultCoupledValue(const std::string &coupling_name, unsigned int i=0) const
Get the default value for an optionally coupled variable.
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:50
void addDeprecatedCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date="")
This method adds a deprecated coupled variable name pair.
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
std::string _class_description
The class description for the owning object.
const std::set< ExecFlagType > & getControllableExecuteOnTypes(const std::string &name) const
Return the allowed execute flags for a controllable parameter.
void renameCoupledVarInternal(const std::string &old_name, const std::string &new_name, const std::string &docstring, const std::string &removal_date)
FRIEND_TEST(InputParametersTest, fileNames)
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
Definition: NEML2Utils.C:77
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void checkParams(const std::string &parsing_syntax)
This function checks parameters stored in the object to make sure they are in the correct state as th...
std::string inputLocation(const std::string &param) const
static const T & getParamHelper(const std::string &name, const InputParameters &pars)
std::string demangle(const char *name)
bool isMooseBaseObject() const
constexpr bool isFunctorNameTypeHelper(T *ex)
constexpr bool isScalarFunctorNameTypeHelper(T *)
void transferParam(const InputParameters &source_param, const std::string &name, const std::string &new_name="", const std::string &new_description="")
A routine to transfer a parameter from one class&#39; validParams to another.
std::set< std::string > reservedValues(const std::string &name) const
Get a set of reserved parameter values.
Definition: Moose.h:42
SetParamHitNodeKey(const SetParamHitNodeKey &)
std::vector< Real > _coupled_default
The default value for optionally coupled variables.
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void setReservedValues(const std::string &name, const std::set< std::string > &reserved)
Provide a set of reserved values for a parameter.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void makeParamNotRequired(const std::string &name)
Changes the parameter to not be required.
void allowCopy(bool status)
Toggle the availability of the copy constructor.
bool have_parameter(std::string_view name) const
A wrapper around the Parameters base class method.
bool isParamSetByUser(const std::string &name) const
Method returns true if the parameter was set by the user.
std::string paramMessagePrefix(const std::string &param) const
Get a prefix for messages associated with a parameter.
std::string _deprecation_message
If non-empty, this parameter is deprecated.
void addCommandLineParam(const std::string &name, const std::string &syntax, const std::string &doc_string)
std::string varName(const std::string &var_param_name, const std::string &moose_object_with_var_param_name) const
Determine the actual variable name from the given variable parameter name.
bool isType(const std::string &name) const
void addDeprecatedCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string, const std::string &deprecation_msg)
bool _is_private
The set of parameters that will NOT appear in the the dump of the parser tree.
const std::string & getObjectType() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool isFinalized() const
void add_command_line_name(const std::string &name)
CommandLineParamSetKey(const CommandLineParamSetKey &)
std::set< std::string > _coupled_vars
The coupled variables set.
std::vector< std::tuple< std::string, Moose::RelationshipManagerType, Moose::RelationshipManagerInputParameterCallback > > _buildable_rm_types
The RelationshipManagers that this object may either build or require.
void addRequiredCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
constexpr T * getNullptrExample()
void addCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
These methods add a coupled variable name pair.
virtual ~InputParameters()=default
std::string getGroupName(const std::string &param_name) const
This method retrieves the group name for the passed parameter name if one exists. ...
std::string paramLocationPrefix(const std::string &param) const
Returns a prefix containing the parameter name and location (if available)
std::string checkForRename(const std::string &name) const
Checks whether the provided name is a renamed parameter name.
bool _finalized
Whether or not we&#39;ve called finalize() on these parameters yet.
std::string type(const std::string &name) const
Prints the type of the requested parameter by name.
std::string blockFullpath() const
IntRange< T > make_range(T beg, T end)
bool isCommandLineParameter(const std::string &name) const
std::pair< std::string, std::string > _autobuild_vecs
directions for auto build vectors (base_, 5) -> "base_0 base_1 base_2 base_3 base_4") ...
class infix_ostream_iterator if void
Definition: InfixIterator.h:26
const hit::Node * _hit_node
The hit node representing the syntax that created these parameters, if any.
bool paramSetByUser(const std::string &name) const
Deprecated method.
void makeParamRequired(const std::string &name)
Changes the parameter to be required.
bool _valid
Whether the parameter is either explicitly set or provided a default value when added Note: We do not...
void addRequiredCustomTypeParam(const std::string &name, const std::string &custom_type, const std::string &doc_string)
These methods add an option parameter and with a customer type to the InputParameters object...
std::optional< InputParameters::CommandLineMetadata > queryCommandLineMetadata(const std::string &name) const
bool isParamRequired(const std::string &name) const
Returns a boolean indicating whether the specified parameter is required or not.
std::string _doc_unit
The developer-designated unit of the parameter for use in documentation.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
const std::string & getSystemAttributeName() const
Get the system attribute name if it was registered.
const InputParameters::CommandLineMetadata & getCommandLineMetadata(const std::string &name) const
std::vector< std::string > _buildable_types
The parameter is used to restrict types that can be built.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
bool _moose_object_syntax_visibility
This parameter hides derived MOOSE object types from appearing in syntax dumps.
SetHitNodeKey(const SetHitNodeKey &)
virtual void clear() override
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
bool hasDefault(const std::string &param_name) const
Return whether a parameter has a default.
void setHitNode(const std::string &param, const hit::Node &node, const SetParamHitNodeKey)
Sets the hit node associated with the parameter param to node.
bool _controllable
True if the parameters is controllable.
std::map< std::string, Metadata > _params
The actual parameter data.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
virtual void set_attributes(const std::string &name, bool inserted_only) override
Override from libMesh to set user-defined attributes on our parameter.
std::vector< std::string > switches
The switches for the parameter (i.e., [-t, –timing])
std::string blockLocation() const
std::string getClassDescription() const
Returns the class description.
bool _set_by_add_param
True if a parameters value was set by addParam, and not set again.
std::map< std::string, std::pair< std::string, std::string > > _old_to_new_name_and_dep
A map from base-class/deprecated parameter names to derived-class/blessed parameter names and the dep...
std::set< std::string > getControllableParameters() const
Return list of controllable parameters.
void setHitNode(const hit::Node &node, const SetHitNodeKey)
Sets the hit node that represents the syntax responsible for creating these parameters.
void applyParameter(const InputParameters &common, const std::string &common_name, bool allow_private=false, bool override_default=false)
Apply values from a single parameter in common, to a single parameter stored in this object...
std::optional< Moose::DataFileUtils::Path > queryDataFileNamePath(const std::string &name) const
Parses MOOSE input using HIT/WASP.
Definition: Builder.h:56
void setParamHelper(const std::string &name, T &l_value, const S &r_value)
This method is called when adding a Parameter with a default value, can be specialized for non-matchi...
std::filesystem::path getFileBase(const std::optional< std::string > &param_name=std::optional< std::string >()) const
std::vector< std::string > getVecMooseType(const std::string &name) const
const hit::Node * getHitNode() const
map_type::const_iterator const_iterator
std::optional< CommandLineMetadata > _cl_data
The data pertaining to a command line parameter (empty if not a command line param) ...
const Metadata & at(const std::string &param_name) const
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
Definition: MooseUtils.C:1050
Metadata & at(const std::string &param_name)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Declare the given parameters as controllable.
std::string paramFullpath(const std::string &param) const
std::string rangeCheckedFunction(const std::string &name) const
Return the range check function for any parameter (empty string if it is not range checked) ...
bool collapseSyntaxNesting() const
Class for parsing input files.
Definition: Parser.h:87
Class that is used as a parameter to setHitNode(param) that allows only relevant classes to set the h...
std::string _group
The names of the parameters organized into groups.
void addOptionalValuedCommandLineParam(const std::string &name, const std::string &syntax, const T &value, const std::string &doc_string)
Add a command line parameter with an optional value.
ExecFlagEnum execute_flags
Storage for the registered execute flags.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
std::set< std::string > getGroupParameters(const std::string &group) const
Return names of parameters within a group.
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.