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;
949 void defaultCoupledValue(
const std::string & coupling_name, Real value,
unsigned int i = 0);
975 const std::vector<std::string> & exclude = {},
976 const bool allow_private =
false);
984 const std::vector<std::string> & exclude = {},
985 const bool allow_private =
false);
1005 const std::vector<std::string> & include,
1006 bool allow_private =
false);
1020 const std::string & common_name,
1021 bool allow_private =
false);
1062 template <
typename T>
1063 const T *
queryParam(
const std::string & name)
const;
1071 template <
typename T>
1075 using Parameters::get;
1078 template <
typename R1,
1080 typename V1 =
typename std::conditional<std::is_same<R1, MooseEnumItem>::value,
1083 typename V2 =
typename std::conditional<std::is_same<R2, MooseEnumItem>::value,
1086 std::vector<std::pair<R1, R2>>
get(
const std::string & param1,
const std::string & param2)
const;
1107 void setReservedValues(
const std::string & name,
const std::set<std::string> & reserved);
1113 std::set<std::string>
reservedValues(
const std::string & name)
const;
1130 const hit::Node *
getHitNode(
const std::string & param)
const;
1136 void setHitNode(
const std::string & param,
const hit::Node & node,
const SetParamHitNodeKey);
1162 template <
typename... Args>
1163 std::string
paramMessage(
const std::string & param, Args... args)
const;
1168 template <
typename... Args>
1169 [[noreturn]]
void mooseError(Args &&... args)
const;
1175 template <
typename... Args>
1176 [[noreturn]]
void paramError(
const std::string & param, Args... args)
const;
1182 std::string
rawParamVal(
const std::string & param)
const;
1188 template <
typename T>
1200 template <
typename T>
1201 bool isType(
const std::string & name)
const;
1209 std::string
varName(
const std::string & var_param_name,
1210 const std::string & moose_object_with_var_param_name)
const;
1220 const std::string & new_name,
1221 const std::string & new_docstring);
1230 const std::string & new_name,
1231 const std::string & new_docstring);
1234 const std::string & new_name,
1235 const std::string & removal_date);
1238 const std::string & new_name,
1239 const std::string & removal_date);
1255 template <
typename T>
1256 const T &
get(std::string_view
name)
const;
1266 template <
typename T>
1276 template <
typename T>
1278 const std::string & name,
1279 const std::string & new_name =
"",
1280 const std::string & new_description =
"");
1294 std::vector<std::string>
paramAliases(
const std::string & param_name)
const;
1329 const hit::Node & node,
1341 template <
typename T>
1347 template <
typename T>
1356 const std::string & new_name,
1358 const std::string & removal_date);
1361 const std::string & new_name,
1363 const std::string & removal_date);
1371 std::pair<std::string, const hit::Node *>
paramMessageContext(
const std::string & param)
const;
1428 if (
_params.count(param) == 0)
1429 mooseError(
"param '", param,
"' not present in InputParams");
1435 if (
_params.count(param) == 0)
1436 mooseError(
"param '", param,
"' not present in InputParams");
1460 template <
typename T,
typename S>
1461 void setParamHelper(
const std::string & name, T & l_value,
const S & r_value);
1471 template <
typename T>
1473 const std::string & syntax,
1474 const bool required,
1475 const bool value_required);
1482 const bool with_prefix =
true,
1483 const hit::Node * node =
nullptr,
1484 const bool show_trace =
true)
const;
1505 std::vector<std::tuple<std::string,
1551 template <
typename T>
1558 template <
typename T>
1565 checkConsistentType<T>(
name);
1567 T & result = this->Parameters::set<T>(
name);
1577 template <
typename T,
typename... Ts>
1581 Ts... extra_input_parameters)
1587 template <
typename T,
typename UP_T>
1588 std::optional<std::pair<bool, std::string>>
1590 const std::string & short_name,
1591 const InputParameters::Parameter<std::vector<T>> & param,
1592 const bool include_param_path)
1597 const auto & range_function =
_params[short_name]._range_function;
1598 if (range_function.empty())
1613 std::vector<std::string>
vars;
1614 if (fp.ParseAndDeduceVariables(range_function,
vars) != -1)
1616 "Error parsing expression '" + range_function +
"' for parameter " + short_name +
""}};
1619 std::vector<UP_T> parbuf(
vars.size());
1622 const std::vector<T> &
value = param.get();
1625 bool need_to_iterate =
false;
1630 for (
unsigned int j = 0; j <
vars.size(); j++)
1632 if (
vars[j] == short_name)
1634 if (
value.size() == 0)
1636 std::ostringstream oss;
1637 oss <<
"Range checking empty vector";
1638 if (include_param_path)
1639 oss <<
" parameter " << full_name;
1640 oss <<
"; expression = '" << range_function <<
"'";
1641 return {{
true, oss.str()}};
1644 parbuf[j] =
value[i];
1645 need_to_iterate =
true;
1647 else if (
vars[j] == short_name +
"_size")
1648 parbuf[j] =
value.size();
1651 if (
vars[j].substr(0, short_name.size() + 1) != short_name +
"_")
1652 return {{
false,
"Error parsing expression '" + range_function +
"'"}};
1653 std::istringstream iss(
vars[j]);
1654 iss.seekg(short_name.size() + 1);
1657 if (iss >> index && iss.eof())
1659 if (index >=
value.size())
1661 std::ostringstream oss;
1662 oss <<
"Error parsing expression '" + range_function +
"'";
1663 if (include_param_path)
1664 oss <<
" for parameter " << full_name;
1665 oss <<
"; out of range variable '" +
vars[j] <<
"'";
1666 return {{
true, oss.str()}};
1668 parbuf[j] =
value[index];
1672 "Error parsing expression '" + range_function +
"'; invalid variable '" +
1679 auto tmp_eps = fp.epsilon();
1681 UP_T result = fp.Eval(&parbuf[0]);
1682 fp.setEpsilon(tmp_eps);
1686 return {{
false,
"Error evaluating expression '" + range_function +
"'"}};
1690 std::ostringstream oss;
1691 oss <<
"Range check failed";
1692 if (include_param_path)
1693 oss <<
" for parameter " << full_name;
1694 oss <<
"; expression = '" << range_function <<
"'";
1695 if (need_to_iterate)
1696 oss <<
", component " << i;
1697 return {{
true, oss.str()}};
1700 }
while (need_to_iterate && ++i <
value.size());
1705 template <
typename T,
typename UP_T>
1706 std::optional<std::pair<bool, std::string>>
1708 const std::string & short_name,
1709 const InputParameters::Parameter<T> & param,
1710 const bool include_param_path)
1715 const auto & range_function =
_params[short_name]._range_function;
1716 if (range_function.empty())
1721 if (fp.Parse(range_function, short_name) != -1)
1723 "Error parsing expression '" + range_function +
"'" +
" for parameter " + short_name}};
1727 auto tmp_eps = fp.epsilon();
1730 std::vector<UP_T>
value(1, param.get());
1731 UP_T result = fp.Eval(&
value[0]);
1732 fp.setEpsilon(tmp_eps);
1736 "Error evaluating expression '" + range_function +
"' for parameter " + short_name +
1737 "; perhaps you used the wrong variable name?"}};
1741 std::ostringstream oss;
1742 oss <<
"Range check failed";
1743 if (include_param_path)
1744 oss <<
" for parameter " << full_name;
1745 oss <<
"; expression = '" << range_function <<
"', value = " <<
value[0];
1746 return {{
true, oss.str()}};
1752 template <
typename T>
1755 const std::string & error_string)
const 1759 T param = this->get<T>(
name);
1765 return this->get<T>(
name);
1768 template <
typename T>
1773 checkConsistentType<T>(
name);
1775 InputParameters::insert<T>(
name);
1777 metadata._required =
true;
1778 if constexpr (isFunctorNameType<T>())
1779 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1781 metadata._doc_string = doc_string;
1784 template <
typename T>
1788 const std::string & )
1790 mooseError(
"You cannot call addRequiredParam and supply a default value for this type, please " 1791 "use addParam instead");
1794 template <
typename T,
typename S>
1799 checkConsistentType<T>(
name);
1801 T & l_value = InputParameters::set<T>(
name);
1803 if constexpr (isFunctorNameType<T>())
1804 metadata._doc_string = appendFunctorDescription<T>(doc_string);
1806 metadata._doc_string = doc_string;
1814 metadata._set_by_add_param =
true;
1817 template <
typename T>
1822 checkConsistentType<T>(
name);
1824 InputParameters::insert<T>(
name);
1825 if constexpr (isFunctorNameType<T>())
1826 _params[
name]._doc_string = appendFunctorDescription<T>(doc_string);
1831 template <
typename T,
typename S>
1838 template <
typename T>
1841 const std::string &
syntax,
1842 const bool required,
1843 const bool value_required)
1846 "This type is not a supported command line parameter type. See " 1847 "CommandLine::populateCommandLineParams to add it as a supported type.");
1853 std::vector<std::string> syntax_split;
1858 mooseAssert(cl_data->syntax.size(),
"Empty token");
1862 for (
const auto & val : syntax_split)
1863 if (val.rfind(
"-", 0) == 0)
1865 if (!std::regex_search(val, std::regex(
"^\\-+[a-zA-Z]")))
1868 "' for the command line parameter '",
1870 "' is invalid. It must begin with an alphabetical character.");
1872 cl_data->switches.push_back(val);
1876 cl_data->required = required;
1877 cl_data->global =
false;
1880 if constexpr (std::is_same_v<T, bool>)
1882 (
void)value_required;
1883 cl_data->argument_type = CommandLineMetadata::ArgumentType::NONE;
1886 else if constexpr (std::is_same_v<T, MooseEnum>)
1888 (
void)value_required;
1889 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1892 else if (value_required)
1893 cl_data->argument_type = CommandLineMetadata::ArgumentType::REQUIRED;
1896 cl_data->argument_type = CommandLineMetadata::ArgumentType::OPTIONAL;
1899 template <
typename T>
1902 const std::string & parsed_function,
1903 const std::string & doc_string)
1905 addRequiredParam<T>(
name, doc_string);
1909 template <
typename T>
1913 const std::string & parsed_function,
1914 const std::string & doc_string)
1920 template <
typename T>
1923 const std::string & parsed_function,
1924 const std::string & doc_string)
1926 addParam<T>(
name, doc_string);
1930 template <
typename T>
1933 const std::string & custom_type,
1934 const std::string & doc_string)
1936 addRequiredParam<T>(
name, doc_string);
1940 template <
typename T>
1944 const std::string & custom_type,
1945 const std::string & doc_string)
1951 template <
typename T>
1954 const std::string & custom_type,
1955 const std::string & doc_string)
1957 addParam<T>(
name, doc_string);
1961 template <
typename T>
1964 const std::string & custom_type,
1965 const std::string & doc_string,
1966 const std::string & deprecation_message)
1969 addParam<T>(
name, doc_string);
1971 metadata._custom_type = custom_type;
1973 metadata._deprecation_message = deprecation_message;
1977 template <
typename T>
1982 checkConsistentType<T>(
name);
1984 InputParameters::insert<T>(
name);
1988 template <
typename T>
1993 checkConsistentType<T>(
name);
1997 metadata._is_private =
true;
1998 metadata._set_by_add_param =
true;
2001 template <
typename T>
2004 const std::string &
syntax,
2005 const std::string & doc_string)
2007 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool");
2009 addRequiredParam<T>(
name, doc_string);
2010 addCommandLineParamHelper<T>(
name,
syntax,
true,
true);
2013 template <
typename T>
2016 const std::string &
syntax,
2017 const std::string & doc_string)
2019 static_assert(!std::is_same_v<T, MooseEnum>,
2020 "addCommandLineParam() without a value cannot be used with a MooseEnum because a " 2021 "MooseEnum requires initialization");
2023 auto constexpr is_bool = std::is_same_v<T, bool>;
2024 if constexpr (is_bool)
2025 addParam<T>(
name,
false, doc_string);
2027 addParam<T>(
name, doc_string);
2029 addCommandLineParamHelper<T>(
2033 template <
typename T>
2036 const std::string &
syntax,
2038 const std::string & doc_string)
2040 if constexpr (std::is_same_v<T, bool>)
2041 mooseAssert(!
value,
"Default for bool must be false");
2044 addCommandLineParamHelper<T>(
name,
syntax,
false,
true);
2047 template <
typename T>
2050 const std::string &
syntax,
2052 const std::string & doc_string)
2054 mooseAssert(
name ==
"csg_only" ||
name ==
"mesh_only" ||
name ==
"recover" ||
name ==
"run",
2055 "Not supported for new parameters");
2056 static_assert(!std::is_same_v<T, bool>,
"Cannot be used for a bool (does not take a value)");
2058 addCommandLineParamHelper<T>(
name,
syntax,
false,
false);
2061 template <
typename T>
2074 if (!this->Parameters::have_parameter<T>(
name))
2079 ")\nbut the parameter already exists as type (",
2084 template <
typename T>
2089 if (!this->have_parameter<T>(
name))
2093 metadata._required =
false;
2094 metadata._is_private =
true;
2095 metadata._controllable =
false;
2098 template <
typename T>
2103 suppressParameter<T>(
name);
2107 template <
typename T>
2113 if (!this->have_parameter<T>(
name))
2119 template <
typename T>
2125 if (!this->have_parameter<T>(
name))
2126 mooseError(
"Unable to un-require nonexistent parameter: ",
name);
2131 template <
typename T>
2135 const std::string & doc_string,
2136 const std::string & deprecation_message)
2140 "Attempting to deprecate via addDeprecatedParam the parameter, '" 2141 <<
name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2144 _params[
name]._deprecation_message = deprecation_message;
2148 template <
typename T>
2151 const std::string & doc_string,
2152 const std::string & deprecation_message)
2156 "Attempting to deprecate via addDeprecatedParam the parameter, '" 2157 <<
name <<
"', already deprecated via deprecateParam or renamed via renameParam");
2158 addParam<T>(
name, doc_string);
2160 _params[
name]._deprecation_message = deprecation_message;
2166 void InputParameters::addRequiredParam<MooseEnum>(
const std::string &
name,
2168 const std::string & doc_string);
2171 void InputParameters::addRequiredParam<MultiMooseEnum>(
const std::string &
name,
2173 const std::string & doc_string);
2176 void InputParameters::addRequiredParam<std::vector<MooseEnum>>(
2177 const std::string &
name,
2178 const std::vector<MooseEnum> & moose_enums,
2179 const std::string & doc_string);
2182 void InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
2183 const std::string &
name,
2184 const std::vector<MultiMooseEnum> & moose_enums,
2185 const std::string & doc_string);
2188 void InputParameters::addParam<MooseEnum>(
const std::string & ,
2189 const std::string & );
2192 void InputParameters::addParam<MultiMooseEnum>(
const std::string & ,
2193 const std::string & );
2196 void InputParameters::addParam<std::vector<MooseEnum>>(
const std::string & ,
2197 const std::string & );
2200 void InputParameters::addParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2201 const std::string & );
2205 InputParameters::addRequiredParam<std::vector<MultiMooseEnum>>(
const std::string & ,
2206 const std::string & );
2209 void InputParameters::addPrivateParam<MooseEnum>(
const std::string & );
2212 void InputParameters::addPrivateParam<MultiMooseEnum>(
const std::string & );
2215 void InputParameters::addDeprecatedParam<MooseEnum>(
const std::string & ,
2216 const std::string & ,
2217 const std::string & );
2221 InputParameters::addDeprecatedParam<MultiMooseEnum>(
const std::string & ,
2222 const std::string & ,
2223 const std::string & );
2226 void InputParameters::addDeprecatedParam<std::vector<MooseEnum>>(
2227 const std::string & ,
2228 const std::string & ,
2229 const std::string & );
2233 void InputParameters::setParamHelper<PostprocessorName, Real>(
const std::string &
name,
2234 PostprocessorName & l_value,
2235 const Real & r_value);
2238 void InputParameters::setParamHelper<PostprocessorName, int>(
const std::string &
name,
2239 PostprocessorName & l_value,
2240 const int & r_value);
2243 void InputParameters::setParamHelper<FunctionName, Real>(
const std::string & ,
2244 FunctionName & l_value,
2245 const Real & r_value);
2248 void InputParameters::setParamHelper<FunctionName, int>(
const std::string & ,
2249 FunctionName & l_value,
2250 const int & r_value);
2253 void InputParameters::setParamHelper<MaterialPropertyName, Real>(
const std::string & ,
2254 MaterialPropertyName & l_value,
2255 const Real & r_value);
2258 void InputParameters::setParamHelper<MaterialPropertyName, int>(
const std::string & ,
2259 MaterialPropertyName & l_value,
2260 const int & r_value);
2263 void InputParameters::setParamHelper<MooseFunctorName, Real>(
const std::string & ,
2264 MooseFunctorName & l_value,
2265 const Real & r_value);
2268 void InputParameters::setParamHelper<MooseFunctorName, int>(
const std::string & ,
2269 MooseFunctorName & l_value,
2270 const int & r_value);
2272 template <
typename T>
2279 template <
typename T>
2286 pars.
mooseError(
"The parameter \"",
name,
"\" is being retrieved before being set.");
2295 const MooseEnum & InputParameters::getParamHelper<MooseEnum>(
const std::string &
name,
2300 InputParameters::getParamHelper<MultiMooseEnum>(
const std::string &
name,
2303 template <
typename R1,
typename R2,
typename V1,
typename V2>
2304 std::vector<std::pair<R1, R2>>
2310 const auto & v1 = get<V1>(param1);
2311 const auto & v2 = get<V2>(param2);
2314 if (controllable.count(param1) || controllable.count(param2))
2318 param2 +
" are controllable parameters and cannot be retireved using " 2319 "the MooseObject::getParam/InputParameters::get methods for pairs");
2321 if (v1.size() != v2.size())
2323 "Vector parameters ",
2330 ") are of different lengths \n");
2332 std::vector<std::pair<R1, R2>> parameter_pairs;
2333 auto i1 = v1.begin();
2334 auto i2 = v2.begin();
2335 for (; i1 != v1.end() && i2 != v2.end(); ++i1, ++i2)
2336 parameter_pairs.emplace_back(std::make_pair(*i1, *i2));
2337 return parameter_pairs;
2342 template <
typename T>
2350 return have_parameter<T>(
name);
2353 template <
typename T>
2359 return Parameters::get<T>(
name);
2362 template <
typename T>
2368 return Parameters::have_parameter<T>(
name);
2371 template <
typename T>
2374 const std::string & name_in,
2375 const std::string & new_name,
2376 const std::string & new_description)
2379 const auto p_name = new_name.empty() ? name_in : new_name;
2383 "' parameter could not be transferred because it does not exist with type '",
2384 MooseUtils::prettyCppType<T>(),
2385 "' in the source parameters");
2386 if (
name != name_in)
2387 mooseWarning(
"The transferred parameter " + name_in +
" is deprecated in favor of " +
name +
2388 " in the source parameters. The new name should likely be used for the parameter " 2389 "transfer instead.");
2390 const std::string description =
2399 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2400 addRequiredParam<T>(p_name, source_params.
get<T>(
name), description);
2402 addRequiredRangeCheckedParam<T>(
2405 addRequiredParam<T>(p_name, description);
2418 std::vector<Real> coupled_values;
2427 addRangeCheckedParam<T>(p_name,
2434 else if constexpr (std::is_same_v<MooseEnum, T> || std::is_same_v<MultiMooseEnum, T>)
2435 addParam<T>(p_name, source_params.
get<T>(
name), description);
2439 addParam<T>(p_name, source_params.
get<T>(
name), description);
2441 addParam<T>(p_name, description);
2447 _params[p_name]._is_private =
true;
2449 _params[p_name]._controllable =
true;
2452 template <
typename... Args>
2456 std::ostringstream oss;
2461 template <
typename... Args>
2465 std::ostringstream oss;
2470 template <
typename... Args>
2474 std::ostringstream oss;
2484 template <
typename T>
2491 #ifdef MOOSE_MFEM_ENABLED 2493 template <
typename T>
2497 return std::is_same_v<T, MFEMScalarCoefficientName> ||
2498 std::is_same_v<T, MFEMVectorCoefficientName>;
2501 template <
typename T,
typename A>
2510 template <
typename T>
2514 return std::is_same_v<T, MooseFunctorName>
2515 #ifdef MOOSE_MFEM_ENABLED 2516 || std::is_same_v<T, MFEMScalarCoefficientName>
2521 template <
typename T,
typename A>
2528 template <
typename T>
2532 #ifdef MOOSE_MFEM_ENABLED 2533 return std::is_same_v<T, MFEMVectorCoefficientName>;
2539 template <
typename T,
typename A>
2546 template <
typename T>
2555 template <
typename T>
2562 template <
typename T>
2566 auto numeric_value_type = []()
2569 Moose::internal::getNullptrExample<T>()))
2572 Moose::internal::getNullptrExample<T>()))
2573 return "numeric vector value (enclosed in curly braces)";
2576 mooseAssert(
false,
"We control instantiations of this method");
2581 return MooseUtils::trim(doc_string,
". ") +
". A functor is any of the following: a variable, " +
2583 #ifdef MOOSE_MFEM_ENABLED 2589 " 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...
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...
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.