25template <
int N,
bool is_ad = false,
int MaxD = 3>
30 const std::array<std::string, N> variables);
53 std::array<GenericMaterialProperty<Real, is_ad> *,
54 CompileTimeDerivativesMaterialInternal::total_derivatives<MaxD, N>()>
67 template <std::size_t... Ns>
69 const unsigned int & qp,
70 std::index_sequence<Ns...>)
72 return std::make_tuple(
73 CompileTimeDerivatives::makeRef<Ns>(coupledGenericValue<is_ad>(variables[Ns]), qp)...);
76 template <std::
size_t I>
80 template <std::size_t I, std::size_t first, std::size_t... tail>
84 if constexpr (is_sorted(int_seq))
86 _prop_dF[I] = &declarePropertyDerivative<Real, is_ad>(
88 loopDeclareProperties<I + 1>(details::increment<N>(int_seq));
91 loopDeclareProperties<I>(details::increment<N>(int_seq));
100 loopDeclareProperties<0>(zeroes<MaxD>());
103 template <std::
size_t I,
typename T>
107 template <std::size_t I,
typename T, std::size_t first, std::size_t... tail>
108 constexpr void loopEvaluate(
const T & expression, std::index_sequence<first, tail...> int_seq)
111 if constexpr (is_sorted(int_seq))
113 (*
_prop_dF[I])[
_qp] = take_derivatives(expression, int_seq)();
114 loopEvaluate<I + 1>(expression, details::increment<N>(int_seq));
117 loopEvaluate<I>(expression, details::increment<N>(int_seq));
121template <
int N,
bool is_ad,
int MaxD>
126 params.addRequiredParam<MaterialPropertyName>(
"property_name",
127 "Name of the parsed material property");
131template <
int N,
bool is_ad,
int MaxD>
133 const InputParameters & params,
const std::array<std::string, N> variables)
135 _F_name(getParam<MaterialPropertyName>(
"property_name")),
136 _prop_F(declareGenericProperty<Real, is_ad>(_F_name)),
137 _refs(makeRefsTuple(variables, _qp,
std::make_index_sequence<N>{}))
140 for (
const auto i : make_range(N))
141 _var_name[i] = coupledName(variables[i]);
147template <
int N,
bool is_ad,
int MaxD>
154 loopEvaluate<0>(F, zeroes<MaxD>());
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
Moose::GenericType< VariableValue, is_ad > GenericVariableValue
Material class to set up an expression and its derivatives built at compile time using the CompileTim...
void declareProperties()
Entry point for the compile time loop that declares all derivative material properties.
static InputParameters validParams()
std::array< GenericMaterialProperty< Real, is_ad > *, CompileTimeDerivativesMaterialInternal::total_derivatives< MaxD, N >()> _prop_dF
A serialized list of material properties for all derivatives up to and including order MaxD.
auto makeRefsTuple(const std::array< std::string, N > &variables, const unsigned int &qp, std::index_sequence< Ns... >)
constexpr void loopEvaluate(const T &expression, std::index_sequence< first, tail... > int_seq)
constexpr void loopDeclareProperties(std::index_sequence<>)
void evaluate(const T &F)
Entry point for the compile time loop that evaluates all derivatives and assigns them to their respec...
constexpr void loopDeclareProperties(std::index_sequence< first, tail... > int_seq)
const MaterialPropertyName _F_name
decltype(CompileTimeDerivativesMaterialInternal::make_tuple_array< GenericVariableValue< is_ad > >(std::make_index_sequence< N >{})) ::type _refs
Set up a tuple with one entry per coupled variable (each entry with an increment).
std::array< VariableName, N > _var_name
The names of the coupled variables.
CompileTimeDerivativesMaterial(const InputParameters ¶ms, const std::array< std::string, N > variables)
constexpr void loopEvaluate(const T &, std::index_sequence<>)
GenericMaterialProperty< Real, is_ad > & _prop_F
Interface class ("Veneer") to provide generator methods for derivative material property names.
Materials compute MaterialProperties.
const std::string & type() const
Get the type of this class.
constexpr auto make_tuple_array(std::index_sequence< Ns... >)
Create a tuple with sizeof...(Ns) entries, containing CTArrayRefs with tags given by the Ns....