23#include "libmesh/parameters.h"
25#ifdef LIBMESH_HAVE_FPARSER
26#include "libmesh/fparser.hh"
35#include <unordered_map>
41#include <gtest/gtest.h>
75 virtual void clear()
override;
139 template <
typename T>
143 std::is_same_v<T, std::string> || std::is_same_v<T, std::vector<std::string>> ||
144 std::is_same_v<T, Real> || std::is_same_v<T, unsigned int> || std::is_same_v<T, int> ||
145 std::is_same_v<T, bool> || std::is_same_v<T, MooseEnum>;
162 virtual void set_attributes(
const std::string & name,
bool inserted_only)
override;
170 template <
typename T>
171 void setHelper(
const std::string & name);
188 template <
typename T>
189 T &
set(
const std::string & name,
bool quiet_mode =
false);
202 template <
typename T,
typename... Ts>
203 void setParameters(
const std::string & name,
const T & value, Ts... extra_input_parameters);
213 template <
typename T,
typename UP_T>
214 std::optional<std::pair<bool, std::string>>
216 const std::string & short_name,
217 const InputParameters::Parameter<T> & param,
218 const bool include_param_path =
true);
219 template <
typename T,
typename UP_T>
220 std::optional<std::pair<bool, std::string>>
222 const std::string & short_name,
223 const InputParameters::Parameter<std::vector<T>> & param,
224 const bool include_param_path =
true);
230 template <
typename T>
238 template <
typename T>
239 void addRequiredParam(
const std::string & name,
const std::string & doc_string);
245 template <
typename T>
247 addRequiredParam(
const std::string & name,
const T & moose_enum,
const std::string & doc_string);
256 template <
typename T,
typename S>
257 void addParam(
const std::string & name,
const S & value,
const std::string & doc_string);
258 template <
typename T>
259 void addParam(
const std::string & name,
const std::string & doc_string);
265 template <
typename T>
267 const std::initializer_list<typename T::value_type> & value,
268 const std::string & doc_string)
270 addParam<T>(name, T{value}, doc_string);
279 template <
typename T>
281 const std::string & parsed_function,
282 const std::string & doc_string);
283 template <
typename T>
286 const std::string & parsed_function,
287 const std::string & doc_string);
288 template <
typename T>
290 const std::string & parsed_function,
291 const std::string & doc_string);
299 template <
typename T>
301 const std::string & custom_type,
302 const std::string & doc_string);
303 template <
typename T>
306 const std::string & custom_type,
307 const std::string & doc_string);
308 template <
typename T>
310 const std::string & custom_type,
311 const std::string & doc_string);
312 template <
typename T>
314 const std::string & custom_type,
315 const std::string & doc_string,
316 const std::string & deprecation_msg);
324 template <
typename T>
326 template <
typename T>
338 template <
typename T>
340 const std::string & syntax,
341 const std::string & doc_string);
342 template <
typename T>
344 const std::string & syntax,
345 const std::string & doc_string);
346 template <
typename T>
348 const std::string & syntax,
350 const std::string & doc_string);
351 template <
typename T>
353 const std::string & syntax,
354 const std::initializer_list<typename T::value_type> & value,
355 const std::string & doc_string)
357 addCommandLineParam<T>(name, syntax, T{value}, doc_string);
377 template <
typename T>
379 const std::string & syntax,
381 const std::string & doc_string);
397 template <
typename T>
400 const std::string & doc_string,
401 const std::string & deprecation_message);
403 template <
typename T>
405 const std::string & doc_string,
406 const std::string & deprecation_message);
417 template <
typename T>
430 std::optional<InputParameters::CommandLineMetadata>
460 const std::string &
getDescription(
const std::string & name)
const;
476 void moveParamToGroup(
const std::string & name,
const std::string & group_name);
489 std::string
getGroupName(
const std::string & param_name)
const;
497 template <
typename T>
504 template <
typename T>
511 template <
typename T>
519 void addCoupledVar(
const std::string & name,
const std::string & doc_string);
529 const std::string & new_name,
530 const std::string & removal_date =
"");
540 void addCoupledVar(
const std::string & name,
const Real value,
const std::string & doc_string);
551 const std::vector<Real> & value,
552 const std::string & doc_string);
573 const std::string & base_name,
574 const std::string & num_name,
575 const std::string & doc_string);
577 const std::string & base_name,
578 const std::string & num_name,
579 const std::string & doc_string);
587 std::string
getMooseType(
const std::string & name)
const;
588 std::vector<std::string>
getVecMooseType(
const std::string & name)
const;
629 std::string
getDocString(
const std::string & name)
const;
638 void setDocString(
const std::string & name,
const std::string & doc);
643 std::string
getDocUnit(
const std::string & name)
const;
651 void setDocUnit(
const std::string & name,
const std::string & doc_unit);
682#ifdef MOOSE_KOKKOS_ENABLED
699 std::string
type(
const std::string & name)
const;
704 bool isPrivate(
const std::string & name)
const;
709 void declareControllable(
const std::string & name, std::set<ExecFlagType> execute_flags = {});
745 const std::string &
getBase()
const;
790 const std::string & name,
807 const std::vector<std::tuple<std::string,
834 using Parameters::operator=;
835 using Parameters::operator+=;
846 void checkParams(
const std::string & parsing_syntax);
855 std::vector<std::string>
857 const std::set<std::string> & skip_required_params = {},
858 bool skip_private =
false)
const;
869 std::optional<std::pair<bool, std::string>>
parameterRangeCheck(
const Parameters::Value & value,
870 const std::string & long_name,
871 const std::string & short_name,
872 const bool include_param_path);
881 void finalize(
const std::string & parsing_syntax);
896 std::filesystem::path
897 getFileBase(
const std::optional<std::string> & param_name = std::optional<std::string>())
const;
932 bool hasDefault(
const std::string & param_name)
const;
948 mooseDeprecated(
"InputParameters::hasCoupledValue() is deprecated. Use "
949 "InputParameters::hasCoupledVar() instead.");
959 void setCoupledVar(
const std::string & coupling_name,
const std::string & value);
967 void setCoupledVar(
const std::string & coupling_name,
const std::vector<VariableName> &
values);
974 const std::vector<VariableName> &
getCoupledVar(
const std::string & coupling_name)
const;
1005 void defaultCoupledValue(
const std::string & coupling_name, Real value,
unsigned int i = 0);
1031 const std::vector<std::string> & exclude = {},
1032 const bool allow_private =
false);
1040 const std::vector<std::string> & exclude = {},
1041 const bool allow_private =
false);
1061 const std::vector<std::string> & include,
1062 bool allow_private =
false);
1076 const std::string & common_name,
1077 bool allow_private =
false);
1119 template <
typename T>
1120 const T *
queryParam(
const std::string & name)
const;
1128 template <
typename T>
1132 using Parameters::get;
1135 template <
typename R1,
1137 typename V1 =
typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1140 typename V2 =
typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1143 std::vector<std::pair<R1, R2>>
get(
const std::string & param1,
const std::string & param2)
const;
1164 void setReservedValues(
const std::string & name,
const std::set<std::string> & reserved);
1170 std::set<std::string>
reservedValues(
const std::string & name)
const;
1187 const hit::Node *
getHitNode(
const std::string & param)
const;
1193 void setHitNode(
const std::string & param,
const hit::Node & node,
const SetParamHitNodeKey);
1219 template <
typename... Args>
1220 std::string
paramMessage(
const std::string & param, Args... args)
const;
1225 template <
typename... Args>
1226 [[noreturn]]
void mooseError(Args &&... args)
const;
1232 template <
typename... Args>
1233 [[noreturn]]
void paramError(
const std::string & param, Args... args)
const;
1239 std::string
rawParamVal(
const std::string & param)
const;
1245 template <
typename T>
1257 template <
typename T>
1258 bool isType(
const std::string & name)
const;
1266 std::string
varName(
const std::string & var_param_name,
1267 const std::string & moose_object_with_var_param_name)
const;
1285 const std::string & new_name,
1286 const std::string & new_docstring);
1295 const std::string & new_name,
1296 const std::string & new_docstring);
1299 const std::string & new_name,
1300 const std::string & removal_date);
1303 const std::string & new_name,
1304 const std::string & removal_date);
1312 const std::string &
checkForRename(
const std::string & name)
const;
1320 template <
typename T>
1321 const T &
get(std::string_view name)
const;
1331 template <
typename T>
1341 template <
typename T>
1343 const std::string & name,
1344 const std::string & new_name =
"",
1345 const std::string & new_description =
"");
1359 std::vector<std::string>
paramAliases(
const std::string & param_name)
const;
1394 const hit::Node & node,
1406 template <
typename T>
1412 template <
typename T>
1421 const std::string & new_name,
1422 const std::string & docstring,
1423 const std::string & removal_date);
1426 const std::string & new_name,
1427 const std::string & docstring,
1428 const std::string & removal_date);
1436 std::pair<std::string, const hit::Node *>
paramMessageContext(
const std::string & param)
const;
1493 if (
_params.count(param) == 0)
1494 mooseError(
"param '", param,
"' not present in InputParams");
1500 if (
_params.count(param) == 0)
1501 mooseError(
"param '", param,
"' not present in InputParams");
1525 template <
typename T,
typename S>
1526 void setParamHelper(
const std::string & name, T & l_value,
const S & r_value);
1536 template <
typename T>
1538 const std::string & syntax,
1539 const bool required,
1540 const bool value_required);
1547 const bool with_prefix =
true,
1548 const hit::Node * node =
nullptr,
1549 const bool show_trace =
true)
const;
1570 std::vector<std::tuple<std::string,
1616template <
typename T>
1623template <
typename T>
1630 checkConsistentType<T>(name);
1632 T & result = this->Parameters::set<T>(name);
1635 _params[name]._set_by_add_param =
true;
1642template <
typename T,
typename... Ts>
1646 Ts... extra_input_parameters)
1648 this->set<T>(name) = value;
1652template <
typename T,
typename UP_T>
1653std::optional<std::pair<bool, std::string>>
1655 const std::string & short_name,
1656 const InputParameters::Parameter<std::vector<T>> & param,
1657 const bool include_param_path)
1662 const auto & range_function =
_params[short_name]._range_function;
1663 if (range_function.empty())
1678 std::vector<std::string>
vars;
1679 if (fp.ParseAndDeduceVariables(range_function,
vars) != -1)
1681 "Error parsing expression '" + range_function +
"' for parameter " + short_name +
""}};
1684 std::vector<UP_T> parbuf(
vars.size());
1687 const std::vector<T> & value = param.get();
1690 bool need_to_iterate =
false;
1695 for (
unsigned int j = 0; j <
vars.size(); j++)
1697 if (
vars[j] == short_name)
1699 if (value.size() == 0)
1701 std::ostringstream oss;
1702 oss <<
"Range checking empty vector";
1703 if (include_param_path)
1704 oss <<
" parameter " << full_name;
1705 oss <<
"; expression = '" << range_function <<
"'";
1706 return {{
true, oss.str()}};
1709 parbuf[j] = value[i];
1710 need_to_iterate =
true;
1712 else if (
vars[j] == short_name +
"_size")
1713 parbuf[j] = value.size();
1716 if (
vars[j].substr(0, short_name.size() + 1) != short_name +
"_")
1717 return {{
false,
"Error parsing expression '" + range_function +
"'"}};
1718 std::istringstream iss(
vars[j]);
1719 iss.seekg(short_name.size() + 1);
1722 if (iss >> index && iss.eof())
1724 if (index >= value.size())
1726 std::ostringstream oss;
1727 oss <<
"Error parsing expression '" + range_function +
"'";
1728 if (include_param_path)
1729 oss <<
" for parameter " << full_name;
1730 oss <<
"; out of range variable '" +
vars[j] <<
"'";
1731 return {{
true, oss.str()}};
1733 parbuf[j] = value[index];
1737 "Error parsing expression '" + range_function +
"'; invalid variable '" +
1744 auto tmp_eps = fp.epsilon();
1746 UP_T result = fp.Eval(&parbuf[0]);
1747 fp.setEpsilon(tmp_eps);
1751 return {{
false,
"Error evaluating expression '" + range_function +
"'"}};
1755 std::ostringstream oss;
1756 oss <<
"Range check failed";
1757 if (include_param_path)
1758 oss <<
" for parameter " << full_name;
1759 oss <<
"; expression = '" << range_function <<
"'";
1760 if (need_to_iterate)
1761 oss <<
", component " << i;
1762 return {{
true, oss.str()}};
1765 }
while (need_to_iterate && ++i < value.size());
1770template <
typename T,
typename UP_T>
1771std::optional<std::pair<bool, std::string>>
1773 const std::string & short_name,
1774 const InputParameters::Parameter<T> & param,
1775 const bool include_param_path)
1780 const auto & range_function =
_params[short_name]._range_function;
1781 if (range_function.empty())
1786 if (fp.Parse(range_function, short_name) != -1)
1788 "Error parsing expression '" + range_function +
"'" +
" for parameter " + short_name}};
1792 auto tmp_eps = fp.epsilon();
1795 std::vector<UP_T> value(1, param.get());
1796 UP_T result = fp.Eval(&value[0]);
1797 fp.setEpsilon(tmp_eps);
1801 "Error evaluating expression '" + range_function +
"' for parameter " + short_name +
1802 "; perhaps you used the wrong variable name?"}};
1806 std::ostringstream oss;
1807 oss <<
"Range check failed";
1808 if (include_param_path)
1809 oss <<
" for parameter " << full_name;
1810 oss <<
"; expression = '" << range_function <<
"', value = " << value[0];
1811 return {{
true, oss.str()}};
1817template <
typename T>
1820 const std::string & error_string)
const
1824 T param = this->get<T>(name);
1829 mooseError(
"Parameter ", name,
" is NULL.\n", error_string);
1833template <
typename T>
1838 checkConsistentType<T>(name);
1840 InputParameters::insert<T>(name);
1841 auto & metadata =
_params[name];
1842 metadata._required =
true;
1843 if constexpr (isFunctorNameType<T>())
1844 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1846 metadata._doc_string = doc_string;
1849template <
typename T>
1853 const std::string & )
1855 mooseError(
"You cannot call addRequiredParam and supply a default value for this type, please "
1856 "use addParam instead");
1859template <
typename T,
typename S>
1864 checkConsistentType<T>(name);
1866 T & l_value = InputParameters::set<T>(name);
1867 auto & metadata =
_params[name];
1868 if constexpr (isFunctorNameType<T>())
1869 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1871 metadata._doc_string = doc_string;
1879 metadata._set_by_add_param =
true;
1882template <
typename T>
1887 checkConsistentType<T>(name);
1889 InputParameters::insert<T>(name);
1890 if constexpr (isFunctorNameType<T>())
1891 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1893 _params[name]._doc_string = doc_string;
1896template <
typename T,
typename S>
1903template <
typename T>
1906 const std::string &
syntax,
1907 const bool required,
1908 const bool value_required)
1911 "This type is not a supported command line parameter type. See "
1912 "CommandLine::populateCommandLineParams to add it as a supported type.");
1918 std::vector<std::string> syntax_split;
1923 mooseAssert(cl_data->syntax.size(),
"Empty token");
1927 for (
const auto & val : syntax_split)
1928 if (val.rfind(
"-", 0) == 0)
1930 if (!std::regex_search(val, std::regex(
"^\\-+[a-zA-Z]")))
1933 "' for the command line parameter '",
1935 "' is invalid. It must begin with an alphabetical character.");
1937 cl_data->switches.push_back(val);
1941 cl_data->required = required;
1942 cl_data->global =
false;
1945 if constexpr (std::is_same_v<T, bool>)
1947 (void)value_required;
1951 else if constexpr (std::is_same_v<T, MooseEnum>)
1953 (void)value_required;
1957 else if (value_required)
1964template <
typename T>
1967 const std::string & parsed_function,
1968 const std::string & doc_string)
1970 addRequiredParam<T>(name, doc_string);
1971 _params[name]._range_function = parsed_function;
1974template <
typename T>
1978 const std::string & parsed_function,
1979 const std::string & doc_string)
1981 addParam<T>(name, value, doc_string);
1982 _params[name]._range_function = parsed_function;
1985template <
typename T>
1988 const std::string & parsed_function,
1989 const std::string & doc_string)
1991 addParam<T>(name, doc_string);
1992 _params[name]._range_function = parsed_function;
1995template <
typename T>
1998 const std::string & custom_type,
1999 const std::string & doc_string)
2001 addRequiredParam<T>(name, doc_string);
2002 _params[name]._custom_type = custom_type;
2005template <
typename T>
2009 const std::string & custom_type,
2010 const std::string & doc_string)
2012 addParam<T>(name, value, doc_string);
2013 _params[name]._custom_type = custom_type;
2016template <
typename T>
2019 const std::string & custom_type,
2020 const std::string & doc_string)
2022 addParam<T>(name, doc_string);
2023 _params[name]._custom_type = custom_type;
2026template <
typename T>
2029 const std::string & custom_type,
2030 const std::string & doc_string,
2031 const std::string & deprecation_message)
2034 addParam<T>(name, doc_string);
2035 auto & metadata =
_params[name];
2036 metadata._custom_type = custom_type;
2038 metadata._deprecation_message = deprecation_message;
2042template <
typename T>
2047 checkConsistentType<T>(name);
2049 InputParameters::insert<T>(name);
2050 _params[name]._is_private =
true;
2053template <
typename T>
2058 checkConsistentType<T>(name);
2060 InputParameters::set<T>(name) = value;
2061 auto & metadata =
_params[name];
2062 metadata._is_private =
true;
2063 metadata._set_by_add_param =
true;
2066template <
typename T>
2069 const std::string &
syntax,
2070 const std::string & doc_string)
2072 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool");
2074 addRequiredParam<T>(name, doc_string);
2075 addCommandLineParamHelper<T>(name, syntax,
true,
true);
2078template <
typename T>
2081 const std::string &
syntax,
2082 const std::string & doc_string)
2084 static_assert(!std::is_same_v<T, MooseEnum>,
2085 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2086 "MooseEnum requires initialization");
2088 auto constexpr is_bool = std::is_same_v<T, bool>;
2089 if constexpr (is_bool)
2090 addParam<T>(name,
false, doc_string);
2092 addParam<T>(name, doc_string);
2094 addCommandLineParamHelper<T>(
2095 name, syntax,
false, !is_bool);
2098template <
typename T>
2101 const std::string &
syntax,
2103 const std::string & doc_string)
2105 if constexpr (std::is_same_v<T, bool>)
2106 mooseAssert(!value,
"Default for bool must be false");
2108 addParam<T>(name, value, doc_string);
2109 addCommandLineParamHelper<T>(name, syntax,
false,
true);
2112template <
typename T>
2115 const std::string &
syntax,
2117 const std::string & doc_string)
2119 mooseAssert(name ==
"citations" || name ==
"csg_only" || name ==
"mesh_only" ||
2120 name ==
"recover" || name ==
"run",
2121 "Not supported for new parameters");
2122 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool (does not take a value)");
2123 addParam<T>(name, value, doc_string);
2124 addCommandLineParamHelper<T>(name, syntax,
false,
false);
2127template <
typename T>
2140 if (!this->Parameters::have_parameter<T>(name))
2145 ")\nbut the parameter already exists as type (",
2150template <
typename T>
2155 if (!this->have_parameter<T>(name))
2156 mooseError(
"Unable to suppress nonexistent parameter: ", name);
2158 auto & metadata =
_params[name];
2159 metadata._required =
false;
2160 metadata._is_private =
true;
2161 metadata._controllable =
false;
2164template <
typename T>
2169 suppressParameter<T>(name);
2173template <
typename T>
2179 if (!this->have_parameter<T>(name))
2180 mooseError(
"Unable to require nonexistent parameter: ", name);
2182 _params[name]._required =
true;
2185template <
typename T>
2191 if (!this->have_parameter<T>(name))
2192 mooseError(
"Unable to un-require nonexistent parameter: ", name);
2194 _params[name]._required =
false;
2197template <
typename T>
2201 const std::string & doc_string,
2202 const std::string & deprecation_message)
2206 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2207 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2208 addParam<T>(name, value, doc_string);
2210 _params[name]._deprecation_message = deprecation_message;
2214template <
typename T>
2217 const std::string & doc_string,
2218 const std::string & deprecation_message)
2222 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2223 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2224 addParam<T>(name, doc_string);
2226 _params[name]._deprecation_message = deprecation_message;
2232void InputParameters::addRequiredParam<MooseEnum>(
const std::string & name,
2234 const std::string & doc_string);
2237void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string & name,
2239 const std::string & doc_string);
2242void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2243 const std::string & name,
2244 const std::vector<MooseEnum> & moose_enums,
2245 const std::string & doc_string);
2248void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2249 const std::string & name,
2250 const std::vector<MultiMooseEnum> & moose_enums,
2251 const std::string & doc_string);
2254void InputParameters::addParam<MooseEnum>(
const std::string & ,
2255 const std::string & );
2258void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2259 const std::string & );
2262void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2263 const std::string & );
2266void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2267 const std::string & );
2271InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2272 const std::string & );
2275void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2278void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2281void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2282 const std::string & ,
2283 const std::string & );
2287InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2288 const std::string & ,
2289 const std::string & );
2292void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2293 const std::string & ,
2294 const std::string & ,
2295 const std::string & );
2299void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & name,
2300 PostprocessorName & l_value,
2301 const Real & r_value);
2304void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & name,
2305 PostprocessorName & l_value,
2306 const int & r_value);
2309void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2310 FunctionName & l_value,
2311 const Real & r_value);
2314void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2315 FunctionName & l_value,
2316 const int & r_value);
2319void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2320 MaterialPropertyName & l_value,
2321 const Real & r_value);
2324void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2325 MaterialPropertyName & l_value,
2326 const int & r_value);
2329void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2330 MooseFunctorName & l_value,
2331 const Real & r_value);
2334void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2335 MooseFunctorName & l_value,
2336 const int & r_value);
2338template <
typename T>
2342 return have_parameter<T>(name) &&
isParamValid(name) ? &getParamHelper<T>(name, *
this) :
nullptr;
2345template <
typename T>
2352 pars.
mooseError(
"The parameter \"", name,
"\" is being retrieved before being set.");
2354 return pars.
get<T>(name);
2361const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string & name,
2366InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name,
2369template <
typename R1,
typename R2,
typename V1,
typename V2>
2370std::vector<std::pair<R1, R2>>
2376 const auto & v1 = get<V1>(param1);
2377 const auto & v2 = get<V2>(param2);
2380 if (controllable.count(param1) || controllable.count(param2))
2384 param2 +
" are controllable parameters and cannot be retireved using "
2385 "the MooseObject::getParam/InputParameters::get methods for pairs");
2387 if (v1.size() != v2.size())
2389 "Vector parameters ",
2396 ") are of different lengths \n");
2398 std::vector<std::pair<R1, R2>> parameter_pairs;
2399 auto i1 = v1.begin();
2400 auto i2 = v2.begin();
2401 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2402 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2403 return parameter_pairs;
2408template <
typename T>
2415 mooseError(
"Parameter \"", name,
"\" is not valid.");
2416 return have_parameter<T>(name);
2419template <
typename T>
2423 const std::string name_str(name_in);
2426 return Parameters::get<T>(name);
2429template <
typename T>
2433 const std::string name_str(name_in);
2436 return Parameters::have_parameter<T>(name);
2439template <
typename T>
2442 const std::string & name_in,
2443 const std::string & new_name,
2444 const std::string & new_description)
2447 const auto p_name = new_name.empty() ? name_in : new_name;
2451 "' parameter could not be transferred because it does not exist with type '",
2452 MooseUtils::prettyCppType<T>(),
2453 "' in the source parameters");
2454 if (name != name_in)
2455 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " + name +
2456 " in the source parameters. The new name should likely be used for the parameter "
2457 "transfer instead.");
2458 const std::string description =
2459 new_description.empty() ? source_params.
getDescription(name) : new_description;
2467 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2468 addRequiredParam<T>(p_name, source_params.
get<T>(name), description);
2470 addRequiredRangeCheckedParam<T>(
2473 addRequiredParam<T>(p_name, description);
2486 std::vector<Real> coupled_values;
2495 addRangeCheckedParam<T>(p_name,
2496 source_params.
get<T>(name),
2502 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2503 addParam<T>(p_name, source_params.
get<T>(name), description);
2507 addParam<T>(p_name, source_params.
get<T>(name), description);
2509 addParam<T>(p_name, description);
2515 _params[p_name]._is_private =
true;
2517 _params[p_name]._controllable =
true;
2520template <
typename... Args>
2524 std::ostringstream oss;
2529template <
typename... Args>
2533 std::ostringstream oss;
2538template <
typename... Args>
2542 std::ostringstream oss;
2552template <
typename T>
2559#ifdef MOOSE_MFEM_ENABLED
2561template <
typename T>
2565 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2566 std::is_same_v<T, MFEMVectorCoefficientName>;
2569template <
typename T,
typename A>
2578template <
typename T>
2582 return std::is_same_v<T, MooseFunctorName>
2583#ifdef MOOSE_MFEM_ENABLED
2584 || std::is_same_v<T, MFEMScalarCoefficientName>
2589template <
typename T,
typename A>
2596template <
typename T>
2600#ifdef MOOSE_MFEM_ENABLED
2601 return std::is_same_v<T, MFEMVectorCoefficientName>;
2607template <
typename T,
typename A>
2614template <
typename T>
2623template <
typename T>
2630template <
typename T>
2634 auto numeric_value_type = []()
2637 Moose::internal::getNullptrExample<T>()))
2640 Moose::internal::getNullptrExample<T>()))
2641 return "numeric vector value (enclosed in curly braces)";
2644 mooseAssert(
false,
"We control instantiations of this method");
2649 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2651#ifdef MOOSE_MFEM_ENABLED
2657 " material property, a function, a postprocessor or a " + numeric_value_type() +
".";
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
std::array< Real, 2 > values
Specialized factory for generic Action System objects.
Storage for action instances.
This class wraps provides and tracks access to command line parameters.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Generic factory class for build all sorts of objects.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Every object that can be built by the factory should be derived from this class.
Parses MOOSE input using HIT/WASP.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Class for parsing input files.
Class that hold the whole problem being solved.
map_type::const_iterator const_iterator
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 ...
std::string trim(const std::string &str, const std::string &white_space=" \t\n\v\f\r")
Standard scripting language trim function.
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
constexpr bool isVectorFunctorNameTypeHelper(T *)
constexpr bool isMFEMFunctorNameTypeHelper(T *)
constexpr bool isScalarFunctorNameTypeHelper(T *)
constexpr bool isFunctorNameTypeHelper(T *ex)
constexpr T * getNullptrExample()
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
RelationshipManagerType
Main types of Relationship Managers.
std::string demangle(const char *name)
void add_command_line_name(const std::string &name)
IntRange< T > make_range(T beg, T end)
void mooseStreamAll(std::ostringstream &ss)
All of the following are not meant to be called directly - they are called by the normal macros (moos...