#include <iomanip>
#include <memory>
+#include <type_traits>
#include <deal.II/differentiation/ad/sacado_product_types.h>
do_function_values (const ArrayView<Number> &dof_values,
const Table<2,double> &shape_values,
const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<typename std::remove_cv<Number>::type,double>::type> &values)
+ std::vector<typename ProductType<typename std::decay<Number>::type,double>::type> &values)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
shape_values.n_cols() : values.size();
AssertDimension (values.size(), n_quadrature_points);
- std::fill (values.begin(), values.end(), Number());
+ std::fill (values.begin(), values.end(), dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0));
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
if (shape_function_data[shape_function].is_nonzero_shape_function_component)
{
const Number &value = dof_values[shape_function];
- if (value == Number() )
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
const double *shape_value_ptr =
do_function_derivatives (const ArrayView<Number> &dof_values,
const Table<2,dealii::Tensor<order,spacedim> > &shape_derivatives,
const std::vector<typename Scalar<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::Tensor<order,spacedim> >::type> &derivatives)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::Tensor<order,spacedim> >::type> &derivatives)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
AssertDimension (derivatives.size(), n_quadrature_points);
std::fill (derivatives.begin(), derivatives.end(),
- typename ProductType<Number,dealii::Tensor<order,spacedim> >::type());
+ typename ProductType<typename std::decay<Number>::type,dealii::Tensor<order,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
if (shape_function_data[shape_function].is_nonzero_shape_function_component)
{
const Number &value = dof_values[shape_function];
- if (value == Number() )
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
const dealii::Tensor<order,spacedim> *shape_derivative_ptr =
if (shape_function_data[shape_function].is_nonzero_shape_function_component)
{
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
const dealii::Tensor<2,spacedim> *shape_hessian_ptr =
void do_function_values (const ArrayView<Number> &dof_values,
const Table<2,double> &shape_values,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::Tensor<1,spacedim> >::type> &values)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::Tensor<1,spacedim> >::type> &values)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
shape_values.n_cols() : values.size();
AssertDimension (values.size(), n_quadrature_points);
- std::fill (values.begin(), values.end(), typename ProductType<Number,dealii::Tensor<1,spacedim> >::type());
+ std::fill (values.begin(), values.end(), typename ProductType<typename std::decay<Number>::type,dealii::Tensor<1,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
do_function_derivatives (const ArrayView<Number> &dof_values,
const Table<2,dealii::Tensor<order,spacedim> > &shape_derivatives,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::Tensor<order+1,spacedim> >::type> &derivatives)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::Tensor<order+1,spacedim> >::type> &derivatives)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
AssertDimension (derivatives.size(), n_quadrature_points);
std::fill (derivatives.begin(), derivatives.end(),
- typename ProductType<Number,dealii::Tensor<order+1,spacedim> >::type());
+ typename ProductType<typename std::decay<Number>::type,dealii::Tensor<order+1,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
do_function_symmetric_gradients (const ArrayView<Number> &dof_values,
const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::SymmetricTensor<2,spacedim> >::type> &symmetric_gradients)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::SymmetricTensor<2,spacedim> >::type> &symmetric_gradients)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
AssertDimension (symmetric_gradients.size(), n_quadrature_points);
std::fill (symmetric_gradients.begin(), symmetric_gradients.end(),
- typename ProductType<Number,dealii::SymmetricTensor<2,spacedim> >::type());
+ typename ProductType<typename std::decay<Number>::type,dealii::SymmetricTensor<2,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
do_function_curls (const ArrayView<Number> &dof_values,
const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients,
const std::vector<typename Vector<dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,typename dealii::internal::CurlType<spacedim>::type>::type> &curls)
+ std::vector<typename ProductType<typename std::decay<Number>::type,typename dealii::internal::CurlType<spacedim>::type>::type> &curls)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
shape_gradients[0].size() : curls.size();
AssertDimension (curls.size(), n_quadrature_points);
- std::fill (curls.begin(), curls.end(), typename ProductType<Number,typename dealii::internal::CurlType<spacedim>::type>::type());
+ std::fill (curls.begin(), curls.end(),
+ typename ProductType<typename std::decay<Number>::type,typename dealii::internal::CurlType<spacedim>::type>::type());
switch (spacedim)
{
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
do_function_values (const ArrayView<Number> &dof_values,
const dealii::Table<2,double> &shape_values,
const std::vector<typename SymmetricTensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::SymmetricTensor<2,spacedim> >::type> &values)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::SymmetricTensor<2,spacedim> >::type> &values)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
AssertDimension (values.size(), n_quadrature_points);
std::fill (values.begin(), values.end(),
- typename ProductType<Number,dealii::SymmetricTensor<2,spacedim> >::type());
+ typename ProductType<typename std::decay<Number>::type,dealii::SymmetricTensor<2,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
do_function_values (const ArrayView<Number> &dof_values,
const dealii::Table<2,double> &shape_values,
const std::vector<typename Tensor<2,dim,spacedim>::ShapeFunctionData> &shape_function_data,
- std::vector<typename ProductType<Number,dealii::Tensor<2,spacedim> >::type> &values)
+ std::vector<typename ProductType<typename std::decay<Number>::type,dealii::Tensor<2,spacedim> >::type> &values)
{
const unsigned int dofs_per_cell = dof_values.size();
const unsigned int n_quadrature_points = dofs_per_cell > 0 ?
AssertDimension (values.size(), n_quadrature_points);
std::fill (values.begin(), values.end(),
- typename ProductType<Number,dealii::Tensor<2,spacedim> >::type());
+ typename ProductType<typename std::decay<Number>::type,dealii::Tensor<2,spacedim> >::type());
for (unsigned int shape_function=0;
shape_function<dofs_per_cell; ++shape_function)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
continue;
const Number &value = dof_values[shape_function];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (snc != -1)
AssertDimension(values.size(), n_quadrature_points);
// initialize with zero
- std::fill_n (values.begin(), n_quadrature_points, Number());
+ std::fill_n (values.begin(), n_quadrature_points, dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0));
// add up contributions of trial functions. note that here we deal with
// scalar finite elements, so no need to check for non-primitivity of
for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
{
const Number &value = dof_values_ptr[shape_func+mc*dofs_per_cell];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (fe.is_primitive(shape_func))
for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
{
const Number &value = dof_values_ptr[shape_func];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
const Tensor<order,spacedim> *shape_derivative_ptr
for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
{
const Number &value = dof_values_ptr[shape_func+mc*dofs_per_cell];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (fe.is_primitive(shape_func))
AssertDimension(laplacians.size(), n_quadrature_points);
// initialize with zero
- std::fill_n (laplacians.begin(), n_quadrature_points, Number());
+ std::fill_n (laplacians.begin(), n_quadrature_points, dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0));
// add up contributions of trial functions. note that here we deal with
// scalar finite elements and also note that the Laplacian is
for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
{
const Number &value = dof_values_ptr[shape_func+mc*dofs_per_cell];
- if (value == Number())
+ if (value == dealii::internal::NumberType<typename std::decay<Number>::type>::value(0.0))
continue;
if (fe.is_primitive(shape_func))