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);
857 std::optional<std::pair<bool, std::string>>
parameterRangeCheck(
const Parameters::Value & value,
858 const std::string & long_name,
859 const std::string & short_name,
860 const bool include_param_path);
869 void finalize(
const std::string & parsing_syntax);
884 std::filesystem::path
885 getFileBase(
const std::optional<std::string> & param_name = std::optional<std::string>())
const;
920 bool hasDefault(
const std::string & param_name)
const;
936 mooseDeprecated(
"InputParameters::hasCoupledValue() is deprecated. Use "
937 "InputParameters::hasCoupledVar() instead.");
947 void setCoupledVar(
const std::string & coupling_name,
const std::string & value);
955 void setCoupledVar(
const std::string & coupling_name,
const std::vector<VariableName> &
values);
962 const std::vector<VariableName> &
getCoupledVar(
const std::string & coupling_name)
const;
993 void defaultCoupledValue(
const std::string & coupling_name, Real value,
unsigned int i = 0);
1019 const std::vector<std::string> & exclude = {},
1020 const bool allow_private =
false);
1028 const std::vector<std::string> & exclude = {},
1029 const bool allow_private =
false);
1049 const std::vector<std::string> & include,
1050 bool allow_private =
false);
1064 const std::string & common_name,
1065 bool allow_private =
false);
1107 template <
typename T>
1108 const T *
queryParam(
const std::string & name)
const;
1116 template <
typename T>
1120 using Parameters::get;
1123 template <
typename R1,
1125 typename V1 =
typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1128 typename V2 =
typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1131 std::vector<std::pair<R1, R2>>
get(
const std::string & param1,
const std::string & param2)
const;
1152 void setReservedValues(
const std::string & name,
const std::set<std::string> & reserved);
1158 std::set<std::string>
reservedValues(
const std::string & name)
const;
1175 const hit::Node *
getHitNode(
const std::string & param)
const;
1181 void setHitNode(
const std::string & param,
const hit::Node & node,
const SetParamHitNodeKey);
1207 template <
typename... Args>
1208 std::string
paramMessage(
const std::string & param, Args... args)
const;
1213 template <
typename... Args>
1214 [[noreturn]]
void mooseError(Args &&... args)
const;
1220 template <
typename... Args>
1221 [[noreturn]]
void paramError(
const std::string & param, Args... args)
const;
1227 std::string
rawParamVal(
const std::string & param)
const;
1233 template <
typename T>
1245 template <
typename T>
1246 bool isType(
const std::string & name)
const;
1254 std::string
varName(
const std::string & var_param_name,
1255 const std::string & moose_object_with_var_param_name)
const;
1265 const std::string & new_name,
1266 const std::string & new_docstring);
1275 const std::string & new_name,
1276 const std::string & new_docstring);
1279 const std::string & new_name,
1280 const std::string & removal_date);
1283 const std::string & new_name,
1284 const std::string & removal_date);
1292 const std::string &
checkForRename(
const std::string & name)
const;
1300 template <
typename T>
1301 const T &
get(std::string_view name)
const;
1311 template <
typename T>
1321 template <
typename T>
1323 const std::string & name,
1324 const std::string & new_name =
"",
1325 const std::string & new_description =
"");
1339 std::vector<std::string>
paramAliases(
const std::string & param_name)
const;
1374 const hit::Node & node,
1386 template <
typename T>
1392 template <
typename T>
1401 const std::string & new_name,
1402 const std::string & docstring,
1403 const std::string & removal_date);
1406 const std::string & new_name,
1407 const std::string & docstring,
1408 const std::string & removal_date);
1416 std::pair<std::string, const hit::Node *>
paramMessageContext(
const std::string & param)
const;
1473 if (
_params.count(param) == 0)
1474 mooseError(
"param '", param,
"' not present in InputParams");
1480 if (
_params.count(param) == 0)
1481 mooseError(
"param '", param,
"' not present in InputParams");
1505 template <
typename T,
typename S>
1506 void setParamHelper(
const std::string & name, T & l_value,
const S & r_value);
1516 template <
typename T>
1518 const std::string & syntax,
1519 const bool required,
1520 const bool value_required);
1527 const bool with_prefix =
true,
1528 const hit::Node * node =
nullptr,
1529 const bool show_trace =
true)
const;
1550 std::vector<std::tuple<std::string,
1596template <
typename T>
1603template <
typename T>
1610 checkConsistentType<T>(name);
1612 T & result = this->Parameters::set<T>(name);
1615 _params[name]._set_by_add_param =
true;
1622template <
typename T,
typename... Ts>
1626 Ts... extra_input_parameters)
1628 this->set<T>(name) = value;
1632template <
typename T,
typename UP_T>
1633std::optional<std::pair<bool, std::string>>
1635 const std::string & short_name,
1636 const InputParameters::Parameter<std::vector<T>> & param,
1637 const bool include_param_path)
1642 const auto & range_function =
_params[short_name]._range_function;
1643 if (range_function.empty())
1658 std::vector<std::string>
vars;
1659 if (fp.ParseAndDeduceVariables(range_function,
vars) != -1)
1661 "Error parsing expression '" + range_function +
"' for parameter " + short_name +
""}};
1664 std::vector<UP_T> parbuf(
vars.size());
1667 const std::vector<T> & value = param.get();
1670 bool need_to_iterate =
false;
1675 for (
unsigned int j = 0; j <
vars.size(); j++)
1677 if (
vars[j] == short_name)
1679 if (value.size() == 0)
1681 std::ostringstream oss;
1682 oss <<
"Range checking empty vector";
1683 if (include_param_path)
1684 oss <<
" parameter " << full_name;
1685 oss <<
"; expression = '" << range_function <<
"'";
1686 return {{
true, oss.str()}};
1689 parbuf[j] = value[i];
1690 need_to_iterate =
true;
1692 else if (
vars[j] == short_name +
"_size")
1693 parbuf[j] = value.size();
1696 if (
vars[j].substr(0, short_name.size() + 1) != short_name +
"_")
1697 return {{
false,
"Error parsing expression '" + range_function +
"'"}};
1698 std::istringstream iss(
vars[j]);
1699 iss.seekg(short_name.size() + 1);
1702 if (iss >> index && iss.eof())
1704 if (index >= value.size())
1706 std::ostringstream oss;
1707 oss <<
"Error parsing expression '" + range_function +
"'";
1708 if (include_param_path)
1709 oss <<
" for parameter " << full_name;
1710 oss <<
"; out of range variable '" +
vars[j] <<
"'";
1711 return {{
true, oss.str()}};
1713 parbuf[j] = value[index];
1717 "Error parsing expression '" + range_function +
"'; invalid variable '" +
1724 auto tmp_eps = fp.epsilon();
1726 UP_T result = fp.Eval(&parbuf[0]);
1727 fp.setEpsilon(tmp_eps);
1731 return {{
false,
"Error evaluating expression '" + range_function +
"'"}};
1735 std::ostringstream oss;
1736 oss <<
"Range check failed";
1737 if (include_param_path)
1738 oss <<
" for parameter " << full_name;
1739 oss <<
"; expression = '" << range_function <<
"'";
1740 if (need_to_iterate)
1741 oss <<
", component " << i;
1742 return {{
true, oss.str()}};
1745 }
while (need_to_iterate && ++i < value.size());
1750template <
typename T,
typename UP_T>
1751std::optional<std::pair<bool, std::string>>
1753 const std::string & short_name,
1754 const InputParameters::Parameter<T> & param,
1755 const bool include_param_path)
1760 const auto & range_function =
_params[short_name]._range_function;
1761 if (range_function.empty())
1766 if (fp.Parse(range_function, short_name) != -1)
1768 "Error parsing expression '" + range_function +
"'" +
" for parameter " + short_name}};
1772 auto tmp_eps = fp.epsilon();
1775 std::vector<UP_T> value(1, param.get());
1776 UP_T result = fp.Eval(&value[0]);
1777 fp.setEpsilon(tmp_eps);
1781 "Error evaluating expression '" + range_function +
"' for parameter " + short_name +
1782 "; perhaps you used the wrong variable name?"}};
1786 std::ostringstream oss;
1787 oss <<
"Range check failed";
1788 if (include_param_path)
1789 oss <<
" for parameter " << full_name;
1790 oss <<
"; expression = '" << range_function <<
"', value = " << value[0];
1791 return {{
true, oss.str()}};
1797template <
typename T>
1800 const std::string & error_string)
const
1804 T param = this->get<T>(name);
1809 mooseError(
"Parameter ", name,
" is NULL.\n", error_string);
1813template <
typename T>
1818 checkConsistentType<T>(name);
1820 InputParameters::insert<T>(name);
1821 auto & metadata =
_params[name];
1822 metadata._required =
true;
1823 if constexpr (isFunctorNameType<T>())
1824 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1826 metadata._doc_string = doc_string;
1829template <
typename T>
1833 const std::string & )
1835 mooseError(
"You cannot call addRequiredParam and supply a default value for this type, please "
1836 "use addParam instead");
1839template <
typename T,
typename S>
1844 checkConsistentType<T>(name);
1846 T & l_value = InputParameters::set<T>(name);
1847 auto & metadata =
_params[name];
1848 if constexpr (isFunctorNameType<T>())
1849 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1851 metadata._doc_string = doc_string;
1859 metadata._set_by_add_param =
true;
1862template <
typename T>
1867 checkConsistentType<T>(name);
1869 InputParameters::insert<T>(name);
1870 if constexpr (isFunctorNameType<T>())
1871 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1873 _params[name]._doc_string = doc_string;
1876template <
typename T,
typename S>
1883template <
typename T>
1886 const std::string &
syntax,
1887 const bool required,
1888 const bool value_required)
1891 "This type is not a supported command line parameter type. See "
1892 "CommandLine::populateCommandLineParams to add it as a supported type.");
1898 std::vector<std::string> syntax_split;
1903 mooseAssert(cl_data->syntax.size(),
"Empty token");
1907 for (
const auto & val : syntax_split)
1908 if (val.rfind(
"-", 0) == 0)
1910 if (!std::regex_search(val, std::regex(
"^\\-+[a-zA-Z]")))
1913 "' for the command line parameter '",
1915 "' is invalid. It must begin with an alphabetical character.");
1917 cl_data->switches.push_back(val);
1921 cl_data->required = required;
1922 cl_data->global =
false;
1925 if constexpr (std::is_same_v<T, bool>)
1927 (void)value_required;
1931 else if constexpr (std::is_same_v<T, MooseEnum>)
1933 (void)value_required;
1937 else if (value_required)
1944template <
typename T>
1947 const std::string & parsed_function,
1948 const std::string & doc_string)
1950 addRequiredParam<T>(name, doc_string);
1951 _params[name]._range_function = parsed_function;
1954template <
typename T>
1958 const std::string & parsed_function,
1959 const std::string & doc_string)
1961 addParam<T>(name, value, doc_string);
1962 _params[name]._range_function = parsed_function;
1965template <
typename T>
1968 const std::string & parsed_function,
1969 const std::string & doc_string)
1971 addParam<T>(name, doc_string);
1972 _params[name]._range_function = parsed_function;
1975template <
typename T>
1978 const std::string & custom_type,
1979 const std::string & doc_string)
1981 addRequiredParam<T>(name, doc_string);
1982 _params[name]._custom_type = custom_type;
1985template <
typename T>
1989 const std::string & custom_type,
1990 const std::string & doc_string)
1992 addParam<T>(name, value, doc_string);
1993 _params[name]._custom_type = custom_type;
1996template <
typename T>
1999 const std::string & custom_type,
2000 const std::string & doc_string)
2002 addParam<T>(name, doc_string);
2003 _params[name]._custom_type = custom_type;
2006template <
typename T>
2009 const std::string & custom_type,
2010 const std::string & doc_string,
2011 const std::string & deprecation_message)
2014 addParam<T>(name, doc_string);
2015 auto & metadata =
_params[name];
2016 metadata._custom_type = custom_type;
2018 metadata._deprecation_message = deprecation_message;
2022template <
typename T>
2027 checkConsistentType<T>(name);
2029 InputParameters::insert<T>(name);
2030 _params[name]._is_private =
true;
2033template <
typename T>
2038 checkConsistentType<T>(name);
2040 InputParameters::set<T>(name) = value;
2041 auto & metadata =
_params[name];
2042 metadata._is_private =
true;
2043 metadata._set_by_add_param =
true;
2046template <
typename T>
2049 const std::string &
syntax,
2050 const std::string & doc_string)
2052 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool");
2054 addRequiredParam<T>(name, doc_string);
2055 addCommandLineParamHelper<T>(name, syntax,
true,
true);
2058template <
typename T>
2061 const std::string &
syntax,
2062 const std::string & doc_string)
2064 static_assert(!std::is_same_v<T, MooseEnum>,
2065 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2066 "MooseEnum requires initialization");
2068 auto constexpr is_bool = std::is_same_v<T, bool>;
2069 if constexpr (is_bool)
2070 addParam<T>(name,
false, doc_string);
2072 addParam<T>(name, doc_string);
2074 addCommandLineParamHelper<T>(
2075 name, syntax,
false, !is_bool);
2078template <
typename T>
2081 const std::string &
syntax,
2083 const std::string & doc_string)
2085 if constexpr (std::is_same_v<T, bool>)
2086 mooseAssert(!value,
"Default for bool must be false");
2088 addParam<T>(name, value, doc_string);
2089 addCommandLineParamHelper<T>(name, syntax,
false,
true);
2092template <
typename T>
2095 const std::string &
syntax,
2097 const std::string & doc_string)
2099 mooseAssert(name ==
"citations" || name ==
"csg_only" || name ==
"mesh_only" ||
2100 name ==
"recover" || name ==
"run",
2101 "Not supported for new parameters");
2102 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool (does not take a value)");
2103 addParam<T>(name, value, doc_string);
2104 addCommandLineParamHelper<T>(name, syntax,
false,
false);
2107template <
typename T>
2120 if (!this->Parameters::have_parameter<T>(name))
2125 ")\nbut the parameter already exists as type (",
2130template <
typename T>
2135 if (!this->have_parameter<T>(name))
2136 mooseError(
"Unable to suppress nonexistent parameter: ", name);
2138 auto & metadata =
_params[name];
2139 metadata._required =
false;
2140 metadata._is_private =
true;
2141 metadata._controllable =
false;
2144template <
typename T>
2149 suppressParameter<T>(name);
2153template <
typename T>
2159 if (!this->have_parameter<T>(name))
2160 mooseError(
"Unable to require nonexistent parameter: ", name);
2162 _params[name]._required =
true;
2165template <
typename T>
2171 if (!this->have_parameter<T>(name))
2172 mooseError(
"Unable to un-require nonexistent parameter: ", name);
2174 _params[name]._required =
false;
2177template <
typename T>
2181 const std::string & doc_string,
2182 const std::string & deprecation_message)
2186 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2187 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2188 addParam<T>(name, value, doc_string);
2190 _params[name]._deprecation_message = deprecation_message;
2194template <
typename T>
2197 const std::string & doc_string,
2198 const std::string & deprecation_message)
2202 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2203 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2204 addParam<T>(name, doc_string);
2206 _params[name]._deprecation_message = deprecation_message;
2212void InputParameters::addRequiredParam<MooseEnum>(
const std::string & name,
2214 const std::string & doc_string);
2217void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string & name,
2219 const std::string & doc_string);
2222void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2223 const std::string & name,
2224 const std::vector<MooseEnum> & moose_enums,
2225 const std::string & doc_string);
2228void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2229 const std::string & name,
2230 const std::vector<MultiMooseEnum> & moose_enums,
2231 const std::string & doc_string);
2234void InputParameters::addParam<MooseEnum>(
const std::string & ,
2235 const std::string & );
2238void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2239 const std::string & );
2242void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2243 const std::string & );
2246void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2247 const std::string & );
2251InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2252 const std::string & );
2255void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2258void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2261void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2262 const std::string & ,
2263 const std::string & );
2267InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2268 const std::string & ,
2269 const std::string & );
2272void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2273 const std::string & ,
2274 const std::string & ,
2275 const std::string & );
2279void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & name,
2280 PostprocessorName & l_value,
2281 const Real & r_value);
2284void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & name,
2285 PostprocessorName & l_value,
2286 const int & r_value);
2289void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2290 FunctionName & l_value,
2291 const Real & r_value);
2294void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2295 FunctionName & l_value,
2296 const int & r_value);
2299void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2300 MaterialPropertyName & l_value,
2301 const Real & r_value);
2304void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2305 MaterialPropertyName & l_value,
2306 const int & r_value);
2309void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2310 MooseFunctorName & l_value,
2311 const Real & r_value);
2314void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2315 MooseFunctorName & l_value,
2316 const int & r_value);
2318template <
typename T>
2322 return have_parameter<T>(name) &&
isParamValid(name) ? &getParamHelper<T>(name, *
this) :
nullptr;
2325template <
typename T>
2332 pars.
mooseError(
"The parameter \"", name,
"\" is being retrieved before being set.");
2334 return pars.
get<T>(name);
2341const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string & name,
2346InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name,
2349template <
typename R1,
typename R2,
typename V1,
typename V2>
2350std::vector<std::pair<R1, R2>>
2356 const auto & v1 = get<V1>(param1);
2357 const auto & v2 = get<V2>(param2);
2360 if (controllable.count(param1) || controllable.count(param2))
2364 param2 +
" are controllable parameters and cannot be retireved using "
2365 "the MooseObject::getParam/InputParameters::get methods for pairs");
2367 if (v1.size() != v2.size())
2369 "Vector parameters ",
2376 ") are of different lengths \n");
2378 std::vector<std::pair<R1, R2>> parameter_pairs;
2379 auto i1 = v1.begin();
2380 auto i2 = v2.begin();
2381 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2382 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2383 return parameter_pairs;
2388template <
typename T>
2395 mooseError(
"Parameter \"", name,
"\" is not valid.");
2396 return have_parameter<T>(name);
2399template <
typename T>
2403 const std::string name_str(name_in);
2406 return Parameters::get<T>(name);
2409template <
typename T>
2413 const std::string name_str(name_in);
2416 return Parameters::have_parameter<T>(name);
2419template <
typename T>
2422 const std::string & name_in,
2423 const std::string & new_name,
2424 const std::string & new_description)
2427 const auto p_name = new_name.empty() ? name_in : new_name;
2431 "' parameter could not be transferred because it does not exist with type '",
2432 MooseUtils::prettyCppType<T>(),
2433 "' in the source parameters");
2434 if (name != name_in)
2435 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " + name +
2436 " in the source parameters. The new name should likely be used for the parameter "
2437 "transfer instead.");
2438 const std::string description =
2439 new_description.empty() ? source_params.
getDescription(name) : new_description;
2447 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2448 addRequiredParam<T>(p_name, source_params.
get<T>(name), description);
2450 addRequiredRangeCheckedParam<T>(
2453 addRequiredParam<T>(p_name, description);
2466 std::vector<Real> coupled_values;
2475 addRangeCheckedParam<T>(p_name,
2476 source_params.
get<T>(name),
2482 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2483 addParam<T>(p_name, source_params.
get<T>(name), description);
2487 addParam<T>(p_name, source_params.
get<T>(name), description);
2489 addParam<T>(p_name, description);
2495 _params[p_name]._is_private =
true;
2497 _params[p_name]._controllable =
true;
2500template <
typename... Args>
2504 std::ostringstream oss;
2509template <
typename... Args>
2513 std::ostringstream oss;
2518template <
typename... Args>
2522 std::ostringstream oss;
2532template <
typename T>
2539#ifdef MOOSE_MFEM_ENABLED
2541template <
typename T>
2545 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2546 std::is_same_v<T, MFEMVectorCoefficientName>;
2549template <
typename T,
typename A>
2558template <
typename T>
2562 return std::is_same_v<T, MooseFunctorName>
2563#ifdef MOOSE_MFEM_ENABLED
2564 || std::is_same_v<T, MFEMScalarCoefficientName>
2569template <
typename T,
typename A>
2576template <
typename T>
2580#ifdef MOOSE_MFEM_ENABLED
2581 return std::is_same_v<T, MFEMVectorCoefficientName>;
2587template <
typename T,
typename A>
2594template <
typename T>
2603template <
typename T>
2610template <
typename T>
2614 auto numeric_value_type = []()
2617 Moose::internal::getNullptrExample<T>()))
2620 Moose::internal::getNullptrExample<T>()))
2621 return "numeric vector value (enclosed in curly braces)";
2624 mooseAssert(
false,
"We control instantiations of this method");
2629 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2631#ifdef MOOSE_MFEM_ENABLED
2637 " 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...