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;
1277 const std::string & new_name,
1278 const std::string & new_docstring);
1287 const std::string & new_name,
1288 const std::string & new_docstring);
1291 const std::string & new_name,
1292 const std::string & removal_date);
1295 const std::string & new_name,
1296 const std::string & removal_date);
1304 const std::string &
checkForRename(
const std::string & name)
const;
1312 template <
typename T>
1313 const T &
get(std::string_view name)
const;
1323 template <
typename T>
1333 template <
typename T>
1335 const std::string & name,
1336 const std::string & new_name =
"",
1337 const std::string & new_description =
"");
1351 std::vector<std::string>
paramAliases(
const std::string & param_name)
const;
1386 const hit::Node & node,
1398 template <
typename T>
1404 template <
typename T>
1413 const std::string & new_name,
1414 const std::string & docstring,
1415 const std::string & removal_date);
1418 const std::string & new_name,
1419 const std::string & docstring,
1420 const std::string & removal_date);
1428 std::pair<std::string, const hit::Node *>
paramMessageContext(
const std::string & param)
const;
1485 if (
_params.count(param) == 0)
1486 mooseError(
"param '", param,
"' not present in InputParams");
1492 if (
_params.count(param) == 0)
1493 mooseError(
"param '", param,
"' not present in InputParams");
1517 template <
typename T,
typename S>
1518 void setParamHelper(
const std::string & name, T & l_value,
const S & r_value);
1528 template <
typename T>
1530 const std::string & syntax,
1531 const bool required,
1532 const bool value_required);
1539 const bool with_prefix =
true,
1540 const hit::Node * node =
nullptr,
1541 const bool show_trace =
true)
const;
1562 std::vector<std::tuple<std::string,
1608template <
typename T>
1615template <
typename T>
1622 checkConsistentType<T>(name);
1624 T & result = this->Parameters::set<T>(name);
1627 _params[name]._set_by_add_param =
true;
1634template <
typename T,
typename... Ts>
1638 Ts... extra_input_parameters)
1640 this->set<T>(name) = value;
1644template <
typename T,
typename UP_T>
1645std::optional<std::pair<bool, std::string>>
1647 const std::string & short_name,
1648 const InputParameters::Parameter<std::vector<T>> & param,
1649 const bool include_param_path)
1654 const auto & range_function =
_params[short_name]._range_function;
1655 if (range_function.empty())
1670 std::vector<std::string>
vars;
1671 if (fp.ParseAndDeduceVariables(range_function,
vars) != -1)
1673 "Error parsing expression '" + range_function +
"' for parameter " + short_name +
""}};
1676 std::vector<UP_T> parbuf(
vars.size());
1679 const std::vector<T> & value = param.get();
1682 bool need_to_iterate =
false;
1687 for (
unsigned int j = 0; j <
vars.size(); j++)
1689 if (
vars[j] == short_name)
1691 if (value.size() == 0)
1693 std::ostringstream oss;
1694 oss <<
"Range checking empty vector";
1695 if (include_param_path)
1696 oss <<
" parameter " << full_name;
1697 oss <<
"; expression = '" << range_function <<
"'";
1698 return {{
true, oss.str()}};
1701 parbuf[j] = value[i];
1702 need_to_iterate =
true;
1704 else if (
vars[j] == short_name +
"_size")
1705 parbuf[j] = value.size();
1708 if (
vars[j].substr(0, short_name.size() + 1) != short_name +
"_")
1709 return {{
false,
"Error parsing expression '" + range_function +
"'"}};
1710 std::istringstream iss(
vars[j]);
1711 iss.seekg(short_name.size() + 1);
1714 if (iss >> index && iss.eof())
1716 if (index >= value.size())
1718 std::ostringstream oss;
1719 oss <<
"Error parsing expression '" + range_function +
"'";
1720 if (include_param_path)
1721 oss <<
" for parameter " << full_name;
1722 oss <<
"; out of range variable '" +
vars[j] <<
"'";
1723 return {{
true, oss.str()}};
1725 parbuf[j] = value[index];
1729 "Error parsing expression '" + range_function +
"'; invalid variable '" +
1736 auto tmp_eps = fp.epsilon();
1738 UP_T result = fp.Eval(&parbuf[0]);
1739 fp.setEpsilon(tmp_eps);
1743 return {{
false,
"Error evaluating expression '" + range_function +
"'"}};
1747 std::ostringstream oss;
1748 oss <<
"Range check failed";
1749 if (include_param_path)
1750 oss <<
" for parameter " << full_name;
1751 oss <<
"; expression = '" << range_function <<
"'";
1752 if (need_to_iterate)
1753 oss <<
", component " << i;
1754 return {{
true, oss.str()}};
1757 }
while (need_to_iterate && ++i < value.size());
1762template <
typename T,
typename UP_T>
1763std::optional<std::pair<bool, std::string>>
1765 const std::string & short_name,
1766 const InputParameters::Parameter<T> & param,
1767 const bool include_param_path)
1772 const auto & range_function =
_params[short_name]._range_function;
1773 if (range_function.empty())
1778 if (fp.Parse(range_function, short_name) != -1)
1780 "Error parsing expression '" + range_function +
"'" +
" for parameter " + short_name}};
1784 auto tmp_eps = fp.epsilon();
1787 std::vector<UP_T> value(1, param.get());
1788 UP_T result = fp.Eval(&value[0]);
1789 fp.setEpsilon(tmp_eps);
1793 "Error evaluating expression '" + range_function +
"' for parameter " + short_name +
1794 "; perhaps you used the wrong variable name?"}};
1798 std::ostringstream oss;
1799 oss <<
"Range check failed";
1800 if (include_param_path)
1801 oss <<
" for parameter " << full_name;
1802 oss <<
"; expression = '" << range_function <<
"', value = " << value[0];
1803 return {{
true, oss.str()}};
1809template <
typename T>
1812 const std::string & error_string)
const
1816 T param = this->get<T>(name);
1821 mooseError(
"Parameter ", name,
" is NULL.\n", error_string);
1825template <
typename T>
1830 checkConsistentType<T>(name);
1832 InputParameters::insert<T>(name);
1833 auto & metadata =
_params[name];
1834 metadata._required =
true;
1835 if constexpr (isFunctorNameType<T>())
1836 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1838 metadata._doc_string = doc_string;
1841template <
typename T>
1845 const std::string & )
1847 mooseError(
"You cannot call addRequiredParam and supply a default value for this type, please "
1848 "use addParam instead");
1851template <
typename T,
typename S>
1856 checkConsistentType<T>(name);
1858 T & l_value = InputParameters::set<T>(name);
1859 auto & metadata =
_params[name];
1860 if constexpr (isFunctorNameType<T>())
1861 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1863 metadata._doc_string = doc_string;
1871 metadata._set_by_add_param =
true;
1874template <
typename T>
1879 checkConsistentType<T>(name);
1881 InputParameters::insert<T>(name);
1882 if constexpr (isFunctorNameType<T>())
1883 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1885 _params[name]._doc_string = doc_string;
1888template <
typename T,
typename S>
1895template <
typename T>
1898 const std::string &
syntax,
1899 const bool required,
1900 const bool value_required)
1903 "This type is not a supported command line parameter type. See "
1904 "CommandLine::populateCommandLineParams to add it as a supported type.");
1910 std::vector<std::string> syntax_split;
1915 mooseAssert(cl_data->syntax.size(),
"Empty token");
1919 for (
const auto & val : syntax_split)
1920 if (val.rfind(
"-", 0) == 0)
1922 if (!std::regex_search(val, std::regex(
"^\\-+[a-zA-Z]")))
1925 "' for the command line parameter '",
1927 "' is invalid. It must begin with an alphabetical character.");
1929 cl_data->switches.push_back(val);
1933 cl_data->required = required;
1934 cl_data->global =
false;
1937 if constexpr (std::is_same_v<T, bool>)
1939 (void)value_required;
1943 else if constexpr (std::is_same_v<T, MooseEnum>)
1945 (void)value_required;
1949 else if (value_required)
1956template <
typename T>
1959 const std::string & parsed_function,
1960 const std::string & doc_string)
1962 addRequiredParam<T>(name, doc_string);
1963 _params[name]._range_function = parsed_function;
1966template <
typename T>
1970 const std::string & parsed_function,
1971 const std::string & doc_string)
1973 addParam<T>(name, value, doc_string);
1974 _params[name]._range_function = parsed_function;
1977template <
typename T>
1980 const std::string & parsed_function,
1981 const std::string & doc_string)
1983 addParam<T>(name, doc_string);
1984 _params[name]._range_function = parsed_function;
1987template <
typename T>
1990 const std::string & custom_type,
1991 const std::string & doc_string)
1993 addRequiredParam<T>(name, doc_string);
1994 _params[name]._custom_type = custom_type;
1997template <
typename T>
2001 const std::string & custom_type,
2002 const std::string & doc_string)
2004 addParam<T>(name, value, doc_string);
2005 _params[name]._custom_type = custom_type;
2008template <
typename T>
2011 const std::string & custom_type,
2012 const std::string & doc_string)
2014 addParam<T>(name, doc_string);
2015 _params[name]._custom_type = custom_type;
2018template <
typename T>
2021 const std::string & custom_type,
2022 const std::string & doc_string,
2023 const std::string & deprecation_message)
2026 addParam<T>(name, doc_string);
2027 auto & metadata =
_params[name];
2028 metadata._custom_type = custom_type;
2030 metadata._deprecation_message = deprecation_message;
2034template <
typename T>
2039 checkConsistentType<T>(name);
2041 InputParameters::insert<T>(name);
2042 _params[name]._is_private =
true;
2045template <
typename T>
2050 checkConsistentType<T>(name);
2052 InputParameters::set<T>(name) = value;
2053 auto & metadata =
_params[name];
2054 metadata._is_private =
true;
2055 metadata._set_by_add_param =
true;
2058template <
typename T>
2061 const std::string &
syntax,
2062 const std::string & doc_string)
2064 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool");
2066 addRequiredParam<T>(name, doc_string);
2067 addCommandLineParamHelper<T>(name, syntax,
true,
true);
2070template <
typename T>
2073 const std::string &
syntax,
2074 const std::string & doc_string)
2076 static_assert(!std::is_same_v<T, MooseEnum>,
2077 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2078 "MooseEnum requires initialization");
2080 auto constexpr is_bool = std::is_same_v<T, bool>;
2081 if constexpr (is_bool)
2082 addParam<T>(name,
false, doc_string);
2084 addParam<T>(name, doc_string);
2086 addCommandLineParamHelper<T>(
2087 name, syntax,
false, !is_bool);
2090template <
typename T>
2093 const std::string &
syntax,
2095 const std::string & doc_string)
2097 if constexpr (std::is_same_v<T, bool>)
2098 mooseAssert(!value,
"Default for bool must be false");
2100 addParam<T>(name, value, doc_string);
2101 addCommandLineParamHelper<T>(name, syntax,
false,
true);
2104template <
typename T>
2107 const std::string &
syntax,
2109 const std::string & doc_string)
2111 mooseAssert(name ==
"citations" || name ==
"csg_only" || name ==
"mesh_only" ||
2112 name ==
"recover" || name ==
"run",
2113 "Not supported for new parameters");
2114 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool (does not take a value)");
2115 addParam<T>(name, value, doc_string);
2116 addCommandLineParamHelper<T>(name, syntax,
false,
false);
2119template <
typename T>
2132 if (!this->Parameters::have_parameter<T>(name))
2137 ")\nbut the parameter already exists as type (",
2142template <
typename T>
2147 if (!this->have_parameter<T>(name))
2148 mooseError(
"Unable to suppress nonexistent parameter: ", name);
2150 auto & metadata =
_params[name];
2151 metadata._required =
false;
2152 metadata._is_private =
true;
2153 metadata._controllable =
false;
2156template <
typename T>
2161 suppressParameter<T>(name);
2165template <
typename T>
2171 if (!this->have_parameter<T>(name))
2172 mooseError(
"Unable to require nonexistent parameter: ", name);
2174 _params[name]._required =
true;
2177template <
typename T>
2183 if (!this->have_parameter<T>(name))
2184 mooseError(
"Unable to un-require nonexistent parameter: ", name);
2186 _params[name]._required =
false;
2189template <
typename T>
2193 const std::string & doc_string,
2194 const std::string & deprecation_message)
2198 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2199 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2200 addParam<T>(name, value, doc_string);
2202 _params[name]._deprecation_message = deprecation_message;
2206template <
typename T>
2209 const std::string & doc_string,
2210 const std::string & deprecation_message)
2214 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2215 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2216 addParam<T>(name, doc_string);
2218 _params[name]._deprecation_message = deprecation_message;
2224void InputParameters::addRequiredParam<MooseEnum>(
const std::string & name,
2226 const std::string & doc_string);
2229void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string & name,
2231 const std::string & doc_string);
2234void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2235 const std::string & name,
2236 const std::vector<MooseEnum> & moose_enums,
2237 const std::string & doc_string);
2240void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2241 const std::string & name,
2242 const std::vector<MultiMooseEnum> & moose_enums,
2243 const std::string & doc_string);
2246void InputParameters::addParam<MooseEnum>(
const std::string & ,
2247 const std::string & );
2250void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2251 const std::string & );
2254void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2255 const std::string & );
2258void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2259 const std::string & );
2263InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2264 const std::string & );
2267void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2270void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2273void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2274 const std::string & ,
2275 const std::string & );
2279InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2280 const std::string & ,
2281 const std::string & );
2284void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2285 const std::string & ,
2286 const std::string & ,
2287 const std::string & );
2291void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & name,
2292 PostprocessorName & l_value,
2293 const Real & r_value);
2296void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & name,
2297 PostprocessorName & l_value,
2298 const int & r_value);
2301void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2302 FunctionName & l_value,
2303 const Real & r_value);
2306void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2307 FunctionName & l_value,
2308 const int & r_value);
2311void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2312 MaterialPropertyName & l_value,
2313 const Real & r_value);
2316void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2317 MaterialPropertyName & l_value,
2318 const int & r_value);
2321void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2322 MooseFunctorName & l_value,
2323 const Real & r_value);
2326void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2327 MooseFunctorName & l_value,
2328 const int & r_value);
2330template <
typename T>
2334 return have_parameter<T>(name) &&
isParamValid(name) ? &getParamHelper<T>(name, *
this) :
nullptr;
2337template <
typename T>
2344 pars.
mooseError(
"The parameter \"", name,
"\" is being retrieved before being set.");
2346 return pars.
get<T>(name);
2353const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string & name,
2358InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name,
2361template <
typename R1,
typename R2,
typename V1,
typename V2>
2362std::vector<std::pair<R1, R2>>
2368 const auto & v1 = get<V1>(param1);
2369 const auto & v2 = get<V2>(param2);
2372 if (controllable.count(param1) || controllable.count(param2))
2376 param2 +
" are controllable parameters and cannot be retireved using "
2377 "the MooseObject::getParam/InputParameters::get methods for pairs");
2379 if (v1.size() != v2.size())
2381 "Vector parameters ",
2388 ") are of different lengths \n");
2390 std::vector<std::pair<R1, R2>> parameter_pairs;
2391 auto i1 = v1.begin();
2392 auto i2 = v2.begin();
2393 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2394 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2395 return parameter_pairs;
2400template <
typename T>
2407 mooseError(
"Parameter \"", name,
"\" is not valid.");
2408 return have_parameter<T>(name);
2411template <
typename T>
2415 const std::string name_str(name_in);
2418 return Parameters::get<T>(name);
2421template <
typename T>
2425 const std::string name_str(name_in);
2428 return Parameters::have_parameter<T>(name);
2431template <
typename T>
2434 const std::string & name_in,
2435 const std::string & new_name,
2436 const std::string & new_description)
2439 const auto p_name = new_name.empty() ? name_in : new_name;
2443 "' parameter could not be transferred because it does not exist with type '",
2444 MooseUtils::prettyCppType<T>(),
2445 "' in the source parameters");
2446 if (name != name_in)
2447 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " + name +
2448 " in the source parameters. The new name should likely be used for the parameter "
2449 "transfer instead.");
2450 const std::string description =
2451 new_description.empty() ? source_params.
getDescription(name) : new_description;
2459 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2460 addRequiredParam<T>(p_name, source_params.
get<T>(name), description);
2462 addRequiredRangeCheckedParam<T>(
2465 addRequiredParam<T>(p_name, description);
2478 std::vector<Real> coupled_values;
2487 addRangeCheckedParam<T>(p_name,
2488 source_params.
get<T>(name),
2494 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2495 addParam<T>(p_name, source_params.
get<T>(name), description);
2499 addParam<T>(p_name, source_params.
get<T>(name), description);
2501 addParam<T>(p_name, description);
2507 _params[p_name]._is_private =
true;
2509 _params[p_name]._controllable =
true;
2512template <
typename... Args>
2516 std::ostringstream oss;
2521template <
typename... Args>
2525 std::ostringstream oss;
2530template <
typename... Args>
2534 std::ostringstream oss;
2544template <
typename T>
2551#ifdef MOOSE_MFEM_ENABLED
2553template <
typename T>
2557 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2558 std::is_same_v<T, MFEMVectorCoefficientName>;
2561template <
typename T,
typename A>
2570template <
typename T>
2574 return std::is_same_v<T, MooseFunctorName>
2575#ifdef MOOSE_MFEM_ENABLED
2576 || std::is_same_v<T, MFEMScalarCoefficientName>
2581template <
typename T,
typename A>
2588template <
typename T>
2592#ifdef MOOSE_MFEM_ENABLED
2593 return std::is_same_v<T, MFEMVectorCoefficientName>;
2599template <
typename T,
typename A>
2606template <
typename T>
2615template <
typename T>
2622template <
typename T>
2626 auto numeric_value_type = []()
2629 Moose::internal::getNullptrExample<T>()))
2632 Moose::internal::getNullptrExample<T>()))
2633 return "numeric vector value (enclosed in curly braces)";
2636 mooseAssert(
false,
"We control instantiations of this method");
2641 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2643#ifdef MOOSE_MFEM_ENABLED
2649 " 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...