return shape_function_to_row_table;
}
+
+ namespace
+ {
+ // Check to see if a DoF value is zero, implying that subsequent operations
+ // with the value have no effect.
+ template <typename Number, typename T = void>
+ struct CheckForZero
+ {
+ static bool
+ value (const Number &value)
+ {
+ return value == dealii::internal::NumberType<Number>::value(0.0);
+ }
+ };
+
+ // For auto-differentiable numbers, the fact that a DoF value is zero
+ // does not imply that its derivatives are zero as well. So we
+ // can't filter by value for these number types.
+ // Note that we also want to avoid actually checking the value itself,
+ // since some AD numbers are not contextually convertible to booleans.
+ template <typename Number>
+ struct CheckForZero<Number, typename std::enable_if<Differentiation::AD::is_ad_number<Number>::value>::type>
+ {
+ static bool
+ value (const Number &/*value*/)
+ {
+ return false;
+ }
+ };
+ }
}
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0) )
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
const double *shape_value_ptr =
&shape_values(shape_function_data[shape_function].row_index, 0);
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0) )
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
const dealii::Tensor<order,spacedim> *shape_derivative_ptr =
&shape_derivatives[shape_function_data[shape_function].row_index][0];
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
const dealii::Tensor<2,spacedim> *shape_hessian_ptr =
&shape_hessians[shape_function_data[shape_function].row_index][0];
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (snc != -1)
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (fe.is_primitive(shape_func))
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
const Tensor<order,spacedim> *shape_derivative_ptr
= &shape_derivatives[shape_func][0];
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (fe.is_primitive(shape_func))
{
// For auto-differentiable numbers, the fact that a DoF value is zero
// does not imply that its derivatives are zero as well. So we
// can't filter by value for these number types.
- if (!Differentiation::AD::is_ad_number<Number>::value)
- if (value == dealii::internal::NumberType<Number>::value(0.0))
- continue;
+ if (dealii::internal::CheckForZero<Number>::value(value) == true)
+ continue;
if (fe.is_primitive(shape_func))
{