22 template <
typename T,
bool is_ad>
29 const std::string & property_param =
"property",
30 const std::string & component_param =
"component");
64 template <
typename T,
bool is_ad>
69 params.template addRequiredParam<MaterialPropertyName>(
"property",
70 "The name of the material property");
71 params.template addParam<std::vector<unsigned int>>(
74 "Index vector of the scalar component to extract from " 75 "the material property (empty for scalar properties)");
79 template <
typename T,
bool is_ad>
81 const std::string & property_param,
82 const std::string & component_param)
84 _property_param(property_param),
85 _property_name(_host->template getParam<MaterialPropertyName>(_property_param)),
86 _component_param(component_param),
87 _component(host->template getParam<
std::vector<unsigned
int>>(_component_param)),
89 _host->template getGenericOptionalMaterialProperty<
Real, is_ad>(_property_param)),
91 _host->template getGenericOptionalMaterialProperty<
std::vector<
Real>, is_ad>(
93 _property_real_vector_value(
94 _host->template getGenericOptionalMaterialProperty<
RealVectorValue, is_ad>(
96 _property_rank_two_tensor(
97 _host->template getGenericOptionalMaterialProperty<
RankTwoTensor, is_ad>(_property_param)),
98 _property_rank_three_tensor(
99 _host->template getGenericOptionalMaterialProperty<
RankThreeTensor, is_ad>(
101 _property_rank_four_tensor(
102 _host->template getGenericOptionalMaterialProperty<
RankFourTensor, is_ad>(_property_param))
106 template <
typename T,
bool is_ad>
111 return _property_real[qp];
112 if (_property_std_vector)
113 return _property_std_vector[qp][_component[0]];
114 if (_property_real_vector_value)
115 return _property_real_vector_value[qp](_component[0]);
116 if (_property_rank_two_tensor)
117 return _property_rank_two_tensor[qp](_component[0], _component[1]);
118 if (_property_rank_three_tensor)
119 return _property_rank_three_tensor[qp](_component[0], _component[1], _component[2]);
120 if (_property_rank_four_tensor)
121 return _property_rank_four_tensor[qp](
122 _component[0], _component[1], _component[2], _component[3]);
123 _host->mooseError(
"internal error in IndexableProperty");
126 template <
typename T,
bool is_ad>
132 else if (_property_std_vector)
134 else if (_property_real_vector_value)
136 else if (_property_rank_two_tensor)
138 else if (_property_rank_three_tensor)
140 else if (_property_rank_four_tensor)
143 _host->mooseError(
"The ",
144 is_ad ?
"AD" :
"non-AD",
145 " material property '",
150 template <
typename T,
bool is_ad>
154 if (_component.size() != components)
155 _host->mooseError(
"Material property '",
159 "-dimensional, but an index vector of size ",
161 " was supplied to select a component. It looks like you were expecting the " 162 "material property to have a different type.");
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
Moose::GenericType< Real, is_ad > GenericReal
const std::string & _component_param
name of the input parameter containing the component index
void checkComponents(unsigned int components) const
GenericReal< is_ad > operator[](int qp) const
get the selected component value for the given quadrature point
InputParameters validParams()
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
const GenericOptionalMaterialProperty< RankTwoTensor, is_ad > & _property_rank_two_tensor
const std::vector< unsigned int > _component
Index of the selected scalar component of the material property.
const std::string & _property_param
name of the input parameter containing the material property name
const GenericOptionalMaterialProperty< RankThreeTensor, is_ad > & _property_rank_three_tensor
IndexableProperty is a helper (proxy) object to obtain a scalar component from a material property...
const GenericOptionalMaterialProperty< std::vector< Real >, is_ad > & _property_std_vector
T * _host
pointer to the host object
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const GenericOptionalMaterialProperty< Real, is_ad > & _property_real
only one of those pointers will be non-null and pointing to the selected property ...
const std::string & _property_name
name of the coupled material property (for error reporting)
IndexableProperty(T *host, const std::string &property_param="property", const std::string &component_param="component")
const GenericOptionalMaterialProperty< RealVectorValue, is_ad > & _property_real_vector_value
void check() const
integrity check
void ErrorVector unsigned int
const GenericOptionalMaterialProperty< RankFourTensor, is_ad > & _property_rank_four_tensor