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);
212 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)
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>
446 FRIEND_TEST(InputParametersTest, commandLineParamSetNotCLParam);
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;
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);
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,
1394 const std::string & removal_date);
1397 const std::string & new_name,
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,
1587 template <
typename T>
1594 template <
typename T>
1601 checkConsistentType<T>(
name);
1603 T & result = this->Parameters::set<T>(
name);
1613 template <
typename T,
typename... Ts>
1617 Ts... extra_input_parameters)
1623 template <
typename T,
typename UP_T>
1624 std::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());
1741 template <
typename T,
typename UP_T>
1742 std::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()}};
1788 template <
typename T>
1791 const std::string & error_string)
const 1795 T param = this->get<T>(
name);
1801 return this->get<T>(
name);
1804 template <
typename T>
1809 checkConsistentType<T>(
name);
1811 InputParameters::insert<T>(
name);
1813 metadata._required =
true;
1814 if constexpr (isFunctorNameType<T>())
1815 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1817 metadata._doc_string = doc_string;
1820 template <
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");
1830 template <
typename T,
typename S>
1835 checkConsistentType<T>(
name);
1837 T & l_value = InputParameters::set<T>(
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;
1853 template <
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);
1867 template <
typename T,
typename S>
1874 template <
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;
1919 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1922 else if constexpr (std::is_same_v<T, MooseEnum>)
1924 (
void)value_required;
1925 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1928 else if (value_required)
1929 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1932 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1935 template <
typename T>
1938 const std::string & parsed_function,
1939 const std::string & doc_string)
1941 addRequiredParam<T>(
name, doc_string);
1945 template <
typename T>
1949 const std::string & parsed_function,
1950 const std::string & doc_string)
1956 template <
typename T>
1959 const std::string & parsed_function,
1960 const std::string & doc_string)
1962 addParam<T>(
name, doc_string);
1966 template <
typename T>
1969 const std::string & custom_type,
1970 const std::string & doc_string)
1972 addRequiredParam<T>(
name, doc_string);
1976 template <
typename T>
1980 const std::string & custom_type,
1981 const std::string & doc_string)
1987 template <
typename T>
1990 const std::string & custom_type,
1991 const std::string & doc_string)
1993 addParam<T>(
name, doc_string);
1997 template <
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);
2007 metadata._custom_type = custom_type;
2009 metadata._deprecation_message = deprecation_message;
2013 template <
typename T>
2018 checkConsistentType<T>(
name);
2020 InputParameters::insert<T>(
name);
2024 template <
typename T>
2029 checkConsistentType<T>(
name);
2033 metadata._is_private =
true;
2034 metadata._set_by_add_param =
true;
2037 template <
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);
2049 template <
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>(
2069 template <
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");
2080 addCommandLineParamHelper<T>(
name,
syntax,
false,
true);
2083 template <
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)");
2095 addCommandLineParamHelper<T>(
name,
syntax,
false,
false);
2098 template <
typename T>
2111 if (!this->Parameters::have_parameter<T>(
name))
2116 ")\nbut the parameter already exists as type (",
2121 template <
typename T>
2126 if (!this->have_parameter<T>(
name))
2130 metadata._required =
false;
2131 metadata._is_private =
true;
2132 metadata._controllable =
false;
2135 template <
typename T>
2140 suppressParameter<T>(
name);
2144 template <
typename T>
2150 if (!this->have_parameter<T>(
name))
2156 template <
typename T>
2162 if (!this->have_parameter<T>(
name))
2163 mooseError(
"Unable to un-require nonexistent parameter: ",
name);
2168 template <
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");
2181 _params[
name]._deprecation_message = deprecation_message;
2185 template <
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;
2203 void InputParameters::addRequiredParam<MooseEnum>(
const std::string &
name,
2205 const std::string & doc_string);
2208 void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string &
name,
2210 const std::string & doc_string);
2213 void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2214 const std::string &
name,
2215 const std::vector<MooseEnum> & moose_enums,
2216 const std::string & doc_string);
2219 void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2220 const std::string &
name,
2221 const std::vector<MultiMooseEnum> & moose_enums,
2222 const std::string & doc_string);
2225 void InputParameters::addParam<MooseEnum>(
const std::string & ,
2226 const std::string & );
2229 void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2230 const std::string & );
2233 void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2234 const std::string & );
2237 void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2238 const std::string & );
2242 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2243 const std::string & );
2246 void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2249 void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2252 void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2253 const std::string & ,
2254 const std::string & );
2258 InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2259 const std::string & ,
2260 const std::string & );
2263 void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2264 const std::string & ,
2265 const std::string & ,
2266 const std::string & );
2270 void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string &
name,
2271 PostprocessorName & l_value,
2272 const Real & r_value);
2275 void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string &
name,
2276 PostprocessorName & l_value,
2277 const int & r_value);
2280 void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2281 FunctionName & l_value,
2282 const Real & r_value);
2285 void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2286 FunctionName & l_value,
2287 const int & r_value);
2290 void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2291 MaterialPropertyName & l_value,
2292 const Real & r_value);
2295 void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2296 MaterialPropertyName & l_value,
2297 const int & r_value);
2300 void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2301 MooseFunctorName & l_value,
2302 const Real & r_value);
2305 void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2306 MooseFunctorName & l_value,
2307 const int & r_value);
2309 template <
typename T>
2316 template <
typename T>
2323 pars.
mooseError(
"The parameter \"",
name,
"\" is being retrieved before being set.");
2332 const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string &
name,
2337 InputParameters::getParamHelper<MultiMooseEnum>(
const std::string &
name,
2340 template <
typename R1,
typename R2,
typename V1,
typename V2>
2341 std::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;
2379 template <
typename T>
2387 return have_parameter<T>(
name);
2390 template <
typename T>
2396 return Parameters::get<T>(
name);
2399 template <
typename T>
2405 return Parameters::have_parameter<T>(
name);
2408 template <
typename T>
2411 const std::string & name_in,
2412 const std::string & new_name,
2413 const std::string & new_description)
2416 const auto p_name = new_name.empty() ? name_in : new_name;
2420 "' parameter could not be transferred because it does not exist with type '",
2421 MooseUtils::prettyCppType<T>(),
2422 "' in the source parameters");
2423 if (
name != name_in)
2424 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " +
name +
2425 " in the source parameters. The new name should likely be used for the parameter " 2426 "transfer instead.");
2427 const std::string description =
2436 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2437 addRequiredParam<T>(p_name, source_params.
get<T>(
name), description);
2439 addRequiredRangeCheckedParam<T>(
2442 addRequiredParam<T>(p_name, description);
2455 std::vector<Real> coupled_values;
2464 addRangeCheckedParam<T>(p_name,
2471 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2472 addParam<T>(p_name, source_params.
get<T>(
name), description);
2476 addParam<T>(p_name, source_params.
get<T>(
name), description);
2478 addParam<T>(p_name, description);
2484 _params[p_name]._is_private =
true;
2486 _params[p_name]._controllable =
true;
2489 template <
typename... Args>
2493 std::ostringstream oss;
2498 template <
typename... Args>
2502 std::ostringstream oss;
2507 template <
typename... Args>
2511 std::ostringstream oss;
2521 template <
typename T>
2528 #ifdef MOOSE_MFEM_ENABLED 2530 template <
typename T>
2534 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2535 std::is_same_v<T, MFEMVectorCoefficientName>;
2538 template <
typename T,
typename A>
2547 template <
typename T>
2551 return std::is_same_v<T, MooseFunctorName>
2552 #ifdef MOOSE_MFEM_ENABLED 2553 || std::is_same_v<T, MFEMScalarCoefficientName>
2558 template <
typename T,
typename A>
2565 template <
typename T>
2569 #ifdef MOOSE_MFEM_ENABLED 2570 return std::is_same_v<T, MFEMVectorCoefficientName>;
2576 template <
typename T,
typename A>
2583 template <
typename T>
2592 template <
typename T>
2599 template <
typename T>
2603 auto numeric_value_type = []()
2606 Moose::internal::getNullptrExample<T>()))
2609 Moose::internal::getNullptrExample<T>()))
2610 return "numeric vector value (enclosed in curly braces)";
2613 mooseAssert(
false,
"We control instantiations of this method");
2618 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2620 #ifdef MOOSE_MFEM_ENABLED 2626 " material property, a function, a postprocessor or a " + numeric_value_type() +
".";
std::string name(const ElemQuality q)
void mooseStreamAll(std::ostringstream &ss)
All of the following are not meant to be called directly - they are called by the normal macros (moos...
constexpr bool isVectorFunctorNameTypeHelper(T *)
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 ...
RelationshipManagerType
Main types of Relationship Managers.
constexpr bool isMFEMFunctorNameTypeHelper(T *)
Generic factory class for build all sorts of objects.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Class that hold the whole problem being solved.
Storage for action instances.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This class wraps provides and tracks access to command line parameters.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Every object that can be built by the factory should be derived from this class.
std::function< void(const InputParameters &, InputParameters &)> RelationshipManagerInputParameterCallback
The type for the callback to set RelationshipManager parameters.
Specialized factory for generic Action System objects.
std::string trim(const std::string &str, const std::string &white_space=" \\\)
Standard scripting language trim function.
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
std::string demangle(const char *name)
constexpr bool isFunctorNameTypeHelper(T *ex)
constexpr bool isScalarFunctorNameTypeHelper(T *)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void add_command_line_name(const std::string &name)
constexpr T * getNullptrExample()
IntRange< T > make_range(T beg, T end)
class infix_ostream_iterator if void
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
std::array< Real, 2 > values
Parses MOOSE input using HIT/WASP.
map_type::const_iterator const_iterator
std::string stringJoin(const std::vector< std::string > &values, const std::string &separator=" ")
Concatenates value into a single string separated by separator.
Class for parsing input files.
ExecFlagEnum execute_flags
Storage for the registered execute flags.