Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some additional warnings #15944

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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