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 MooseBase;
50 class MultiMooseEnum;
51 class Problem;
52 namespace hit
53 {
54 class Node;
55 }
56 namespace Moose
57 {
58 class Builder;
59 }
60 class CommandLine;
61 
67 {
68 public:
69  InputParameters(const InputParameters & rhs);
70  InputParameters(const Parameters & rhs);
71 
72  virtual ~InputParameters() = default;
73 
74  virtual void clear() override;
75 
80  {
82  {
86  };
87 
89  std::string syntax;
91  std::vector<std::string> switches;
95  bool required;
97  bool set_by_command_line = false;
99  bool global = false;
100  };
101 
107  {
108  friend class Action;
109  friend class ActionFactory;
110  friend class Moose::Builder;
111  friend class Factory;
112  friend class FEProblemBase;
113  friend class InputParameters;
114  FRIEND_TEST(InputParametersTest, fileNames);
117  };
118 
124  {
125  friend class Moose::Builder;
126  FRIEND_TEST(InputParametersTest, fileNames);
129  };
130 
138  template <typename T>
140  {
141  static constexpr bool value =
142  std::is_same_v<T, std::string> || std::is_same_v<T, std::vector<std::string>> ||
143  std::is_same_v<T, Real> || std::is_same_v<T, unsigned int> || std::is_same_v<T, int> ||
144  std::is_same_v<T, bool> || std::is_same_v<T, MooseEnum>;
145  };
146 
151  void addClassDescription(const std::string & doc_string);
152 
156  std::string getClassDescription() const;
157 
161  virtual void set_attributes(const std::string & name, bool inserted_only) override;
162 
164  bool attemptPrintDeprecated(const std::string & name);
165 
167  template <typename T>
168  void setHelper(const std::string & name);
169 
185  template <typename T>
186  T & set(const std::string & name, bool quiet_mode = false);
187 
199  template <typename T, typename... Ts>
200  void setParameters(const std::string & name, const T & value, Ts... extra_input_parameters);
201 
206  template <typename T, typename UP_T>
207  void rangeCheck(const std::string & full_name,
208  const std::string & short_name,
209  InputParameters::Parameter<T> * param,
210  std::ostream & oss = Moose::out);
211  template <typename T, typename UP_T>
212  void rangeCheck(const std::string & full_name,
213  const std::string & short_name,
214  InputParameters::Parameter<std::vector<T>> * param,
215  std::ostream & oss = Moose::out);
216 
221  template <typename T>
222  T getCheckedPointerParam(const std::string & name, const std::string & error_string = "") const;
223 
229  template <typename T>
230  void addRequiredParam(const std::string & name, const std::string & doc_string);
231 
236  template <typename T>
237  void
238  addRequiredParam(const std::string & name, const T & moose_enum, const std::string & doc_string);
239 
241 
247  template <typename T, typename S>
248  void addParam(const std::string & name, const S & value, const std::string & doc_string);
249  template <typename T>
250  void addParam(const std::string & name, const std::string & doc_string);
252 
256  template <typename T>
257  void addParam(const std::string & name,
258  const std::initializer_list<typename T::value_type> & value,
259  const std::string & doc_string)
260  {
261  addParam<T>(name, T{value}, doc_string);
262  }
263 
265  // BEGIN RANGE CHECKED PARAMETER METHODS
270  template <typename T>
271  void addRequiredRangeCheckedParam(const std::string & name,
272  const std::string & parsed_function,
273  const std::string & doc_string);
274  template <typename T>
275  void addRangeCheckedParam(const std::string & name,
276  const T & value,
277  const std::string & parsed_function,
278  const std::string & doc_string);
279  template <typename T>
280  void addRangeCheckedParam(const std::string & name,
281  const std::string & parsed_function,
282  const std::string & doc_string);
283  // END RANGE CHECKED PARAMETER METHODS
285 
290  template <typename T>
291  void addRequiredCustomTypeParam(const std::string & name,
292  const std::string & custom_type,
293  const std::string & doc_string);
294  template <typename T>
295  void addCustomTypeParam(const std::string & name,
296  const T & value,
297  const std::string & custom_type,
298  const std::string & doc_string);
299  template <typename T>
300  void addCustomTypeParam(const std::string & name,
301  const std::string & custom_type,
302  const std::string & doc_string);
303  template <typename T>
304  void addDeprecatedCustomTypeParam(const std::string & name,
305  const std::string & custom_type,
306  const std::string & doc_string,
307  const std::string & deprecation_msg);
308 
315  template <typename T>
316  void addPrivateParam(const std::string & name, const T & value);
317  template <typename T>
318  void addPrivateParam(const std::string & name);
319 
329  template <typename T>
330  void addRequiredCommandLineParam(const std::string & name,
331  const std::string & syntax,
332  const std::string & doc_string);
333  template <typename T>
334  void addCommandLineParam(const std::string & name,
335  const std::string & syntax,
336  const std::string & doc_string);
337  template <typename T>
338  void addCommandLineParam(const std::string & name,
339  const std::string & syntax,
340  const T & value,
341  const std::string & doc_string);
342  template <typename T>
343  void addCommandLineParam(const std::string & name,
344  const std::string & syntax,
345  const std::initializer_list<typename T::value_type> & value,
346  const std::string & doc_string)
347  {
348  addCommandLineParam<T>(name, syntax, T{value}, doc_string);
349  }
350 
368  template <typename T>
369  void addOptionalValuedCommandLineParam(const std::string & name,
370  const std::string & syntax,
371  const T & value,
372  const std::string & doc_string);
373 
379  void setGlobalCommandLineParam(const std::string & name);
380 
388  template <typename T>
389  void addDeprecatedParam(const std::string & name,
390  const T & value,
391  const std::string & doc_string,
392  const std::string & deprecation_message);
393 
394  template <typename T>
395  void addDeprecatedParam(const std::string & name,
396  const std::string & doc_string,
397  const std::string & deprecation_message);
398 
408  template <typename T>
409  void checkConsistentType(const std::string & name) const;
410 
414  bool isCommandLineParameter(const std::string & name) const;
415 
421  std::optional<InputParameters::CommandLineMetadata>
422  queryCommandLineMetadata(const std::string & name) const;
423 
428  getCommandLineMetadata(const std::string & name) const;
429 
435  {
436  friend class CommandLine;
437  FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam);
440  };
446  void commandLineParamSet(const std::string & name, const CommandLineParamSetKey);
447 
451  const std::string & getDescription(const std::string & name) const;
452 
458  void addParamNamesToGroup(const std::string & space_delim_names, const std::string group_name);
459 
465  void renameParameterGroup(const std::string & old_name, const std::string & new_name);
466 
471  std::string getGroupName(const std::string & param_name) const;
472 
479  template <typename T>
480  void suppressParameter(const std::string & name);
481 
486  template <typename T>
487  void makeParamRequired(const std::string & name);
488 
493  template <typename T>
494  void makeParamNotRequired(const std::string & name);
495 
501  void addCoupledVar(const std::string & name, const std::string & doc_string);
502 
510  void addDeprecatedCoupledVar(const std::string & old_name,
511  const std::string & new_name,
512  const std::string & removal_date = "");
513 
522  void addCoupledVar(const std::string & name, const Real value, const std::string & doc_string);
523 
532  void addCoupledVar(const std::string & name,
533  const std::vector<Real> & value,
534  const std::string & doc_string);
535 
537 
554  void addCoupledVarWithAutoBuild(const std::string & name,
555  const std::string & base_name,
556  const std::string & num_name,
557  const std::string & doc_string);
558  void addRequiredCoupledVarWithAutoBuild(const std::string & name,
559  const std::string & base_name,
560  const std::string & num_name,
561  const std::string & doc_string);
563 
569  std::string getMooseType(const std::string & name) const;
570  std::vector<std::string> getVecMooseType(const std::string & name) const;
571 
581  void addRequiredCoupledVar(const std::string & name, const std::string & doc_string);
582 
586  std::string getDocString(const std::string & name) const;
587 
595  void setDocString(const std::string & name, const std::string & doc);
596 
600  std::string getDocUnit(const std::string & name) const;
601 
608  void setDocUnit(const std::string & name, const std::string & doc_unit);
609 
613  bool isParamRequired(const std::string & name) const;
614 
618  void makeParamNotRequired(const std::string & name);
619 
625  bool isParamValid(const std::string & name) const;
626 
632  bool isParamSetByAddParam(const std::string & name) const;
633 
637  bool isParamDeprecated(const std::string & name) const;
638 
643  bool areAllRequiredParamsValid() const;
644 
648  std::string type(const std::string & name) const;
649 
653  bool isPrivate(const std::string & name) const;
654 
658  void declareControllable(const std::string & name, std::set<ExecFlagType> execute_flags = {});
659 
663  void markControlled(const std::string & name);
664 
668  bool isControllable(const std::string & name) const;
669 
673  const std::set<ExecFlagType> & getControllableExecuteOnTypes(const std::string & name) const;
674 
680  void registerBase(const std::string & value);
681 
685  std::optional<std::string> getBase() const;
686 
698  void registerSystemAttributeName(const std::string & value);
699 
704  const std::string & getSystemAttributeName() const;
705 
713  void registerBuildableTypes(const std::string & names);
714 
730  const std::string & name,
732  Moose::RelationshipManagerInputParameterCallback input_parameter_callback = nullptr);
733 
738 
742  const std::vector<std::string> & getBuildableTypes() const;
743 
747  const std::vector<std::tuple<std::string,
751 
753 
757  void collapseSyntaxNesting(bool collapse);
758  bool collapseSyntaxNesting() const;
760 
762 
766  void mooseObjectSyntaxVisibility(bool visibility);
767  bool mooseObjectSyntaxVisibility() const;
769 
771 
774  using Parameters::operator=;
775  using Parameters::operator+=;
779 
786  void checkParams(const std::string & parsing_syntax);
787 
795  void finalize(const std::string & parsing_syntax);
796 
810  std::filesystem::path
811  getFileBase(const std::optional<std::string> & param_name = std::optional<std::string>()) const;
812 
817  inline std::set<std::string>::const_iterator coupledVarsBegin() const
818  {
819  return _coupled_vars.begin();
820  }
821  inline std::set<std::string>::const_iterator coupledVarsEnd() const
822  {
823  return _coupled_vars.end();
824  }
825 
829  const std::set<std::string> & getCoupledVariableParamNames() const { return _coupled_vars; }
830 
834  const std::unordered_map<std::string, std::string> & getNewToDeprecatedVarMap() const
835  {
837  }
838 
840  bool isRangeChecked(const std::string & param_name) const;
841 
843  std::string rangeCheckedFunction(const std::string & name) const;
844 
846  bool hasDefault(const std::string & param_name) const;
847 
853  bool hasCoupledValue(const std::string & coupling_name) const;
854 
860  bool hasDefaultCoupledValue(const std::string & coupling_name) const;
861 
868  Real defaultCoupledValue(const std::string & coupling_name, unsigned int i = 0) const;
869 
875  unsigned int numberDefaultCoupledValues(const std::string & coupling_name) const;
876 
884  void defaultCoupledValue(const std::string & coupling_name, Real value, unsigned int i = 0);
885 
889  std::map<std::string, std::pair<std::string, std::string>> getAutoBuildVectors() const;
890 
891  // BEGIN APPLY PARAMETER METHODS
909  void applyParameters(const InputParameters & common,
910  const std::vector<std::string> & exclude = {},
911  const bool allow_private = false);
912 
930  void applySpecificParameters(const InputParameters & common,
931  const std::vector<std::string> & include,
932  bool allow_private = false);
933 
946  void applyParameter(const InputParameters & common,
947  const std::string & common_name,
948  bool allow_private = false,
949  bool override_default = false);
950  // END APPLY PARAMETER METHODS
951 
962  void applyCoupledVar(const InputParameters & common, const std::string & var_name);
963 
967  bool paramSetByUser(const std::string & name) const;
968 
973  bool isParamSetByUser(const std::string & name) const;
974 
980  bool isParamDefined(const std::string & name) const;
981 
983  /*
984  * These methods are here to retrieve parameters for scalar and vector types respectively. We will
985  * throw errors
986  * when returning most scalar and vector types.
987  */
988  template <typename T>
989  static const T & getParamHelper(const std::string & name,
990  const InputParameters & pars,
991  const T * the_type,
992  const MooseBase * moose_base = nullptr);
994 
995  using Parameters::get;
996 
998  template <typename R1,
999  typename R2,
1000  typename V1 = typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1002  std::vector<R1>>::type,
1003  typename V2 = typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1005  std::vector<R2>>::type>
1006  std::vector<std::pair<R1, R2>> get(const std::string & param1, const std::string & param2) const;
1007 
1011  std::set<std::string> getParametersList() const;
1012 
1016  std::set<std::string> getControllableParameters() const;
1017 
1021  std::set<std::string> getGroupParameters(const std::string & group) const;
1022 
1027  void setReservedValues(const std::string & name, const std::set<std::string> & reserved);
1028 
1033  std::set<std::string> reservedValues(const std::string & name) const;
1034 
1039  std::string blockLocation() const;
1040 
1045  std::string blockFullpath() const;
1046 
1050  const hit::Node * getHitNode(const std::string & param) const;
1056  void setHitNode(const std::string & param, const hit::Node & node, const SetParamHitNodeKey);
1057 
1062  std::string inputLocation(const std::string & param) const;
1063 
1068  std::string paramFullpath(const std::string & param) const;
1069 
1071  std::string errorPrefix(const std::string & param) const;
1072 
1077  std::string rawParamVal(const std::string & param) const;
1078 
1083  template <typename T>
1084  void ignoreParameter(const std::string & name);
1085 
1090  bool shouldIgnore(const std::string & name);
1091 
1095  template <typename T>
1096  bool isType(const std::string & name) const;
1097 
1104  std::string varName(const std::string & var_param_name,
1105  const std::string & moose_object_with_var_param_name) const;
1106 
1114  void renameParam(const std::string & old_name,
1115  const std::string & new_name,
1116  const std::string & new_docstring);
1117 
1124  void renameCoupledVar(const std::string & old_name,
1125  const std::string & new_name,
1126  const std::string & new_docstring);
1127 
1128  void deprecateParam(const std::string & old_name,
1129  const std::string & new_name,
1130  const std::string & removal_date);
1131 
1132  void deprecateCoupledVar(const std::string & old_name,
1133  const std::string & new_name,
1134  const std::string & removal_date);
1135 
1142  std::string checkForRename(const std::string & name) const;
1143 
1150  template <typename T>
1151  const T & get(std::string_view name) const;
1152 
1161  template <typename T>
1162  bool have_parameter(std::string_view name) const;
1163 
1171  template <typename T>
1172  void transferParam(const InputParameters & source_param,
1173  const std::string & name,
1174  const std::string & new_name = "",
1175  const std::string & new_description = "");
1176 
1189  std::vector<std::string> paramAliases(const std::string & param_name) const;
1190 
1195  const hit::Node * getHitNode() const { return _hit_node; }
1203  void setHitNode(const hit::Node & node, const SetHitNodeKey) { _hit_node = &node; }
1204 
1208  bool isFinalized() const { return _finalized; }
1209 
1213  std::optional<Moose::DataFileUtils::Path> queryDataFileNamePath(const std::string & name) const;
1214 
1215 private:
1216  // Private constructor so that InputParameters can only be created in certain places.
1217  InputParameters();
1218 
1222  void setParameters() {}
1223 
1224  template <typename T>
1225  static constexpr bool isFunctorNameType();
1226 
1230  template <typename T>
1231  std::string appendFunctorDescription(const std::string & doc_string) const;
1232 
1236  void setDeprecatedVarDocString(const std::string & new_name, const std::string & doc_string);
1237 
1238  void renameParamInternal(const std::string & old_name,
1239  const std::string & new_name,
1240  const std::string & docstring,
1241  const std::string & removal_date);
1242 
1243  void renameCoupledVarInternal(const std::string & old_name,
1244  const std::string & new_name,
1245  const std::string & docstring,
1246  const std::string & removal_date);
1247 
1248  static void callMooseErrorHelper(const MooseBase & moose_base, const std::string & error);
1249 
1250  struct Metadata
1251  {
1252  std::string _doc_string;
1254  std::string _doc_unit;
1256  std::string _custom_type;
1258  std::optional<CommandLineMetadata> _cl_data;
1260  std::optional<Moose::DataFileUtils::Path> _data_file_name_path;
1262  std::string _group;
1264  std::string _range_function;
1266  std::pair<std::string, std::string> _autobuild_vecs;
1268  bool _required = false;
1274  bool _valid = false;
1276  bool _is_private = false;
1279  std::vector<Real> _coupled_default = {0};
1281  bool _set_by_add_param = false;
1283  std::set<std::string> _reserved_values;
1287  const hit::Node * _hit_node;
1289  bool _controllable = false;
1291  std::set<ExecFlagType> _controllable_flags;
1293  bool _ignore = false;
1294  };
1295 
1296  Metadata & at(const std::string & param_name)
1297  {
1298  const auto param = checkForRename(param_name);
1299  if (_params.count(param) == 0)
1300  mooseError("param '", param, "' not present in InputParams");
1301  return _params[param];
1302  }
1303  const Metadata & at(const std::string & param_name) const
1304  {
1305  const auto param = checkForRename(param_name);
1306  if (_params.count(param) == 0)
1307  mooseError("param '", param, "' not present in InputParams");
1308  return _params.at(param);
1309  }
1310 
1321 
1325  void checkParamName(const std::string & name) const;
1326 
1331  template <typename T, typename S>
1332  void setParamHelper(const std::string & name, T & l_value, const S & r_value);
1333 
1342  template <typename T>
1343  void addCommandLineParamHelper(const std::string & name,
1344  const std::string & syntax,
1345  const bool required,
1346  const bool value_required);
1347 
1349  std::string _block_location;
1350 
1352  std::string _block_fullpath;
1353 
1356  std::map<std::string, Metadata> _params;
1357 
1359  std::set<std::string> _coupled_vars;
1360 
1363  std::string _class_description;
1364 
1367  std::vector<std::string> _buildable_types;
1368 
1373  std::vector<std::tuple<std::string,
1377 
1381 
1384 
1388 
1391 
1393  std::unordered_map<std::string, std::string> _new_to_deprecated_coupled_vars;
1394 
1399  std::map<std::string, std::pair<std::string, std::string>> _old_to_new_name_and_dep;
1400 
1403  std::multimap<std::string, std::string> _new_to_old_names;
1404 
1406  const hit::Node * _hit_node;
1407 
1410 
1411  // These are the only objects allowed to _create_ InputParameters
1414  friend class Parser;
1415  // for the printInputFile function in the action warehouse
1416  friend class ActionWarehouse;
1417 };
1418 
1419 template <typename T>
1420 void
1421 InputParameters::setHelper(const std::string & /*name*/)
1422 {
1423 }
1424 
1425 // Template and inline function implementations
1426 template <typename T>
1427 T &
1428 InputParameters::set(const std::string & name_in, bool quiet_mode)
1429 {
1430  const auto name = checkForRename(name_in);
1431 
1433  checkConsistentType<T>(name);
1434 
1435  T & result = this->Parameters::set<T>(name);
1436 
1437  if (quiet_mode)
1438  _params[name]._set_by_add_param = true;
1439 
1440  setHelper<T>(name);
1441 
1442  return result;
1443 }
1444 
1445 template <typename T, typename... Ts>
1446 void
1447 InputParameters::setParameters(const std::string & name,
1448  const T & value,
1449  Ts... extra_input_parameters)
1450 {
1451  this->set<T>(name) = value;
1452  this->setParameters(extra_input_parameters...);
1453 }
1454 
1455 template <typename T, typename UP_T>
1456 void
1457 InputParameters::rangeCheck(const std::string & full_name,
1458  const std::string & short_name,
1459  InputParameters::Parameter<std::vector<T>> * param,
1460  std::ostream & oss)
1461 {
1462  mooseAssert(param, "Parameter is NULL");
1463 
1464  if (!isParamValid(short_name) || _params[short_name]._range_function.empty())
1465  return;
1466 
1479  std::vector<std::string> vars;
1480  if (fp.ParseAndDeduceVariables(_params[short_name]._range_function, vars) != -1) // -1 for success
1481  {
1482  oss << "Error parsing expression: " << _params[short_name]._range_function << '\n';
1483  return;
1484  }
1485 
1486  // Fparser parameter buffer
1487  std::vector<UP_T> parbuf(vars.size());
1488 
1489  // parameter vector
1490  const std::vector<T> & value = param->set();
1491 
1492  // iterate over all vector values (maybe ;)
1493  bool need_to_iterate = false;
1494  unsigned int i = 0;
1495  do
1496  {
1497  // set parameters
1498  for (unsigned int j = 0; j < vars.size(); j++)
1499  {
1500  if (vars[j] == short_name)
1501  {
1502  if (value.size() == 0)
1503  {
1504  oss << "Range checking empty vector: " << _params[short_name]._range_function << '\n';
1505  return;
1506  }
1507 
1508  parbuf[j] = value[i];
1509  need_to_iterate = true;
1510  }
1511  else if (vars[j] == short_name + "_size")
1512  parbuf[j] = value.size();
1513  else
1514  {
1515  if (vars[j].substr(0, short_name.size() + 1) != short_name + "_")
1516  {
1517  oss << "Error parsing expression: " << _params[short_name]._range_function << '\n';
1518  return;
1519  }
1520  std::istringstream iss(vars[j]);
1521  iss.seekg(short_name.size() + 1);
1522 
1523  size_t index;
1524  if (iss >> index && iss.eof())
1525  {
1526  if (index >= value.size())
1527  {
1528  oss << "Error parsing expression: " << _params[short_name]._range_function
1529  << "\nOut of range variable " << vars[j] << '\n';
1530  return;
1531  }
1532  parbuf[j] = value[index];
1533  }
1534  else
1535  {
1536  oss << "Error parsing expression: " << _params[short_name]._range_function
1537  << "\nInvalid variable " << vars[j] << '\n';
1538  return;
1539  }
1540  }
1541  }
1542 
1543  // ensure range-checked input file parameter comparison functions
1544  // do absolute floating point comparisons instead of using a default epsilon.
1545  auto tmp_eps = fp.epsilon();
1546  fp.setEpsilon(0);
1547  UP_T result = fp.Eval(&parbuf[0]);
1548  fp.setEpsilon(tmp_eps);
1549 
1550  // test function using the parameters determined above
1551  if (fp.EvalError())
1552  {
1553  oss << "Error evaluating expression: " << _params[short_name]._range_function << '\n';
1554  return;
1555  }
1556 
1557  if (!result)
1558  {
1559  oss << "Range check failed for parameter " << full_name
1560  << "\n\tExpression: " << _params[short_name]._range_function << "\n";
1561  if (need_to_iterate)
1562  oss << "\t Component: " << i << '\n';
1563  }
1564 
1565  } while (need_to_iterate && ++i < value.size());
1566 }
1567 
1568 template <typename T, typename UP_T>
1569 void
1570 InputParameters::rangeCheck(const std::string & full_name,
1571  const std::string & short_name,
1572  InputParameters::Parameter<T> * param,
1573  std::ostream & oss)
1574 {
1575  mooseAssert(param, "Parameter is NULL");
1576 
1577  if (!isParamValid(short_name) || _params[short_name]._range_function.empty())
1578  return;
1579 
1580  // Parse the expression
1582  if (fp.Parse(_params[short_name]._range_function, short_name) != -1) // -1 for success
1583  {
1584  oss << "Error parsing expression: " << _params[short_name]._range_function << '\n';
1585  return;
1586  }
1587 
1588  // ensure range-checked input file parameter comparison functions
1589  // do absolute floating point comparisons instead of using a default epsilon.
1590  auto tmp_eps = fp.epsilon();
1591  fp.setEpsilon(0);
1592  // We require a non-const value for the implicit upscaling of the parameter type
1593  std::vector<UP_T> value(1, param->set());
1594  UP_T result = fp.Eval(&value[0]);
1595  fp.setEpsilon(tmp_eps);
1596 
1597  if (fp.EvalError())
1598  {
1599  oss << "Error evaluating expression: " << _params[short_name]._range_function
1600  << "\nPerhaps you used the wrong variable name?\n";
1601  return;
1602  }
1603 
1604  if (!result)
1605  oss << "Range check failed for parameter " << full_name
1606  << "\n\tExpression: " << _params[short_name]._range_function << "\n\tValue: " << value[0]
1607  << '\n';
1608 }
1609 
1610 template <typename T>
1611 T
1612 InputParameters::getCheckedPointerParam(const std::string & name_in,
1613  const std::string & error_string) const
1614 {
1615  const auto name = checkForRename(name_in);
1616 
1617  T param = this->get<T>(name);
1618 
1619  // Note: You will receive a compile error on this line if you attempt to pass a non-pointer
1620  // template type to this method
1621  if (param == NULL)
1622  mooseError("Parameter ", name, " is NULL.\n", error_string);
1623  return this->get<T>(name);
1624 }
1625 
1626 template <typename T>
1627 void
1628 InputParameters::addRequiredParam(const std::string & name, const std::string & doc_string)
1629 {
1631  checkConsistentType<T>(name);
1632 
1633  InputParameters::insert<T>(name);
1634  auto & metadata = _params[name];
1635  metadata._required = true;
1636  if constexpr (isFunctorNameType<T>())
1637  metadata._doc_string = appendFunctorDescription<T>(doc_string);
1638  else
1639  metadata._doc_string = doc_string;
1640 }
1641 
1642 template <typename T>
1643 void
1644 InputParameters::addRequiredParam(const std::string & /*name*/,
1645  const T & /*value*/,
1646  const std::string & /*doc_string*/)
1647 {
1648  mooseError("You cannot call addRequiredParam and supply a default value for this type, please "
1649  "use addParam instead");
1650 }
1651 
1652 template <typename T, typename S>
1653 void
1654 InputParameters::addParam(const std::string & name, const S & value, const std::string & doc_string)
1655 {
1657  checkConsistentType<T>(name);
1658 
1659  T & l_value = InputParameters::set<T>(name);
1660  auto & metadata = _params[name];
1661  if constexpr (isFunctorNameType<T>())
1662  metadata._doc_string = appendFunctorDescription<T>(doc_string);
1663  else
1664  metadata._doc_string = doc_string;
1665 
1666  // Set the parameter now
1667  setParamHelper(name, l_value, value);
1668 
1669  /* Indicate the default value, as set via addParam, is being used. The parameter is removed from
1670  the list whenever
1671  it changes, see set_attributes */
1672  metadata._set_by_add_param = true;
1673 }
1674 
1675 template <typename T>
1676 void
1677 InputParameters::addParam(const std::string & name, const std::string & doc_string)
1678 {
1680  checkConsistentType<T>(name);
1681 
1682  InputParameters::insert<T>(name);
1683  if constexpr (isFunctorNameType<T>())
1684  _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1685  else
1686  _params[name]._doc_string = doc_string;
1687 }
1688 
1689 template <typename T, typename S>
1690 void
1691 InputParameters::setParamHelper(const std::string & /*name*/, T & l_value, const S & r_value)
1692 {
1693  l_value = r_value;
1694 }
1695 
1696 template <typename T>
1697 void
1699  const std::string & syntax,
1700  const bool required,
1701  const bool value_required)
1702 {
1703  static_assert(isValidCommandLineType<T>::value,
1704  "This type is not a supported command line parameter type. See "
1705  "CommandLine::populateCommandLineParams to add it as a supported type.");
1706 
1707  auto & cl_data = at(name)._cl_data;
1708  cl_data = CommandLineMetadata();
1709 
1710  // Split up the syntax by whitespace
1711  std::vector<std::string> syntax_split;
1712  MooseUtils::tokenize(syntax, syntax_split, 1, " \t\n\v\f\r");
1713 
1714  // Set the single syntax string as the combined syntax with removed whitespace
1715  cl_data->syntax = MooseUtils::stringJoin(syntax_split);
1716  mooseAssert(cl_data->syntax.size(), "Empty token");
1717 
1718  // Set the switches; only parse those that begin with "-" as we also
1719  // provide examples within the syntax
1720  for (const auto & val : syntax_split)
1721  if (val.rfind("-", 0) == 0)
1722  {
1723  if (!std::regex_search(val, std::regex("^\\-+[a-zA-Z]")))
1724  mooseError("The switch '",
1725  val,
1726  "' for the command line parameter '",
1727  name,
1728  "' is invalid. It must begin with an alphabetical character.");
1729 
1730  cl_data->switches.push_back(val);
1732  }
1733 
1734  cl_data->required = required;
1735  cl_data->global = false;
1736 
1737  // No arguments needed for a boolean parameter
1738  if constexpr (std::is_same_v<T, bool>)
1739  {
1740  (void)value_required; // purposely unused; doesn't take a value
1741  cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1742  }
1743  // MooseEnums require a value
1744  else if constexpr (std::is_same_v<T, MooseEnum>)
1745  {
1746  (void)value_required; // purposely unused; always required
1747  cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1748  }
1749  // The user didn't specify a default, so a value is required
1750  else if (value_required)
1751  cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1752  // Otherwise, it's optional (user specified a default)
1753  else
1754  cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1755 }
1756 
1757 template <typename T>
1758 void
1760  const std::string & parsed_function,
1761  const std::string & doc_string)
1762 {
1763  addRequiredParam<T>(name, doc_string);
1764  _params[name]._range_function = parsed_function;
1765 }
1766 
1767 template <typename T>
1768 void
1769 InputParameters::addRangeCheckedParam(const std::string & name,
1770  const T & value,
1771  const std::string & parsed_function,
1772  const std::string & doc_string)
1773 {
1774  addParam<T>(name, value, doc_string);
1775  _params[name]._range_function = parsed_function;
1776 }
1777 
1778 template <typename T>
1779 void
1780 InputParameters::addRangeCheckedParam(const std::string & name,
1781  const std::string & parsed_function,
1782  const std::string & doc_string)
1783 {
1784  addParam<T>(name, doc_string);
1785  _params[name]._range_function = parsed_function;
1786 }
1787 
1788 template <typename T>
1789 void
1791  const std::string & custom_type,
1792  const std::string & doc_string)
1793 {
1794  addRequiredParam<T>(name, doc_string);
1795  _params[name]._custom_type = custom_type;
1796 }
1797 
1798 template <typename T>
1799 void
1800 InputParameters::addCustomTypeParam(const std::string & name,
1801  const T & value,
1802  const std::string & custom_type,
1803  const std::string & doc_string)
1804 {
1805  addParam<T>(name, value, doc_string);
1806  _params[name]._custom_type = custom_type;
1807 }
1808 
1809 template <typename T>
1810 void
1811 InputParameters::addCustomTypeParam(const std::string & name,
1812  const std::string & custom_type,
1813  const std::string & doc_string)
1814 {
1815  addParam<T>(name, doc_string);
1816  _params[name]._custom_type = custom_type;
1817 }
1818 
1819 template <typename T>
1820 void
1822  const std::string & custom_type,
1823  const std::string & doc_string,
1824  const std::string & deprecation_message)
1825 {
1826  _show_deprecated_message = false;
1827  addParam<T>(name, doc_string);
1828  auto & metadata = _params[name];
1829  metadata._custom_type = custom_type;
1830 
1831  metadata._deprecation_message = deprecation_message;
1832  _show_deprecated_message = true;
1833 }
1834 
1835 template <typename T>
1836 void
1837 InputParameters::addPrivateParam(const std::string & name)
1838 {
1840  checkConsistentType<T>(name);
1841 
1842  InputParameters::insert<T>(name);
1843  _params[name]._is_private = true;
1844 }
1845 
1846 template <typename T>
1847 void
1848 InputParameters::addPrivateParam(const std::string & name, const T & value)
1849 {
1851  checkConsistentType<T>(name);
1852 
1853  InputParameters::set<T>(name) = value;
1854  auto & metadata = _params[name];
1855  metadata._is_private = true;
1856  metadata._set_by_add_param = true;
1857 }
1858 
1859 template <typename T>
1860 void
1862  const std::string & syntax,
1863  const std::string & doc_string)
1864 {
1865  static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool");
1866 
1867  addRequiredParam<T>(name, doc_string);
1868  addCommandLineParamHelper<T>(name, syntax, /* required = */ true, /* value_required = */ true);
1869 }
1870 
1871 template <typename T>
1872 void
1873 InputParameters::addCommandLineParam(const std::string & name,
1874  const std::string & syntax,
1875  const std::string & doc_string)
1876 {
1877  static_assert(!std::is_same_v<T, MooseEnum>,
1878  "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
1879  "MooseEnum requires initialization");
1880 
1881  auto constexpr is_bool = std::is_same_v<T, bool>;
1882  if constexpr (is_bool)
1883  addParam<T>(name, false, doc_string);
1884  else
1885  addParam<T>(name, doc_string);
1886 
1887  addCommandLineParamHelper<T>(
1888  name, syntax, /* required = */ false, /* value_required = */ !is_bool);
1889 }
1890 
1891 template <typename T>
1892 void
1893 InputParameters::addCommandLineParam(const std::string & name,
1894  const std::string & syntax,
1895  const T & value,
1896  const std::string & doc_string)
1897 {
1898  if constexpr (std::is_same_v<T, bool>)
1899  mooseAssert(!value, "Default for bool must be false");
1900 
1901  addParam<T>(name, value, doc_string);
1902  addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ true);
1903 }
1904 
1905 template <typename T>
1906 void
1908  const std::string & syntax,
1909  const T & value,
1910  const std::string & doc_string)
1911 {
1912  mooseAssert(name == "mesh_only" || name == "recover" || name == "run",
1913  "Not supported for new parameters");
1914  static_assert(!std::is_same_v<T, bool>, "Cannot be used for a bool (does not take a value)");
1915  addParam<T>(name, value, doc_string);
1916  addCommandLineParamHelper<T>(name, syntax, /* required = */ false, /* value_required = */ false);
1917 }
1918 
1919 template <typename T>
1920 void
1921 InputParameters::checkConsistentType(const std::string & name_in) const
1922 {
1923  const auto name = checkForRename(name_in);
1924 
1925  // If we don't currently have the Parameter, can't be any inconsistency
1927  if (it == _values.end())
1928  return;
1929 
1930  // Now, if we already have the Parameter, but it doesn't have the
1931  // right type, throw an error.
1932  if (!this->Parameters::have_parameter<T>(name))
1933  mooseError("Attempting to set parameter \"",
1934  name,
1935  "\" with type (",
1936  libMesh::demangle(typeid(T).name()),
1937  ")\nbut the parameter already exists as type (",
1938  it->second->type(),
1939  ")");
1940 }
1941 
1942 template <typename T>
1943 void
1944 InputParameters::suppressParameter(const std::string & name_in)
1945 {
1946  const auto name = checkForRename(name_in);
1947  if (!this->have_parameter<T>(name))
1948  mooseError("Unable to suppress nonexistent parameter: ", name);
1949 
1950  auto & metadata = _params[name];
1951  metadata._required = false;
1952  metadata._is_private = true;
1953  metadata._controllable = false;
1954 }
1955 
1956 template <typename T>
1957 void
1958 InputParameters::ignoreParameter(const std::string & name_in)
1959 {
1960  const auto name = checkForRename(name_in);
1961  suppressParameter<T>(name);
1962  _params[name]._ignore = true;
1963 }
1964 
1965 template <typename T>
1966 void
1967 InputParameters::makeParamRequired(const std::string & name_in)
1968 {
1969  const auto name = checkForRename(name_in);
1970 
1971  if (!this->have_parameter<T>(name))
1972  mooseError("Unable to require nonexistent parameter: ", name);
1973 
1974  _params[name]._required = true;
1975 }
1976 
1977 template <typename T>
1978 void
1979 InputParameters::makeParamNotRequired(const std::string & name_in)
1980 {
1981  const auto name = checkForRename(name_in);
1982 
1983  if (!this->have_parameter<T>(name))
1984  mooseError("Unable to un-require nonexistent parameter: ", name);
1985 
1986  _params[name]._required = false;
1987 }
1988 
1989 template <typename T>
1990 void
1991 InputParameters::addDeprecatedParam(const std::string & name,
1992  const T & value,
1993  const std::string & doc_string,
1994  const std::string & deprecation_message)
1995 {
1996  _show_deprecated_message = false;
1997  mooseAssert(!_old_to_new_name_and_dep.count(name),
1998  "Attempting to deprecate via addDeprecatedParam the parameter, '"
1999  << name << "', already deprecated via deprecateParam or renamed via renameParam");
2000  addParam<T>(name, value, doc_string);
2001 
2002  _params[name]._deprecation_message = deprecation_message;
2003  _show_deprecated_message = true;
2004 }
2005 
2006 template <typename T>
2007 void
2008 InputParameters::addDeprecatedParam(const std::string & name,
2009  const std::string & doc_string,
2010  const std::string & deprecation_message)
2011 {
2012  _show_deprecated_message = false;
2013  mooseAssert(!_old_to_new_name_and_dep.count(name),
2014  "Attempting to deprecate via addDeprecatedParam the parameter, '"
2015  << name << "', already deprecated via deprecateParam or renamed via renameParam");
2016  addParam<T>(name, doc_string);
2017 
2018  _params[name]._deprecation_message = deprecation_message;
2019  _show_deprecated_message = true;
2020 }
2021 
2022 // Forward declare MooseEnum specializations for add*Param
2023 template <>
2024 void InputParameters::addRequiredParam<MooseEnum>(const std::string & name,
2025  const MooseEnum & moose_enum,
2026  const std::string & doc_string);
2027 
2028 template <>
2029 void InputParameters::addRequiredParam<MultiMooseEnum>(const std::string & name,
2030  const MultiMooseEnum & moose_enum,
2031  const std::string & doc_string);
2032 
2033 template <>
2034 void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2035  const std::string & name,
2036  const std::vector<MooseEnum> & moose_enums,
2037  const std::string & doc_string);
2038 
2039 template <>
2040 void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2041  const std::string & name,
2042  const std::vector<MultiMooseEnum> & moose_enums,
2043  const std::string & doc_string);
2044 
2045 template <>
2046 void InputParameters::addParam<MooseEnum>(const std::string & /*name*/,
2047  const std::string & /*doc_string*/);
2048 
2049 template <>
2050 void InputParameters::addParam<MultiMooseEnum>(const std::string & /*name*/,
2051  const std::string & /*doc_string*/);
2052 
2053 template <>
2054 void InputParameters::addParam<std::vector<MooseEnum>>(const std::string & /*name*/,
2055  const std::string & /*doc_string*/);
2056 
2057 template <>
2058 void InputParameters::addParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2059  const std::string & /*doc_string*/);
2060 
2061 template <>
2062 void
2063 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(const std::string & /*name*/,
2064  const std::string & /*doc_string*/);
2065 
2066 template <>
2067 void InputParameters::addPrivateParam<MooseEnum>(const std::string & /*name*/);
2068 
2069 template <>
2070 void InputParameters::addPrivateParam<MultiMooseEnum>(const std::string & /*name*/);
2071 
2072 template <>
2073 void InputParameters::addDeprecatedParam<MooseEnum>(const std::string & /*name*/,
2074  const std::string & /*doc_string*/,
2075  const std::string & /*deprecation_message*/);
2076 
2077 template <>
2078 void
2079 InputParameters::addDeprecatedParam<MultiMooseEnum>(const std::string & /*name*/,
2080  const std::string & /*doc_string*/,
2081  const std::string & /*deprecation_message*/);
2082 
2083 template <>
2084 void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2085  const std::string & /*name*/,
2086  const std::string & /*doc_string*/,
2087  const std::string & /*deprecation_message*/);
2088 
2089 // Forward declare specializations for setParamHelper
2090 template <>
2091 void InputParameters::setParamHelper<PostprocessorName, Real>(const std::string & name,
2092  PostprocessorName & l_value,
2093  const Real & r_value);
2094 
2095 template <>
2096 void InputParameters::setParamHelper<PostprocessorName, int>(const std::string & name,
2097  PostprocessorName & l_value,
2098  const int & r_value);
2099 
2100 template <>
2101 void InputParameters::setParamHelper<FunctionName, Real>(const std::string & /*name*/,
2102  FunctionName & l_value,
2103  const Real & r_value);
2104 
2105 template <>
2106 void InputParameters::setParamHelper<FunctionName, int>(const std::string & /*name*/,
2107  FunctionName & l_value,
2108  const int & r_value);
2109 
2110 template <>
2111 void InputParameters::setParamHelper<MaterialPropertyName, Real>(const std::string & /*name*/,
2112  MaterialPropertyName & l_value,
2113  const Real & r_value);
2114 
2115 template <>
2116 void InputParameters::setParamHelper<MaterialPropertyName, int>(const std::string & /*name*/,
2117  MaterialPropertyName & l_value,
2118  const int & r_value);
2119 
2120 template <>
2121 void InputParameters::setParamHelper<MooseFunctorName, Real>(const std::string & /*name*/,
2122  MooseFunctorName & l_value,
2123  const Real & r_value);
2124 
2125 template <>
2126 void InputParameters::setParamHelper<MooseFunctorName, int>(const std::string & /*name*/,
2127  MooseFunctorName & l_value,
2128  const int & r_value);
2129 
2130 // TODO: pass MooseBase here instead and use it in objects
2131 template <typename T>
2132 const T &
2133 InputParameters::getParamHelper(const std::string & name_in,
2134  const InputParameters & pars,
2135  const T *,
2136  const MooseBase * moose_base /* = nullptr */)
2137 {
2138  const auto name = pars.checkForRename(name_in);
2139 
2140  if (!pars.isParamValid(name))
2141  {
2142  std::stringstream err;
2143  err << "The parameter \"" << name << "\" is being retrieved before being set.";
2144  if (moose_base)
2145  callMooseErrorHelper(*moose_base, err.str());
2146  else
2147  mooseError(err.str());
2148  }
2149 
2150  return pars.get<T>(name);
2151 }
2152 
2153 // Declare specializations so we don't fall back on the generic
2154 // implementation, but the definition will be in InputParameters.C so
2155 // we won't need to bring in *MooseEnum header files here.
2156 template <>
2157 const MooseEnum &
2158 InputParameters::getParamHelper<MooseEnum>(const std::string & name,
2159  const InputParameters & pars,
2160  const MooseEnum *,
2161  const MooseBase * moose_base /* = nullptr */);
2162 
2163 template <>
2164 const MultiMooseEnum &
2165 InputParameters::getParamHelper<MultiMooseEnum>(const std::string & name,
2166  const InputParameters & pars,
2167  const MultiMooseEnum *,
2168  const MooseBase * moose_base /* = nullptr */);
2169 
2170 template <typename R1, typename R2, typename V1, typename V2>
2171 std::vector<std::pair<R1, R2>>
2172 InputParameters::get(const std::string & param1_in, const std::string & param2_in) const
2173 {
2174  const auto param1 = checkForRename(param1_in);
2175  const auto param2 = checkForRename(param2_in);
2176 
2177  const auto & v1 = get<V1>(param1);
2178  const auto & v2 = get<V2>(param2);
2179 
2180  auto controllable = getControllableParameters();
2181  if (controllable.count(param1) || controllable.count(param2))
2182  mooseError(errorPrefix(param1),
2183  " and/or ",
2184  errorPrefix(param2) +
2185  " are controllable parameters and cannot be retireved using "
2186  "the MooseObject::getParam/InputParameters::get methods for pairs");
2187 
2188  if (v1.size() != v2.size())
2189  mooseError("Vector parameters ",
2190  errorPrefix(param1),
2191  "(size: ",
2192  v1.size(),
2193  ") and " + errorPrefix(param2),
2194  "(size: ",
2195  v2.size(),
2196  ") are of different lengths \n");
2197 
2198  std::vector<std::pair<R1, R2>> parameter_pairs;
2199  auto i1 = v1.begin();
2200  auto i2 = v2.begin();
2201  for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2202  parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2203  return parameter_pairs;
2204 }
2205 
2207 
2208 template <typename T>
2209 bool
2210 InputParameters::isType(const std::string & name_in) const
2211 {
2212  const auto name = checkForRename(name_in);
2213 
2214  if (!_params.count(name))
2215  mooseError("Parameter \"", name, "\" is not valid.");
2216  return have_parameter<T>(name);
2217 }
2218 
2219 template <typename T>
2220 const T &
2221 InputParameters::get(std::string_view name_in) const
2222 {
2223  const auto name = checkForRename(std::string(name_in));
2224 
2225  return Parameters::get<T>(name);
2226 }
2227 
2228 template <typename T>
2229 bool
2230 InputParameters::have_parameter(std::string_view name_in) const
2231 {
2232  const auto name = checkForRename(std::string(name_in));
2233 
2234  return Parameters::have_parameter<T>(name);
2235 }
2236 
2237 template <typename T>
2238 void
2240  const std::string & name_in,
2241  const std::string & new_name,
2242  const std::string & new_description)
2243 {
2244  const auto name = source_params.checkForRename(std::string(name_in));
2245  const auto p_name = new_name.empty() ? name_in : new_name;
2246  if (!source_params.have_parameter<T>(name) && !source_params.hasCoupledValue(name))
2247  mooseError("The '",
2248  name_in,
2249  "' parameter could not be transferred because it does not exist with type '",
2250  MooseUtils::prettyCppType<T>(),
2251  "' in the source parameters");
2252  if (name != name_in)
2253  mooseWarning("The transferred parameter " + name_in + " is deprecated in favor of " + name +
2254  " in the source parameters. The new name should likely be used for the parameter "
2255  "transfer instead.");
2256  const std::string description =
2257  new_description.empty() ? source_params.getDescription(name) : new_description;
2258 
2259  if (source_params.isParamRequired(name))
2260  {
2261  // Check for a variable parameter
2262  if (source_params.hasCoupledValue(name))
2263  addRequiredCoupledVar(p_name, description);
2264  // Enums parameters have a default list of options
2265  else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2266  addRequiredParam<T>(p_name, source_params.get<T>(name), description);
2267  else if (source_params.isRangeChecked(name))
2268  addRequiredRangeCheckedParam<T>(
2269  p_name, source_params.rangeCheckedFunction(name), description);
2270  else
2271  addRequiredParam<T>(p_name, description);
2272  }
2273  else
2274  {
2275  // Check for a variable parameter
2276  if (source_params.hasCoupledValue(name))
2277  {
2278  if (!source_params.hasDefaultCoupledValue(name))
2279  addCoupledVar(p_name, description);
2280  else if (source_params.numberDefaultCoupledValues(name) == 1)
2281  addCoupledVar(p_name, source_params.defaultCoupledValue(name), description);
2282  else
2283  {
2284  std::vector<Real> coupled_values;
2285  for (const auto i : libMesh::make_range(source_params.numberDefaultCoupledValues(name)))
2286  coupled_values.push_back(source_params.defaultCoupledValue(name, i));
2287  addCoupledVar(p_name, coupled_values, description);
2288  }
2289  }
2290  else if (source_params.isRangeChecked(name))
2291  {
2292  if (source_params.hasDefault(name))
2293  addRangeCheckedParam<T>(p_name,
2294  source_params.get<T>(name),
2295  source_params.rangeCheckedFunction(name),
2296  description);
2297  else
2298  addRangeCheckedParam<T>(p_name, source_params.rangeCheckedFunction(name), description);
2299  }
2300  else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2301  addParam<T>(p_name, source_params.get<T>(name), description);
2302  else
2303  {
2304  if (source_params.hasDefault(name))
2305  addParam<T>(p_name, source_params.get<T>(name), description);
2306  else
2307  addParam<T>(p_name, description);
2308  }
2309  }
2310 
2311  // Copy other attributes
2312  if (source_params.isPrivate(name))
2313  _params[p_name]._is_private = true;
2314  if (source_params.isControllable(name))
2315  _params[p_name]._controllable = true;
2316 }
2317 
2318 namespace Moose
2319 {
2320 namespace internal
2321 {
2322 template <typename T>
2323 constexpr T *
2325 {
2326  return nullptr;
2327 }
2328 
2329 #ifdef MFEM_ENABLED
2330 
2331 template <typename T>
2332 constexpr bool
2334 {
2335  return std::is_same_v<T, MFEMScalarCoefficientName> ||
2336  std::is_same_v<T, MFEMVectorCoefficientName>;
2337 }
2338 
2339 template <typename T, typename A>
2340 constexpr bool
2341 isMFEMFunctorNameTypeHelper(std::vector<T, A> *)
2342 {
2343  return isMFEMFunctorNameTypeHelper(getNullptrExample<T>());
2344 }
2345 
2346 #endif
2347 
2348 template <typename T>
2349 constexpr bool
2351 {
2352  return std::is_same_v<T, MooseFunctorName>
2353 #ifdef MFEM_ENABLED
2354  || std::is_same_v<T, MFEMScalarCoefficientName>
2355 #endif
2356  ;
2357 }
2358 
2359 template <typename T, typename A>
2360 constexpr bool
2361 isScalarFunctorNameTypeHelper(std::vector<T, A> *)
2362 {
2363  return isScalarFunctorNameTypeHelper(getNullptrExample<T>());
2364 }
2365 
2366 template <typename T>
2367 constexpr bool
2369 {
2370 #ifdef MFEM_ENABLED
2371  return std::is_same_v<T, MFEMVectorCoefficientName>;
2372 #else
2373  return false;
2374 #endif
2375 }
2376 
2377 template <typename T, typename A>
2378 constexpr bool
2379 isVectorFunctorNameTypeHelper(std::vector<T, A> *)
2380 {
2381  return isVectorFunctorNameTypeHelper(getNullptrExample<T>());
2382 }
2383 
2384 template <typename T>
2385 constexpr bool
2387 {
2389 }
2390 }
2391 }
2392 
2393 template <typename T>
2394 constexpr bool
2396 {
2397  return Moose::internal::isFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>());
2398 }
2399 
2400 template <typename T>
2401 std::string
2402 InputParameters::appendFunctorDescription(const std::string & doc_string) const
2403 {
2404  auto numeric_value_type = []()
2405  {
2407  Moose::internal::getNullptrExample<T>()))
2408  return "number";
2410  Moose::internal::getNullptrExample<T>()))
2411  return "numeric vector value (enclosed in curly braces)";
2412  else
2413  {
2414  mooseAssert(false, "We control instantiations of this method");
2415  return "";
2416  }
2417  };
2418 
2419  return MooseUtils::trim(doc_string, ". ") + ". A functor is any of the following: a variable, " +
2420  (
2421 #ifdef MFEM_ENABLED
2422  Moose::internal::isMFEMFunctorNameTypeHelper(Moose::internal::getNullptrExample<T>())
2423  ? "an MFEM"
2424  :
2425 #endif
2426  "a functor") +
2427  " material property, a function, a postprocessor or a " + numeric_value_type() + ".";
2428 }
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)
OStreamProxy err
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.
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:963
Base class for everything in MOOSE with a name and a type.
Definition: MooseBase.h:32
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::optional< std::string > getBase() const
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...
bool isControllable(const std::string &name) const
Returns a Boolean indicating whether the specified parameter is controllable.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
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::string _block_location
original location of input block (i.e. filename,linenum) - used for nice error messages.
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:336
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.
std::string _block_fullpath
full HIT path of the block from the input file - used for nice error messages.
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...
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.
bool attemptPrintDeprecated(const std::string &name)
Prints the deprecated parameter message, assuming we have the right flags set.
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 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.
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...
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.
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:28
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::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Definition: MooseTypes.h:989
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
std::string demangle(const char *name)
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: MooseApp.h:70
SetParamHitNodeKey(const SetParamHitNodeKey &)
void rangeCheck(const std::string &full_name, const std::string &short_name, InputParameters::Parameter< T > *param, std::ostream &oss=Moose::out)
Runs a range on the supplied parameter if it exists and throws an error if that check fails...
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 _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.
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 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 errorPrefix(const std::string &param) const
generate error message prefix with parameter name and location (if available)
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
static void callMooseErrorHelper(const MooseBase &moose_base, const std::string &error)
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:100
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.
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type, const MooseBase *moose_base=nullptr)