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;
480 std::string
getGroupName(
const std::string & param_name)
const;
488 template <
typename T>
495 template <
typename T>
502 template <
typename T>
510 void addCoupledVar(
const std::string & name,
const std::string & doc_string);
520 const std::string & new_name,
521 const std::string & removal_date =
"");
531 void addCoupledVar(
const std::string & name,
const Real value,
const std::string & doc_string);
542 const std::vector<Real> & value,
543 const std::string & doc_string);
564 const std::string & base_name,
565 const std::string & num_name,
566 const std::string & doc_string);
568 const std::string & base_name,
569 const std::string & num_name,
570 const std::string & doc_string);
578 std::string
getMooseType(
const std::string & name)
const;
579 std::vector<std::string>
getVecMooseType(
const std::string & name)
const;
620 std::string
getDocString(
const std::string & name)
const;
629 void setDocString(
const std::string & name,
const std::string & doc);
634 std::string
getDocUnit(
const std::string & name)
const;
642 void setDocUnit(
const std::string & name,
const std::string & doc_unit);
673#ifdef MOOSE_KOKKOS_ENABLED
690 std::string
type(
const std::string & name)
const;
695 bool isPrivate(
const std::string & name)
const;
700 void declareControllable(
const std::string & name, std::set<ExecFlagType> execute_flags = {});
736 const std::string &
getBase()
const;
781 const std::string & name,
798 const std::vector<std::tuple<std::string,
825 using Parameters::operator=;
826 using Parameters::operator+=;
837 void checkParams(
const std::string & parsing_syntax);
848 std::optional<std::pair<bool, std::string>>
parameterRangeCheck(
const Parameters::Value & value,
849 const std::string & long_name,
850 const std::string & short_name,
851 const bool include_param_path);
860 void finalize(
const std::string & parsing_syntax);
875 std::filesystem::path
876 getFileBase(
const std::optional<std::string> & param_name = std::optional<std::string>())
const;
911 bool hasDefault(
const std::string & param_name)
const;
927 mooseDeprecated(
"InputParameters::hasCoupledValue() is deprecated. Use "
928 "InputParameters::hasCoupledVar() instead.");
938 void setCoupledVar(
const std::string & coupling_name,
const std::string & value);
946 void setCoupledVar(
const std::string & coupling_name,
const std::vector<VariableName> &
values);
953 const std::vector<VariableName> &
getCoupledVar(
const std::string & coupling_name)
const;
984 void defaultCoupledValue(
const std::string & coupling_name, Real value,
unsigned int i = 0);
1010 const std::vector<std::string> & exclude = {},
1011 const bool allow_private =
false);
1019 const std::vector<std::string> & exclude = {},
1020 const bool allow_private =
false);
1040 const std::vector<std::string> & include,
1041 bool allow_private =
false);
1055 const std::string & common_name,
1056 bool allow_private =
false);
1098 template <
typename T>
1099 const T *
queryParam(
const std::string & name)
const;
1107 template <
typename T>
1111 using Parameters::get;
1114 template <
typename R1,
1116 typename V1 =
typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1119 typename V2 =
typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1122 std::vector<std::pair<R1, R2>>
get(
const std::string & param1,
const std::string & param2)
const;
1143 void setReservedValues(
const std::string & name,
const std::set<std::string> & reserved);
1149 std::set<std::string>
reservedValues(
const std::string & name)
const;
1166 const hit::Node *
getHitNode(
const std::string & param)
const;
1172 void setHitNode(
const std::string & param,
const hit::Node & node,
const SetParamHitNodeKey);
1198 template <
typename... Args>
1199 std::string
paramMessage(
const std::string & param, Args... args)
const;
1204 template <
typename... Args>
1205 [[noreturn]]
void mooseError(Args &&... args)
const;
1211 template <
typename... Args>
1212 [[noreturn]]
void paramError(
const std::string & param, Args... args)
const;
1218 std::string
rawParamVal(
const std::string & param)
const;
1224 template <
typename T>
1236 template <
typename T>
1237 bool isType(
const std::string & name)
const;
1245 std::string
varName(
const std::string & var_param_name,
1246 const std::string & moose_object_with_var_param_name)
const;
1256 const std::string & new_name,
1257 const std::string & new_docstring);
1266 const std::string & new_name,
1267 const std::string & new_docstring);
1270 const std::string & new_name,
1271 const std::string & removal_date);
1274 const std::string & new_name,
1275 const std::string & removal_date);
1283 const std::string &
checkForRename(
const std::string & name)
const;
1291 template <
typename T>
1292 const T &
get(std::string_view name)
const;
1302 template <
typename T>
1312 template <
typename T>
1314 const std::string & name,
1315 const std::string & new_name =
"",
1316 const std::string & new_description =
"");
1330 std::vector<std::string>
paramAliases(
const std::string & param_name)
const;
1365 const hit::Node & node,
1377 template <
typename T>
1383 template <
typename T>
1392 const std::string & new_name,
1393 const std::string & docstring,
1394 const std::string & removal_date);
1397 const std::string & new_name,
1398 const std::string & docstring,
1399 const std::string & removal_date);
1407 std::pair<std::string, const hit::Node *>
paramMessageContext(
const std::string & param)
const;
1464 if (
_params.count(param) == 0)
1465 mooseError(
"param '", param,
"' not present in InputParams");
1471 if (
_params.count(param) == 0)
1472 mooseError(
"param '", param,
"' not present in InputParams");
1496 template <
typename T,
typename S>
1497 void setParamHelper(
const std::string & name, T & l_value,
const S & r_value);
1507 template <
typename T>
1509 const std::string & syntax,
1510 const bool required,
1511 const bool value_required);
1518 const bool with_prefix =
true,
1519 const hit::Node * node =
nullptr,
1520 const bool show_trace =
true)
const;
1541 std::vector<std::tuple<std::string,
1587template <
typename T>
1594template <
typename T>
1601 checkConsistentType<T>(name);
1603 T & result = this->Parameters::set<T>(name);
1606 _params[name]._set_by_add_param =
true;
1613template <
typename T,
typename... Ts>
1617 Ts... extra_input_parameters)
1619 this->set<T>(name) = value;
1623template <
typename T,
typename UP_T>
1624std::optional<std::pair<bool, std::string>>
1626 const std::string & short_name,
1627 const InputParameters::Parameter<std::vector<T>> & param,
1628 const bool include_param_path)
1633 const auto & range_function =
_params[short_name]._range_function;
1634 if (range_function.empty())
1649 std::vector<std::string>
vars;
1650 if (fp.ParseAndDeduceVariables(range_function,
vars) != -1)
1652 "Error parsing expression '" + range_function +
"' for parameter " + short_name +
""}};
1655 std::vector<UP_T> parbuf(
vars.size());
1658 const std::vector<T> & value = param.get();
1661 bool need_to_iterate =
false;
1666 for (
unsigned int j = 0; j <
vars.size(); j++)
1668 if (
vars[j] == short_name)
1670 if (value.size() == 0)
1672 std::ostringstream oss;
1673 oss <<
"Range checking empty vector";
1674 if (include_param_path)
1675 oss <<
" parameter " << full_name;
1676 oss <<
"; expression = '" << range_function <<
"'";
1677 return {{
true, oss.str()}};
1680 parbuf[j] = value[i];
1681 need_to_iterate =
true;
1683 else if (
vars[j] == short_name +
"_size")
1684 parbuf[j] = value.size();
1687 if (
vars[j].substr(0, short_name.size() + 1) != short_name +
"_")
1688 return {{
false,
"Error parsing expression '" + range_function +
"'"}};
1689 std::istringstream iss(
vars[j]);
1690 iss.seekg(short_name.size() + 1);
1693 if (iss >> index && iss.eof())
1695 if (index >= value.size())
1697 std::ostringstream oss;
1698 oss <<
"Error parsing expression '" + range_function +
"'";
1699 if (include_param_path)
1700 oss <<
" for parameter " << full_name;
1701 oss <<
"; out of range variable '" +
vars[j] <<
"'";
1702 return {{
true, oss.str()}};
1704 parbuf[j] = value[index];
1708 "Error parsing expression '" + range_function +
"'; invalid variable '" +
1715 auto tmp_eps = fp.epsilon();
1717 UP_T result = fp.Eval(&parbuf[0]);
1718 fp.setEpsilon(tmp_eps);
1722 return {{
false,
"Error evaluating expression '" + range_function +
"'"}};
1726 std::ostringstream oss;
1727 oss <<
"Range check failed";
1728 if (include_param_path)
1729 oss <<
" for parameter " << full_name;
1730 oss <<
"; expression = '" << range_function <<
"'";
1731 if (need_to_iterate)
1732 oss <<
", component " << i;
1733 return {{
true, oss.str()}};
1736 }
while (need_to_iterate && ++i < value.size());
1741template <
typename T,
typename UP_T>
1742std::optional<std::pair<bool, std::string>>
1744 const std::string & short_name,
1745 const InputParameters::Parameter<T> & param,
1746 const bool include_param_path)
1751 const auto & range_function =
_params[short_name]._range_function;
1752 if (range_function.empty())
1757 if (fp.Parse(range_function, short_name) != -1)
1759 "Error parsing expression '" + range_function +
"'" +
" for parameter " + short_name}};
1763 auto tmp_eps = fp.epsilon();
1766 std::vector<UP_T> value(1, param.get());
1767 UP_T result = fp.Eval(&value[0]);
1768 fp.setEpsilon(tmp_eps);
1772 "Error evaluating expression '" + range_function +
"' for parameter " + short_name +
1773 "; perhaps you used the wrong variable name?"}};
1777 std::ostringstream oss;
1778 oss <<
"Range check failed";
1779 if (include_param_path)
1780 oss <<
" for parameter " << full_name;
1781 oss <<
"; expression = '" << range_function <<
"', value = " << value[0];
1782 return {{
true, oss.str()}};
1788template <
typename T>
1791 const std::string & error_string)
const
1795 T param = this->get<T>(name);
1800 mooseError(
"Parameter ", name,
" is NULL.\n", error_string);
1801 return this->get<T>(name);
1804template <
typename T>
1809 checkConsistentType<T>(name);
1811 InputParameters::insert<T>(name);
1812 auto & metadata =
_params[name];
1813 metadata._required =
true;
1814 if constexpr (isFunctorNameType<T>())
1815 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1817 metadata._doc_string = doc_string;
1820template <
typename T>
1824 const std::string & )
1826 mooseError(
"You cannot call addRequiredParam and supply a default value for this type, please "
1827 "use addParam instead");
1830template <
typename T,
typename S>
1835 checkConsistentType<T>(name);
1837 T & l_value = InputParameters::set<T>(name);
1838 auto & metadata =
_params[name];
1839 if constexpr (isFunctorNameType<T>())
1840 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1842 metadata._doc_string = doc_string;
1850 metadata._set_by_add_param =
true;
1853template <
typename T>
1858 checkConsistentType<T>(name);
1860 InputParameters::insert<T>(name);
1861 if constexpr (isFunctorNameType<T>())
1862 _params[name]._doc_string = appendFunctorDescription<T>(doc_string);
1864 _params[name]._doc_string = doc_string;
1867template <
typename T,
typename S>
1874template <
typename T>
1877 const std::string &
syntax,
1878 const bool required,
1879 const bool value_required)
1882 "This type is not a supported command line parameter type. See "
1883 "CommandLine::populateCommandLineParams to add it as a supported type.");
1889 std::vector<std::string> syntax_split;
1894 mooseAssert(cl_data->syntax.size(),
"Empty token");
1898 for (
const auto & val : syntax_split)
1899 if (val.rfind(
"-", 0) == 0)
1901 if (!std::regex_search(val, std::regex(
"^\\-+[a-zA-Z]")))
1904 "' for the command line parameter '",
1906 "' is invalid. It must begin with an alphabetical character.");
1908 cl_data->switches.push_back(val);
1912 cl_data->required = required;
1913 cl_data->global =
false;
1916 if constexpr (std::is_same_v<T, bool>)
1918 (void)value_required;
1922 else if constexpr (std::is_same_v<T, MooseEnum>)
1924 (void)value_required;
1928 else if (value_required)
1935template <
typename T>
1938 const std::string & parsed_function,
1939 const std::string & doc_string)
1941 addRequiredParam<T>(name, doc_string);
1942 _params[name]._range_function = parsed_function;
1945template <
typename T>
1949 const std::string & parsed_function,
1950 const std::string & doc_string)
1952 addParam<T>(name, value, doc_string);
1953 _params[name]._range_function = parsed_function;
1956template <
typename T>
1959 const std::string & parsed_function,
1960 const std::string & doc_string)
1962 addParam<T>(name, doc_string);
1963 _params[name]._range_function = parsed_function;
1966template <
typename T>
1969 const std::string & custom_type,
1970 const std::string & doc_string)
1972 addRequiredParam<T>(name, doc_string);
1973 _params[name]._custom_type = custom_type;
1976template <
typename T>
1980 const std::string & custom_type,
1981 const std::string & doc_string)
1983 addParam<T>(name, value, doc_string);
1984 _params[name]._custom_type = custom_type;
1987template <
typename T>
1990 const std::string & custom_type,
1991 const std::string & doc_string)
1993 addParam<T>(name, doc_string);
1994 _params[name]._custom_type = custom_type;
1997template <
typename T>
2000 const std::string & custom_type,
2001 const std::string & doc_string,
2002 const std::string & deprecation_message)
2005 addParam<T>(name, doc_string);
2006 auto & metadata =
_params[name];
2007 metadata._custom_type = custom_type;
2009 metadata._deprecation_message = deprecation_message;
2013template <
typename T>
2018 checkConsistentType<T>(name);
2020 InputParameters::insert<T>(name);
2021 _params[name]._is_private =
true;
2024template <
typename T>
2029 checkConsistentType<T>(name);
2031 InputParameters::set<T>(name) = value;
2032 auto & metadata =
_params[name];
2033 metadata._is_private =
true;
2034 metadata._set_by_add_param =
true;
2037template <
typename T>
2040 const std::string &
syntax,
2041 const std::string & doc_string)
2043 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool");
2045 addRequiredParam<T>(name, doc_string);
2046 addCommandLineParamHelper<T>(name, syntax,
true,
true);
2049template <
typename T>
2052 const std::string &
syntax,
2053 const std::string & doc_string)
2055 static_assert(!std::is_same_v<T, MooseEnum>,
2056 "addCommandLineParam() without a value cannot be used with a MooseEnum because a "
2057 "MooseEnum requires initialization");
2059 auto constexpr is_bool = std::is_same_v<T, bool>;
2060 if constexpr (is_bool)
2061 addParam<T>(name,
false, doc_string);
2063 addParam<T>(name, doc_string);
2065 addCommandLineParamHelper<T>(
2066 name, syntax,
false, !is_bool);
2069template <
typename T>
2072 const std::string &
syntax,
2074 const std::string & doc_string)
2076 if constexpr (std::is_same_v<T, bool>)
2077 mooseAssert(!value,
"Default for bool must be false");
2079 addParam<T>(name, value, doc_string);
2080 addCommandLineParamHelper<T>(name, syntax,
false,
true);
2083template <
typename T>
2086 const std::string &
syntax,
2088 const std::string & doc_string)
2090 mooseAssert(name ==
"citations" || name ==
"csg_only" || name ==
"mesh_only" ||
2091 name ==
"recover" || name ==
"run",
2092 "Not supported for new parameters");
2093 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool (does not take a value)");
2094 addParam<T>(name, value, doc_string);
2095 addCommandLineParamHelper<T>(name, syntax,
false,
false);
2098template <
typename T>
2111 if (!this->Parameters::have_parameter<T>(name))
2116 ")\nbut the parameter already exists as type (",
2121template <
typename T>
2126 if (!this->have_parameter<T>(name))
2127 mooseError(
"Unable to suppress nonexistent parameter: ", name);
2129 auto & metadata =
_params[name];
2130 metadata._required =
false;
2131 metadata._is_private =
true;
2132 metadata._controllable =
false;
2135template <
typename T>
2140 suppressParameter<T>(name);
2144template <
typename T>
2150 if (!this->have_parameter<T>(name))
2151 mooseError(
"Unable to require nonexistent parameter: ", name);
2153 _params[name]._required =
true;
2156template <
typename T>
2162 if (!this->have_parameter<T>(name))
2163 mooseError(
"Unable to un-require nonexistent parameter: ", name);
2165 _params[name]._required =
false;
2168template <
typename T>
2172 const std::string & doc_string,
2173 const std::string & deprecation_message)
2177 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2178 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2179 addParam<T>(name, value, doc_string);
2181 _params[name]._deprecation_message = deprecation_message;
2185template <
typename T>
2188 const std::string & doc_string,
2189 const std::string & deprecation_message)
2193 "Attempting to deprecate via addDeprecatedParam the parameter, '"
2194 << name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2195 addParam<T>(name, doc_string);
2197 _params[name]._deprecation_message = deprecation_message;
2203void InputParameters::addRequiredParam<MooseEnum>(
const std::string & name,
2205 const std::string & doc_string);
2208void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string & name,
2210 const std::string & doc_string);
2213void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2214 const std::string & name,
2215 const std::vector<MooseEnum> & moose_enums,
2216 const std::string & doc_string);
2219void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2220 const std::string & name,
2221 const std::vector<MultiMooseEnum> & moose_enums,
2222 const std::string & doc_string);
2225void InputParameters::addParam<MooseEnum>(
const std::string & ,
2226 const std::string & );
2229void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2230 const std::string & );
2233void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2234 const std::string & );
2237void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2238 const std::string & );
2242InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2243 const std::string & );
2246void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2249void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2252void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2253 const std::string & ,
2254 const std::string & );
2258InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2259 const std::string & ,
2260 const std::string & );
2263void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2264 const std::string & ,
2265 const std::string & ,
2266 const std::string & );
2270void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string & name,
2271 PostprocessorName & l_value,
2272 const Real & r_value);
2275void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string & name,
2276 PostprocessorName & l_value,
2277 const int & r_value);
2280void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2281 FunctionName & l_value,
2282 const Real & r_value);
2285void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2286 FunctionName & l_value,
2287 const int & r_value);
2290void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2291 MaterialPropertyName & l_value,
2292 const Real & r_value);
2295void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2296 MaterialPropertyName & l_value,
2297 const int & r_value);
2300void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2301 MooseFunctorName & l_value,
2302 const Real & r_value);
2305void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2306 MooseFunctorName & l_value,
2307 const int & r_value);
2309template <
typename T>
2313 return have_parameter<T>(name) &&
isParamValid(name) ? &getParamHelper<T>(name, *
this) :
nullptr;
2316template <
typename T>
2323 pars.
mooseError(
"The parameter \"", name,
"\" is being retrieved before being set.");
2325 return pars.
get<T>(name);
2332const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string & name,
2337InputParameters::getParamHelper<MultiMooseEnum>(
const std::string & name,
2340template <
typename R1,
typename R2,
typename V1,
typename V2>
2341std::vector<std::pair<R1, R2>>
2347 const auto & v1 = get<V1>(param1);
2348 const auto & v2 = get<V2>(param2);
2351 if (controllable.count(param1) || controllable.count(param2))
2355 param2 +
" are controllable parameters and cannot be retireved using "
2356 "the MooseObject::getParam/InputParameters::get methods for pairs");
2358 if (v1.size() != v2.size())
2360 "Vector parameters ",
2367 ") are of different lengths \n");
2369 std::vector<std::pair<R1, R2>> parameter_pairs;
2370 auto i1 = v1.begin();
2371 auto i2 = v2.begin();
2372 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2373 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2374 return parameter_pairs;
2379template <
typename T>
2386 mooseError(
"Parameter \"", name,
"\" is not valid.");
2387 return have_parameter<T>(name);
2390template <
typename T>
2394 const std::string name_str(name_in);
2397 return Parameters::get<T>(name);
2400template <
typename T>
2404 const std::string name_str(name_in);
2407 return Parameters::have_parameter<T>(name);
2410template <
typename T>
2413 const std::string & name_in,
2414 const std::string & new_name,
2415 const std::string & new_description)
2418 const auto p_name = new_name.empty() ? name_in : new_name;
2422 "' parameter could not be transferred because it does not exist with type '",
2423 MooseUtils::prettyCppType<T>(),
2424 "' in the source parameters");
2425 if (name != name_in)
2426 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " + name +
2427 " in the source parameters. The new name should likely be used for the parameter "
2428 "transfer instead.");
2429 const std::string description =
2430 new_description.empty() ? source_params.
getDescription(name) : new_description;
2438 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2439 addRequiredParam<T>(p_name, source_params.
get<T>(name), description);
2441 addRequiredRangeCheckedParam<T>(
2444 addRequiredParam<T>(p_name, description);
2457 std::vector<Real> coupled_values;
2466 addRangeCheckedParam<T>(p_name,
2467 source_params.
get<T>(name),
2473 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2474 addParam<T>(p_name, source_params.
get<T>(name), description);
2478 addParam<T>(p_name, source_params.
get<T>(name), description);
2480 addParam<T>(p_name, description);
2486 _params[p_name]._is_private =
true;
2488 _params[p_name]._controllable =
true;
2491template <
typename... Args>
2495 std::ostringstream oss;
2500template <
typename... Args>
2504 std::ostringstream oss;
2509template <
typename... Args>
2513 std::ostringstream oss;
2523template <
typename T>
2530#ifdef MOOSE_MFEM_ENABLED
2532template <
typename T>
2536 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2537 std::is_same_v<T, MFEMVectorCoefficientName>;
2540template <
typename T,
typename A>
2549template <
typename T>
2553 return std::is_same_v<T, MooseFunctorName>
2554#ifdef MOOSE_MFEM_ENABLED
2555 || std::is_same_v<T, MFEMScalarCoefficientName>
2560template <
typename T,
typename A>
2567template <
typename T>
2571#ifdef MOOSE_MFEM_ENABLED
2572 return std::is_same_v<T, MFEMVectorCoefficientName>;
2578template <
typename T,
typename A>
2585template <
typename T>
2594template <
typename T>
2601template <
typename T>
2605 auto numeric_value_type = []()
2608 Moose::internal::getNullptrExample<T>()))
2611 Moose::internal::getNullptrExample<T>()))
2612 return "numeric vector value (enclosed in curly braces)";
2615 mooseAssert(
false,
"We control instantiations of this method");
2620 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2622#ifdef MOOSE_MFEM_ENABLED
2628 " 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...