Skip to content

Commit

Permalink
Merge pull request #15944 from kronbichler/fix_warning
Browse files Browse the repository at this point in the history
Fix some additional warnings
  • Loading branch information
drwells committed Aug 30, 2023
2 parents b2819d6 + 299ee22 commit e45b1b2
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions source/base/tensor_product_polynomials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,20 +405,25 @@ namespace internal
if (update_grads)
{
grads[index][0] = value_outer[0] * val_x[1];
for (unsigned int d = 1; d < dim; ++d)
grads[index][d] = value_outer[d] * val_x[0];
if constexpr (dim > 1)
for (unsigned int d = 1; d < dim; ++d)
grads[index][d] = value_outer[d] * val_x[0];
}

if (update_grad_grads)
{
grad_grads[index][0][0] = value_outer[0] * val_x[2];
for (unsigned int d = 1; d < dim; ++d)
grad_grads[index][0][d] = grad_grads[index][d][0] =
value_outer[d] * val_x[1];
for (unsigned int d1 = 1, count = dim; d1 < dim; ++d1)
for (unsigned int d2 = d1; d2 < dim; ++d2, ++count)
grad_grads[index][d1][d2] = grad_grads[index][d2][d1] =
value_outer[count] * val_x[0];
if constexpr (dim > 1)
{
for (unsigned int d = 1; d < dim; ++d)
grad_grads[index][0][d] = grad_grads[index][d][0] =
value_outer[d] * val_x[1];
for (unsigned int d1 = 1, count = dim; d1 < dim; ++d1)
for (unsigned int d2 = d1; d2 < dim; ++d2, ++count)
grad_grads[index][d1][d2] =
grad_grads[index][d2][d1] =
value_outer[count] * val_x[0];
}
}
}

Expand Down Expand Up @@ -505,6 +510,9 @@ TensorProductPolynomials<dim, PolynomialType>::evaluate(
std::vector<Tensor<3, dim>> &third_derivatives,
std::vector<Tensor<4, dim>> &fourth_derivatives) const
{
if constexpr (dim == 0)
return;

Assert(dim <= 3, ExcNotImplemented());
Assert(values.size() == this->n() || values.empty(),
ExcDimensionMismatch2(values.size(), this->n(), 0));
Expand All @@ -530,15 +538,14 @@ TensorProductPolynomials<dim, PolynomialType>::evaluate(
if (fourth_derivatives.size() == this->n())
n_derivatives = 4;

// Compute the values (and derivatives, if necessary) of all 1d polynomials
// at this evaluation point. We can use the more optimized values_of_array
// function to compute 'dim' polynomials at once
// Compute the values (and derivatives, if necessary) of all 1d
// polynomials at this evaluation point. We can use the more optimized
// values_of_array function to compute 'dim' polynomials at once
const unsigned int n_polynomials = polynomials.size();
boost::container::small_vector<ndarray<double, 5, dim>, 10> values_1d(
n_polynomials);
if constexpr (std::is_same<PolynomialType,
dealii::Polynomials::Polynomial<double>>::value &&
dim > 0)
dealii::Polynomials::Polynomial<double>>::value)
{
std::array<double, dim> point_array;
for (unsigned int d = 0; d < dim; ++d)
Expand Down

0 comments on commit e45b1b2

Please sign in to comment.