16#include <unordered_set>
22template <
typename T,
bool is_ad,
bool is_functor = false,
typename RT = Real>
71template <
typename T,
bool is_ad,
bool is_functor,
typename RT>
76 if constexpr (is_functor)
79 params.
addRequiredParam<MaterialPropertyName>(
"property",
"The material property name.");
82 "factor", 1,
"The factor by which to multiply your material property for visualization");
83 params.
addParam<RT>(
"offset", 0,
"The offset to add to your material property for visualization");
85 if constexpr (!is_functor)
89 "Evaluate the material property at a specified quadrature point. This only needs "
90 "to be used if you are interested in a particular quadrature point in each element. "
91 "Otherwise do not include this parameter in your input file.");
98template <
typename T,
bool is_ad,
bool is_functor,
typename RT>
102 _prop(getPropertyHelper()),
103 _selected_qp(this->isParamValid(
"selected_qp")
104 ? this->template getParam<unsigned
int>(
"selected_qp")
106 _factor(this->template getParam<Real>(
"factor")),
107 _offset(this->template getParam<RT>(
"offset")),
108 _current_subdomain_id(this->_assembly.currentSubdomainID())
112template <
typename T,
bool is_ad,
bool is_functor,
typename RT>
116 if constexpr (is_functor)
119 return this->
template getGenericMaterialProperty<T, is_ad>(
"property");
122template <
typename T,
bool is_ad,
bool is_functor,
typename RT>
127 if constexpr (is_functor)
131 const std::set<SubdomainID> sub_id_set = {_current_subdomain_id};
133 const auto state = this->determineState();
134 _full_value = _prop(node_arg, state);
138 const auto elem_arg = this->makeElemArg(this->_current_elem);
139 const auto state = this->determineState();
140 _full_value = _prop(elem_arg, state);
148 if (_selected_qp >= this->_q_point.size())
151 this->paramError(
"selected_qp",
152 "Trying to evaluate qp ",
154 " but there are only ",
155 this->_q_point.size(),
156 " quadrature points in the element");
158 _full_value = _prop[_selected_qp];
161 _full_value = _prop[this->_qp];
165 return _factor * getRealValue() + _offset;
168template <
typename T = Real>
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
void ErrorVector unsigned int
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
static InputParameters validParams()
A base class for the various Material related AuxKernal objects.
const Real _factor
Multiplier for the material property.
Moose::GenericType< T, is_ad > _full_value
T Value evaluated from either the property or the functor.
const RT _offset
Value to be added to the material property.
virtual RT getRealValue()=0
Returns material property values at quadrature points.
const unsigned int _selected_qp
Evaluate at this quadrature point only.
virtual void checkFullValue()
Perform a sanity check on the retrieved value (e.g. to check dynamic sizes)
const SubdomainID & _current_subdomain_id
ID of the subdomain currently being iterated over.
const PropertyType & getPropertyHelper()
Helper function to retrieve the property or functor.
static InputParameters validParams()
const PropertyType & _prop
(Functor)Material property for this AuxKernel
virtual RT computeValue() override
Compute and return the value of the aux variable.
typename std::conditional< is_functor, Moose::Functor< Moose::GenericType< T, is_ad > >, GenericMaterialProperty< T, is_ad > >::type PropertyType
Functors really only work for Real and RealVectorValue for now :(.
MaterialAuxBaseTempl(const InputParameters ¶meters)
Class constructor.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
This is a wrapper that forwards calls to the implementation, which can be switched out at any time wi...
typename std::conditional< is_ad, typename ADType< T >::type, T >::type GenericType
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const unsigned int invalid_uint