--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+#ifndef dealii_matrix_free_evaluation_flags_h
+#define dealii_matrix_free_evaluation_flags_h
+
+#include <deal.II/base/config.h>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+
+
+/**
+ * @brief The namespace for the EvaluationFlags enum
+ *
+ * This namespace contains the enum EvaluationFlags used in FEEvaluation
+ * to control evaluation and integration of values, gradients, etc..
+ */
+namespace EvaluationFlags
+{
+ /**
+ * @brief The EvaluationFlags enum
+ *
+ * This enum contains a set of flags used by FEEvaluation::integrate(),
+ * FEEvaluation::evaluate() and others to determine if values, gradients,
+ * hessians, or a combination of them is being used.
+ */
+ enum EvaluationFlags
+ {
+ /**
+ * Do not use or compute anything.
+ */
+ nothing = 0,
+ /**
+ * Use or evaluate values.
+ */
+ values = 0x1,
+ /**
+ * Use or evaluate gradients.
+ */
+ gradients = 0x2,
+ /**
+ * Use or evaluate hessians.
+ */
+ hessians = 0x4
+ };
+
+
+ /**
+ * Global operator which returns an object in which all bits are set which are
+ * either set in the first or the second argument. This operator exists since
+ * if it did not then the result of the bit-or <tt>operator |</tt> would be an
+ * integer which would in turn trigger a compiler warning when we tried to
+ * assign it to an object of type UpdateFlags.
+ *
+ * @ref EvaluationFlags
+ */
+ inline EvaluationFlags
+ operator|(const EvaluationFlags f1, const EvaluationFlags f2)
+ {
+ return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) |
+ static_cast<unsigned int>(f2));
+ }
+
+
+
+ /**
+ * Global operator which sets the bits from the second argument also in the
+ * first one.
+ *
+ * @ref EvaluationFlags
+ */
+ inline EvaluationFlags &
+ operator|=(EvaluationFlags &f1, const EvaluationFlags f2)
+ {
+ f1 = f1 | f2;
+ return f1;
+ }
+
+
+ /**
+ * Global operator which returns an object in which all bits are set which are
+ * set in the first as well as the second argument. This operator exists since
+ * if it did not then the result of the bit-and <tt>operator &</tt> would be
+ * an integer which would in turn trigger a compiler warning when we tried to
+ * assign it to an object of type UpdateFlags.
+ *
+ * @ref EvaluationFlags
+ */
+ inline EvaluationFlags operator&(const EvaluationFlags f1,
+ const EvaluationFlags f2)
+ {
+ return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) &
+ static_cast<unsigned int>(f2));
+ }
+
+
+ /**
+ * Global operator which clears all the bits in the first argument if they are
+ * not also set in the second argument.
+ *
+ * @ref EvaluationFlags
+ */
+ inline EvaluationFlags &
+ operator&=(EvaluationFlags &f1, const EvaluationFlags f2)
+ {
+ f1 = f1 & f2;
+ return f1;
+ }
+
+} // namespace EvaluationFlags
+
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
#include <deal.II/base/vectorization.h>
#include <deal.II/matrix_free/dof_info.h>
+#include <deal.II/matrix_free/evaluation_flags.h>
#include <deal.II/matrix_free/shape_info.h>
#include <deal.II/matrix_free/tensor_product_kernels.h>
int dim,
int fe_degree,
int n_q_points_1d,
- int n_components,
typename Number>
struct FEEvaluationImpl
{
static void
- evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
const Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians);
+ Number * scratch_data);
static void
- integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool add_into_values_array);
};
int dim,
int fe_degree,
int n_q_points_1d,
- int n_components,
typename Number>
inline void
- FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, n_components, Number>::
- evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- const Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, Number>::evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ const Number * values_dofs_actual,
+ Number * values_quad,
+ Number * gradients_quad,
+ Number * hessians_quad,
+ Number * scratch_data)
{
- if (evaluate_values == false && evaluate_gradients == false &&
- evaluate_hessians == false)
+ if (evaluation_flag == EvaluationFlags::nothing)
return;
const EvaluatorVariant variant =
shape_info.n_q_points));
const int degree =
fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
- unsigned int count_p = 0, count_q = 0;
- for (int i = 0; i < (dim > 2 ? degree + 1 : 1); ++i)
- {
- for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
- {
- for (int k = 0; k < degree + 1 - j - i;
- ++k, ++count_p, ++count_q)
- for (unsigned int c = 0; c < n_components; ++c)
+ for (unsigned int c = 0; c < n_components; ++c)
+ for (int i = 0, count_p = 0, count_q = 0;
+ i < (dim > 2 ? degree + 1 : 1);
+ ++i)
+ {
+ for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
+ {
+ for (int k = 0; k < degree + 1 - j - i;
+ ++k, ++count_p, ++count_q)
values_dofs_tmp[c * dofs_per_comp + count_q] =
values_dofs_actual
[c * shape_info.dofs_per_component_on_cell + count_p];
- for (int k = degree + 1 - j - i; k < degree + 1; ++k, ++count_q)
- for (unsigned int c = 0; c < n_components; ++c)
+ for (int k = degree + 1 - j - i; k < degree + 1;
+ ++k, ++count_q)
values_dofs_tmp[c * dofs_per_comp + count_q] = Number();
- }
- for (int j = degree + 1 - i; j < degree + 1; ++j)
- for (int k = 0; k < degree + 1; ++k, ++count_q)
- for (unsigned int c = 0; c < n_components; ++c)
+ }
+ for (int j = degree + 1 - i; j < degree + 1; ++j)
+ for (int k = 0; k < degree + 1; ++k, ++count_q)
values_dofs_tmp[c * dofs_per_comp + count_q] = Number();
- }
- AssertDimension(count_q, dofs_per_comp);
+ }
values_dofs = values_dofs_tmp;
}
case 1:
for (unsigned int c = 0; c < n_components; c++)
{
- if (evaluate_values == true)
+ if (evaluation_flag & EvaluationFlags::values)
eval.template values<0, true, false>(values_dofs, values_quad);
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
eval.template gradients<0, true, false>(values_dofs,
gradients_quad);
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
eval.template hessians<0, true, false>(values_dofs,
hessians_quad);
for (unsigned int c = 0; c < n_components; c++)
{
// grad x
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
{
eval.template gradients<0, true, false>(values_dofs, temp1);
eval.template values<1, true, false>(temp1, gradients_quad);
}
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
{
// grad xy
- if (evaluate_gradients == false)
+ if (!(evaluation_flag & EvaluationFlags::gradients))
eval.template gradients<0, true, false>(values_dofs, temp1);
eval.template gradients<1, true, false>(temp1,
hessians_quad +
// grad y
eval.template values<0, true, false>(values_dofs, temp1);
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
eval.template gradients<1, true, false>(temp1,
gradients_quad +
n_q_points);
// grad yy
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
eval.template hessians<1, true, false>(temp1,
hessians_quad +
n_q_points);
// val: can use values applied in x
- if (evaluate_values == true)
+ if (evaluation_flag & EvaluationFlags::values)
eval.template values<1, true, false>(temp1, values_quad);
// advance to the next component in 1D array
case 3:
for (unsigned int c = 0; c < n_components; c++)
{
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
{
// grad x
eval.template gradients<0, true, false>(values_dofs, temp1);
eval.template values<2, true, false>(temp2, gradients_quad);
}
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
{
// grad xz
- if (evaluate_gradients == false)
+ if (!(evaluation_flag & EvaluationFlags::gradients))
{
eval.template gradients<0, true, false>(values_dofs,
temp1);
// grad y
eval.template values<0, true, false>(values_dofs, temp1);
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
{
eval.template gradients<1, true, false>(temp1, temp2);
eval.template values<2, true, false>(temp2,
n_q_points);
}
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
{
// grad yz
- if (evaluate_gradients == false)
+ if (!(evaluation_flag & EvaluationFlags::gradients))
eval.template gradients<1, true, false>(temp1, temp2);
eval.template gradients<2, true, false>(temp2,
hessians_quad +
// grad z: can use the values applied in x direction stored in
// temp1
eval.template values<1, true, false>(temp1, temp2);
- if (evaluate_gradients == true)
+ if (evaluation_flag & EvaluationFlags::gradients)
eval.template gradients<2, true, false>(temp2,
gradients_quad +
2 * n_q_points);
// grad zz: can use the values applied in x and y direction stored
// in temp2
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
eval.template hessians<2, true, false>(temp2,
hessians_quad +
2 * n_q_points);
// val: can use the values applied in x & y direction stored in
// temp2
- if (evaluate_values == true)
+ if (evaluation_flag & EvaluationFlags::values)
eval.template values<2, true, false>(temp2, values_quad);
// advance to the next component in 1D array
// case additional dof for FE_Q_DG0: add values; gradients and second
// derivatives evaluate to zero
if (type == MatrixFreeFunctions::tensor_symmetric_plus_dg0 &&
- evaluate_values)
+ (evaluation_flag & EvaluationFlags::values))
{
values_quad -= n_components * n_q_points;
values_dofs -= n_components * dofs_per_comp;
int dim,
int fe_degree,
int n_q_points_1d,
- int n_components,
typename Number>
inline void
- FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, n_components, Number>::
- integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
- const bool add_into_values_array)
+ FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, Number>::integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ Number * values_dofs_actual,
+ Number * values_quad,
+ Number * gradients_quad,
+ Number * scratch_data,
+ const bool add_into_values_array)
{
const EvaluatorVariant variant =
EvaluatorSelector<type, (fe_degree + n_q_points_1d > 4)>::variant;
case 1:
for (unsigned int c = 0; c < n_components; c++)
{
- if (integrate_values == true)
+ if (integration_flag & EvaluationFlags::values)
{
if (add_into_values_array == false)
eval.template values<0, false, false>(values_quad,
eval.template values<0, false, true>(values_quad,
values_dofs);
}
- if (integrate_gradients == true)
+ if (integration_flag & EvaluationFlags::gradients)
{
- if (integrate_values == true || add_into_values_array == true)
+ if (integration_flag & EvaluationFlags::values ||
+ add_into_values_array == true)
eval.template gradients<0, false, true>(gradients_quad,
values_dofs);
else
case 2:
for (unsigned int c = 0; c < n_components; c++)
{
- if (integrate_values == true && integrate_gradients == false)
+ if ((integration_flag & EvaluationFlags::values) &&
+ !(integration_flag & EvaluationFlags::gradients))
{
eval.template values<1, false, false>(values_quad, temp1);
if (add_into_values_array == false)
else
eval.template values<0, false, true>(temp1, values_dofs);
}
- if (integrate_gradients == true)
+ if (integration_flag & EvaluationFlags::gradients)
{
eval.template gradients<1, false, false>(gradients_quad +
n_q_points,
temp1);
- if (integrate_values)
+ if (integration_flag & EvaluationFlags::values)
eval.template values<1, false, true>(values_quad, temp1);
if (add_into_values_array == false)
eval.template values<0, false, false>(temp1, values_dofs);
case 3:
for (unsigned int c = 0; c < n_components; c++)
{
- if (integrate_values == true && integrate_gradients == false)
+ if ((integration_flag & EvaluationFlags::values) &&
+ !(integration_flag & EvaluationFlags::gradients))
{
eval.template values<2, false, false>(values_quad, temp1);
eval.template values<1, false, false>(temp1, temp2);
else
eval.template values<0, false, true>(temp2, values_dofs);
}
- if (integrate_gradients == true)
+ if (integration_flag & EvaluationFlags::gradients)
{
eval.template gradients<2, false, false>(gradients_quad +
2 * n_q_points,
temp1);
- if (integrate_values)
+ if (integration_flag & EvaluationFlags::values)
eval.template values<2, false, true>(values_quad, temp1);
eval.template values<1, false, false>(temp1, temp2);
eval.template values<2, false, false>(gradients_quad +
values_dofs -= n_components * dofs_per_comp -
shape_info.dofs_per_component_on_cell + 1;
values_quad -= n_components * n_q_points;
- if (integrate_values)
+ if (integration_flag & EvaluationFlags::values)
for (unsigned int c = 0; c < n_components; ++c)
{
values_dofs[0] = values_quad[0];
if (type == MatrixFreeFunctions::truncated_tensor)
{
values_dofs -= dofs_per_comp * n_components;
- unsigned int count_p = 0, count_q = 0;
- const int degree =
+ const int degree =
fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
- for (int i = 0; i < (dim > 2 ? degree + 1 : 1); ++i)
- {
- for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
- {
- for (int k = 0; k < degree + 1 - j - i;
- ++k, ++count_p, ++count_q)
- {
- for (unsigned int c = 0; c < n_components; ++c)
- values_dofs_actual
- [c * shape_info.dofs_per_component_on_cell + count_p] =
- values_dofs[c * dofs_per_comp + count_q];
- }
- count_q += j + i;
- }
- count_q += i * (degree + 1);
- }
- AssertDimension(count_q,
- Utilities::fixed_power<dim>(
- shape_info.data.front().fe_degree + 1));
+ for (unsigned int c = 0; c < n_components; ++c)
+ for (int i = 0, count_p = 0, count_q = 0;
+ i < (dim > 2 ? degree + 1 : 1);
+ ++i)
+ {
+ for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
+ {
+ for (int k = 0; k < degree + 1 - j - i;
+ ++k, ++count_p, ++count_q)
+ values_dofs_actual[c *
+ shape_info.dofs_per_component_on_cell +
+ count_p] =
+ values_dofs[c * dofs_per_comp + count_q];
+ count_q += j + i;
+ }
+ count_q += i * (degree + 1);
+ }
}
}
int dim,
int basis_size_1,
int basis_size_2,
- int n_components,
typename Number,
typename Number2>
struct FEEvaluationImplBasisChange
#endif
static void
do_forward(
+ const unsigned int n_components,
const AlignedVector<Number2> &transformation_matrix,
const Number * values_in,
Number * values_out,
next_dim,
basis_size_1,
basis_size_2,
- 1,
Number,
- Number2>::do_forward(transformation_matrix,
+ Number2>::do_forward(1,
+ transformation_matrix,
values_in +
(q - 1) *
Utilities::fixed_power<next_dim>(np_1),
#endif
static void
do_backward(
+ const unsigned int n_components,
const AlignedVector<Number2> &transformation_matrix,
const bool add_into_result,
Number * values_in,
next_dim,
basis_size_1,
basis_size_2,
- 1,
Number,
Number2>::
- do_backward(transformation_matrix,
+ do_backward(1,
+ transformation_matrix,
add_into_result,
values_in +
q * Utilities::fixed_power<next_dim>(np_2),
* the values_in array.
*/
static void
- do_mass(const AlignedVector<Number2> &transformation_matrix,
+ do_mass(const unsigned int n_components,
+ const AlignedVector<Number2> &transformation_matrix,
const AlignedVector<Number> & coefficients,
const Number * values_in,
Number * scratch_data,
next_dim,
basis_size_1,
basis_size_2,
- n_components,
Number,
- Number2>::do_forward(transformation_matrix,
+ Number2>::do_forward(n_components,
+ transformation_matrix,
values_in +
(q - 1) *
Utilities::pow(basis_size_1, dim - 1),
next_dim,
basis_size_1,
basis_size_2,
- n_components,
Number,
- Number2>::do_backward(transformation_matrix,
+ Number2>::do_backward(n_components,
+ transformation_matrix,
false,
my_scratch +
q * Utilities::pow(basis_size_2, dim - 1),
* evaluation, spectral collocation or simply collocation, meaning the same
* location for shape functions and evaluation space (quadrature points).
*/
- template <int dim, int fe_degree, int n_components, typename Number>
+ template <int dim, int fe_degree, typename Number>
struct FEEvaluationImplCollocation
{
static void
- evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
const Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians);
+ Number * scratch_data);
static void
- integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool add_into_values_array);
};
- template <int dim, int fe_degree, int n_components, typename Number>
+ template <int dim, int fe_degree, typename Number>
inline void
- FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::evaluate(
+ FEEvaluationImplCollocation<dim, fe_degree, Number>::evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
const Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number *,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *)
{
AssertDimension(
shape_info.data.front().shape_gradients_collocation_eo.size(),
for (unsigned int c = 0; c < n_components; c++)
{
- if (evaluate_values == true)
+ if (evaluation_flag & EvaluationFlags::values)
for (unsigned int i = 0; i < n_q_points; ++i)
values_quad[i] = values_dofs[i];
- if (evaluate_gradients == true || evaluate_hessians == true)
+ if (evaluation_flag &
+ (EvaluationFlags::gradients | EvaluationFlags::hessians))
{
eval.template gradients<0, true, false>(values_dofs,
gradients_quad);
gradients_quad +
2 * n_q_points);
}
- if (evaluate_hessians == true)
+ if (evaluation_flag & EvaluationFlags::hessians)
{
eval.template hessians<0, true, false>(values_dofs, hessians_quad);
if (dim > 1)
- template <int dim, int fe_degree, int n_components, typename Number>
+ template <int dim, int fe_degree, typename Number>
inline void
- FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::integrate(
+ FEEvaluationImplCollocation<dim, fe_degree, Number>::integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number *,
- const bool integrate_values,
- const bool integrate_gradients,
const bool add_into_values_array)
{
AssertDimension(
for (unsigned int c = 0; c < n_components; c++)
{
- if (integrate_values == true && add_into_values_array == false)
- for (unsigned int i = 0; i < n_q_points; ++i)
- values_dofs[i] = values_quad[i];
- else if (integrate_values == true)
- for (unsigned int i = 0; i < n_q_points; ++i)
- values_dofs[i] += values_quad[i];
- if (integrate_gradients == true)
+ if (integration_flag & EvaluationFlags::values)
{
- if (integrate_values == true || add_into_values_array == true)
+ if (add_into_values_array == false)
+ for (unsigned int i = 0; i < n_q_points; ++i)
+ values_dofs[i] = values_quad[i];
+ else
+ for (unsigned int i = 0; i < n_q_points; ++i)
+ values_dofs[i] += values_quad[i];
+ }
+ if (integration_flag & EvaluationFlags::gradients)
+ {
+ if (integration_flag & EvaluationFlags::values ||
+ add_into_values_array == true)
eval.template gradients<0, false, true>(gradients_quad,
values_dofs);
else
* the evaluation of the first and second derivatives in this transformed
* space, using the identity operation for the shape values.
*/
- template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+ template <int dim, int fe_degree, int n_q_points_1d, typename Number>
struct FEEvaluationImplTransformToCollocation
{
static void
- evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
const Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians);
+ Number * scratch_data);
static void
- integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool add_into_values_array);
};
- template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+ template <int dim, int fe_degree, int n_q_points_1d, typename Number>
inline void
FEEvaluationImplTransformToCollocation<
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ Number>::evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
const Number * values_dofs,
Number * values_quad,
Number *gradients_quad,
Number *hessians_quad,
- Number *,
- const bool,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *)
{
Assert(n_q_points_1d > fe_degree,
ExcMessage("You lose information when going to a collocation space "
dim,
(fe_degree >= n_q_points_1d ? n_q_points_1d : fe_degree + 1),
n_q_points_1d,
- 1,
Number,
- Number>::do_forward(shape_info.data.front().shape_values_eo,
+ Number>::do_forward(1,
+ shape_info.data.front().shape_values_eo,
values_dofs,
values_quad);
// apply derivatives in the collocation space
- if (evaluate_gradients == true || evaluate_hessians == true)
- FEEvaluationImplCollocation<dim, n_q_points_1d - 1, 1, Number>::
- evaluate(shape_info,
- values_quad,
- nullptr,
- gradients_quad,
- hessians_quad,
- nullptr,
- false,
- evaluate_gradients,
- evaluate_hessians);
+ if (evaluation_flag &
+ (EvaluationFlags::gradients | EvaluationFlags::hessians))
+ FEEvaluationImplCollocation<dim, n_q_points_1d - 1, Number>::evaluate(
+ 1,
+ evaluation_flag &
+ (EvaluationFlags::gradients | EvaluationFlags::hessians),
+ shape_info,
+ values_quad,
+ nullptr,
+ gradients_quad,
+ hessians_quad,
+ nullptr);
values_dofs += shape_info.dofs_per_component_on_cell;
values_quad += n_q_points;
- template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+ template <int dim, int fe_degree, int n_q_points_1d, typename Number>
inline void
FEEvaluationImplTransformToCollocation<
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ Number>::integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number *values_dofs,
Number *values_quad,
Number *gradients_quad,
Number *,
- const bool integrate_values,
- const bool integrate_gradients,
const bool add_into_values_array)
{
Assert(n_q_points_1d > fe_degree,
for (unsigned int c = 0; c < n_components; c++)
{
// apply derivatives in collocation space
- if (integrate_gradients == true)
- FEEvaluationImplCollocation<dim, n_q_points_1d - 1, 1, Number>::
- integrate(shape_info,
+ if (integration_flag & EvaluationFlags::gradients)
+ FEEvaluationImplCollocation<dim, n_q_points_1d - 1, Number>::
+ integrate(1,
+ integration_flag & EvaluationFlags::gradients,
+ shape_info,
values_quad,
nullptr,
gradients_quad,
nullptr,
- false,
- integrate_gradients,
- /*add_into_values_array=*/integrate_values);
+ /*add_into_values_array=*/integration_flag &
+ EvaluationFlags::values);
// transform back to the original space
FEEvaluationImplBasisChange<
dim,
(fe_degree >= n_q_points_1d ? n_q_points_1d : fe_degree + 1),
n_q_points_1d,
- 1,
Number,
- Number>::do_backward(shape_info.data.front().shape_values_eo,
+ Number>::do_backward(1,
+ shape_info.data.front().shape_values_eo,
add_into_values_array,
values_quad,
values_dofs);
/**
* This struct implements the action of the inverse mass matrix operation
*/
- template <int dim, int fe_degree, int n_components, typename Number>
+ template <int dim, int fe_degree, typename Number>
struct CellwiseInverseMassMatrixImpl
{
template <typename FEEvaluationType>
static void
- apply(const FEEvaluationType &fe_eval,
+ apply(const unsigned int n_components,
+ const FEEvaluationType &fe_eval,
const Number * in_array,
Number * out_array)
{
}
static void
- apply(const AlignedVector<Number> &inverse_shape,
+ apply(const unsigned int n_desired_components,
+ const AlignedVector<Number> &inverse_shape,
const AlignedVector<Number> &inverse_coefficients,
- const unsigned int n_desired_components,
const Number * in_array,
Number * out_array)
{
}
static void
- transform_from_q_points_to_basis(const AlignedVector<Number> &inverse_shape,
- const unsigned int n_desired_components,
- const Number * in_array,
- Number * out_array)
+ transform_from_q_points_to_basis(const unsigned int n_desired_components,
+ const AlignedVector<Number> &inverse_shape,
+ const Number * in_array,
+ Number * out_array)
{
constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
internal::EvaluatorTensorProduct<internal::evaluate_evenodd,
* This class serves as a fallback in case we don't have the appropriate
* template specialization for the run time and template parameters given.
*/
- template <int dim, int n_components, typename Number>
+ template <int dim, typename Number>
struct Default
{
static inline void
evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data)
{
internal::FEEvaluationImpl<
internal::MatrixFreeFunctions::tensor_general,
dim,
-1,
0,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
static inline void
integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array = false)
{
internal::FEEvaluationImpl<
dim,
-1,
0,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
};
* This class implements the actual choice of the template specialization.
*/
template <int dim,
- int n_components,
typename Number,
int DEPTH = 0,
int degree = 0,
int n_q_points_1d = 0,
class Enable = void>
- struct Factory : Default<dim, n_components, Number>
+ struct Factory : Default<dim, Number>
{};
/**
* which we want to determine the correct template parameters based at
* runtime.
*/
- template <int n_q_points_1d, int dim, int n_components, typename Number>
- struct Factory<dim, n_components, Number, 0, 10, n_q_points_1d>
- : Default<dim, n_components, Number>
+ template <int n_q_points_1d, int dim, typename Number>
+ struct Factory<dim, Number, 0, 10, n_q_points_1d> : Default<dim, Number>
{};
/**
* which we want to determine the correct template parameters based at
* runtime.
*/
- template <int degree,
- int n_q_points_1d,
- int dim,
- int n_components,
- typename Number>
+ template <int degree, int n_q_points_1d, int dim, typename Number>
struct Factory<dim,
- n_components,
Number,
1,
degree,
n_q_points_1d,
typename std::enable_if<n_q_points_1d == degree + 3>::type>
- : Default<dim, n_components, Number>
+ : Default<dim, Number>
{};
/**
* This class chooses the correct template degree.
*/
- template <int degree,
- int n_q_points_1d,
- int dim,
- int n_components,
- typename Number>
- struct Factory<dim, n_components, Number, 0, degree, n_q_points_1d>
+ template <int degree, int n_q_points_1d, int dim, typename Number>
+ struct Factory<dim, Number, 0, degree, n_q_points_1d>
{
static inline void
evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data)
{
const unsigned int runtime_degree = shape_info.data.front().fe_degree;
constexpr unsigned int start_n_q_points = degree + 1;
if (runtime_degree == degree)
- Factory<dim, n_components, Number, 1, degree, start_n_q_points>::
- evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ Factory<dim, Number, 1, degree, start_n_q_points>::evaluate(
+ n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
else
- Factory<dim, n_components, Number, 0, degree + 1, n_q_points_1d>::
- evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ Factory<dim, Number, 0, degree + 1, n_q_points_1d>::evaluate(
+ n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
}
static inline void
integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array = false)
{
const int runtime_degree = shape_info.data.front().fe_degree;
constexpr unsigned int start_n_q_points = degree + 1;
if (runtime_degree == degree)
- Factory<dim, n_components, Number, 1, degree, start_n_q_points>::
- integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ Factory<dim, Number, 1, degree, start_n_q_points>::integrate(
+ n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
else
- Factory<dim, n_components, Number, 0, degree + 1, n_q_points_1d>::
- integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ Factory<dim, Number, 0, degree + 1, n_q_points_1d>::integrate(
+ n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
}
};
* This class chooses the correct template n_q_points_1d after degree was
* chosen.
*/
- template <int degree,
- int n_q_points_1d,
- int dim,
- int n_components,
- typename Number>
+ template <int degree, int n_q_points_1d, int dim, typename Number>
struct Factory<dim,
- n_components,
Number,
1,
degree,
static inline void
evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data)
{
const int runtime_n_q_points_1d = shape_info.data.front().n_q_points_1d;
if (runtime_n_q_points_1d == n_q_points_1d)
if (n_q_points_1d == degree + 1 &&
shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_collocation)
- internal::
- FEEvaluationImplCollocation<dim, degree, n_components, Number>::
- evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ internal::FEEvaluationImplCollocation<dim, degree, Number>::
+ evaluate(n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
else if (use_collocation)
internal::FEEvaluationImplTransformToCollocation<
dim,
degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
else
internal::FEEvaluationImpl<
internal::MatrixFreeFunctions::tensor_symmetric,
dim,
degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else
- Factory<dim, n_components, Number, 1, degree, n_q_points_1d + 1>::
- evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ Factory<dim, Number, 1, degree, n_q_points_1d + 1>::evaluate(
+ n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
}
static inline void
integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array)
{
const int runtime_n_q_points_1d = shape_info.data.front().n_q_points_1d;
if (n_q_points_1d == degree + 1 &&
shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_collocation)
- internal::
- FEEvaluationImplCollocation<dim, degree, n_components, Number>::
- integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ internal::FEEvaluationImplCollocation<dim, degree, Number>::
+ integrate(n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
else if (use_collocation)
internal::FEEvaluationImplTransformToCollocation<
dim,
degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
else
internal::FEEvaluationImpl<
dim,
degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else
- Factory<dim, n_components, Number, 1, degree, n_q_points_1d + 1>::
- integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ Factory<dim, Number, 1, degree, n_q_points_1d + 1>::integrate(
+ n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
}
};
* This is the entry point for choosing the correct runtime parameters
* for the 'evaluate' function.
*/
- template <int dim, int n_components, typename Number>
+ template <int dim, typename Number>
void
symmetric_selector_evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data)
{
Assert(shape_info.element_type <=
internal::MatrixFreeFunctions::tensor_symmetric,
ExcInternalError());
- Factory<dim, n_components, Number>::evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ Factory<dim, Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
}
* This is the entry point for choosing the correct runtime parameters
* for the 'integrate' function.
*/
- template <int dim, int n_components, typename Number>
+ template <int dim, typename Number>
void
symmetric_selector_integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array = false)
{
Assert(shape_info.element_type <=
internal::MatrixFreeFunctions::tensor_symmetric,
ExcInternalError());
- Factory<dim, n_components, Number>::integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ Factory<dim, Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
}
} // namespace EvaluationSelectorImplementation
} // namespace internal
* $0\leq fe\_degree \leq 9$ and $degree+1\leq n\_q\_points\_1d\leq
* fe\_degree+2$.
*/
-template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
struct SelectEvaluator
{
/**
* appropriate template parameters.
*/
static void
- evaluate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians);
+ evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data);
/**
* Chooses an appropriate evaluation strategy for the integrate function, i.e.
* appropriate template parameters.
*/
static void
- integrate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array = false);
};
* $degree+1\leq n\_q\_points\_1d\leq fe\_degree+2$, a non-optimized fallback
* is used.
*/
-template <int dim, int n_q_points_1d, int n_components, typename Number>
-struct SelectEvaluator<dim, -1, n_q_points_1d, n_components, Number>
+template <int dim, int n_q_points_1d, typename Number>
+struct SelectEvaluator<dim, -1, n_q_points_1d, Number>
{
/**
* Based on the run time parameters stored in @p shape_info this function
* appropriate template parameters.
*/
static void
- evaluate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
- Number * values_dofs_actual,
- Number * values_quad,
- Number * gradients_quad,
- Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians);
+ evaluate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
+ const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ Number *values_dofs_actual,
+ Number *values_quad,
+ Number *gradients_quad,
+ Number *hessians_quad,
+ Number *scratch_data);
/**
* Based on the run time parameters stored in @p shape_info this function
* appropriate template parameters.
*/
static void
- integrate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+ integrate(const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
+ const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array = false);
};
//----------------------Implementation for SelectEvaluator---------------------
#ifndef DOXYGEN
-template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
inline void
-SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
+SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number * scratch_data)
{
Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_collocation)
{
- internal::
- FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::
- evaluate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ internal::FEEvaluationImplCollocation<dim, fe_degree, Number>::evaluate(
+ n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
}
// '<=' on type means tensor_symmetric or tensor_symmetric_hermite, see
// shape_info.h for more details
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type <=
internal::MatrixFreeFunctions::tensor_symmetric)
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_plus_dg0)
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type ==
internal::MatrixFreeFunctions::truncated_tensor)
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_general)
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else
AssertThrow(false, ExcNotImplemented());
-template <int dim,
- int fe_degree,
- int n_q_points_1d,
- int n_components,
- typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
inline void
-SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
+SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array)
{
Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_collocation)
{
- internal::
- FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::
- integrate(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ internal::FEEvaluationImplCollocation<dim, fe_degree, Number>::integrate(
+ n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
}
// '<=' on type means tensor_symmetric or tensor_symmetric_hermite, see
// shape_info.h for more details
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type <=
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type ==
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type ==
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type ==
dim,
fe_degree,
n_q_points_1d,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else
-template <int dim, int dummy, int n_components, typename Number>
+template <int dim, int dummy, typename Number>
inline void
-SelectEvaluator<dim, -1, dummy, n_components, Number>::evaluate(
+SelectEvaluator<dim, -1, dummy, Number>::evaluate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags evaluation_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * hessians_quad,
- Number * scratch_data,
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ Number * scratch_data)
{
if (shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_plus_dg0)
dim,
-1,
0,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type ==
internal::MatrixFreeFunctions::truncated_tensor)
dim,
-1,
0,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
}
else if (shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_general)
dim,
-1,
0,
- n_components,
- Number>::evaluate(shape_info,
+ Number>::evaluate(n_components,
+ evaluation_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ scratch_data);
else
internal::EvaluationSelectorImplementation::
- symmetric_selector_evaluate<dim, n_components, Number>(shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- hessians_quad,
- scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ symmetric_selector_evaluate<dim, Number>(n_components,
+ evaluation_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ hessians_quad,
+ scratch_data);
}
-template <int dim, int dummy, int n_components, typename Number>
+template <int dim, int dummy, typename Number>
inline void
-SelectEvaluator<dim, -1, dummy, n_components, Number>::integrate(
+SelectEvaluator<dim, -1, dummy, Number>::integrate(
+ const unsigned int n_components,
+ const EvaluationFlags::EvaluationFlags integration_flag,
const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
Number * values_dofs_actual,
Number * values_quad,
Number * gradients_quad,
Number * scratch_data,
- const bool integrate_values,
- const bool integrate_gradients,
const bool sum_into_values_array)
{
if (shape_info.element_type ==
dim,
-1,
0,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type ==
dim,
-1,
0,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
}
else if (shape_info.element_type ==
dim,
-1,
0,
- n_components,
- Number>::integrate(shape_info,
+ Number>::integrate(n_components,
+ integration_flag,
+ shape_info,
values_dofs_actual,
values_quad,
gradients_quad,
scratch_data,
- integrate_values,
- integrate_gradients,
sum_into_values_array);
else
internal::EvaluationSelectorImplementation::
- symmetric_selector_integrate<dim, n_components, Number>(
- shape_info,
- values_dofs_actual,
- values_quad,
- gradients_quad,
- scratch_data,
- integrate_values,
- integrate_gradients,
- sum_into_values_array);
+ symmetric_selector_integrate<dim, Number>(n_components,
+ integration_flag,
+ shape_info,
+ values_dofs_actual,
+ values_quad,
+ gradients_quad,
+ scratch_data,
+ sum_into_values_array);
}
#endif // DOXYGEN
#include <deal.II/lac/vector_operation.h>
+#include <deal.II/matrix_free/evaluation_flags.h>
#include <deal.II/matrix_free/evaluation_kernels.h>
#include <deal.II/matrix_free/evaluation_selector.h>
#include <deal.II/matrix_free/mapping_data_on_the_fly.h>
class FEEvaluation;
-/**
- * @brief The namespace for the EvaluationFlags enum
- *
- * This namespace contains the enum EvaluationFlags used in FEEvaluation
- * to control evaluation and integration of values, gradients, etc..
- */
-namespace EvaluationFlags
-{
- /**
- * @brief The EvaluationFlags enum
- *
- * This enum contains a set of flags used by FEEvaluation::integrate(),
- * FEEvaluation::evaluate() and others to determine if values, gradients,
- * hessians, or a combination of them is being used.
- */
- enum EvaluationFlags
- {
- /**
- * Do not use or compute anything.
- */
- nothing = 0,
- /**
- * Use or evaluate values.
- */
- values = 0x1,
- /**
- * Use or evaluate gradients.
- */
- gradients = 0x2,
- /**
- * Use or evaluate hessians.
- */
- hessians = 0x4
- };
-
-
- /**
- * Global operator which returns an object in which all bits are set which are
- * either set in the first or the second argument. This operator exists since
- * if it did not then the result of the bit-or <tt>operator |</tt> would be an
- * integer which would in turn trigger a compiler warning when we tried to
- * assign it to an object of type UpdateFlags.
- *
- * @ref EvaluationFlags
- */
- inline EvaluationFlags
- operator|(const EvaluationFlags f1, const EvaluationFlags f2)
- {
- return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) |
- static_cast<unsigned int>(f2));
- }
-
-
-
- /**
- * Global operator which sets the bits from the second argument also in the
- * first one.
- *
- * @ref EvaluationFlags
- */
- inline EvaluationFlags &
- operator|=(EvaluationFlags &f1, const EvaluationFlags f2)
- {
- f1 = f1 | f2;
- return f1;
- }
-
-
- /**
- * Global operator which returns an object in which all bits are set which are
- * set in the first as well as the second argument. This operator exists since
- * if it did not then the result of the bit-and <tt>operator &</tt> would be
- * an integer which would in turn trigger a compiler warning when we tried to
- * assign it to an object of type UpdateFlags.
- *
- * @ref EvaluationFlags
- */
- inline EvaluationFlags operator&(const EvaluationFlags f1,
- const EvaluationFlags f2)
- {
- return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) &
- static_cast<unsigned int>(f2));
- }
-
-
- /**
- * Global operator which clears all the bits in the first argument if they are
- * not also set in the second argument.
- *
- * @ref EvaluationFlags
- */
- inline EvaluationFlags &
- operator&=(EvaluationFlags &f1, const EvaluationFlags f2)
- {
- f1 = f1 & f2;
- return f1;
- }
-
-} // namespace EvaluationFlags
/**
* This is the base class for the FEEvaluation classes. This class is a base
/**
* Return the value of a finite element function at quadrature point number
- * @p q_point after a call to @p evaluate() with EvaluationFlags::value set, or the value that has
- * been stored there with a call to @p submit_value. If the object is
+ * @p q_point after a call to FEEvaluation::evaluate() with
+ * EvaluationFlags::value set, or the value that has been stored there with
+ * a call to FEEvaluationBase::submit_value(). If the object is
* vector-valued, a vector-valued return argument is given. Note that when
* vectorization is enabled, values from several cells are grouped together.
*
/**
* Write a value to the field containing the values on quadrature points
- * with component @p q_point. Access to the same field as through @p
- * get_value. If applied before the function @p integrate() with EvaluationFlags::values set is
- * called, this specifies the value which is tested by all basis function on
- * the current cell and integrated over.
+ * with component @p q_point. Access to the same field as through
+ * get_value(). If applied before the function FEEvaluation::integrate()
+ * with EvaluationFlags::values set is called, this specifies the value
+ * which is tested by all basis function on the current cell and integrated
+ * over.
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
/**
* Return the gradient of a finite element function at quadrature point
- * number @p q_point after a call to @p evaluate() with EvaluationFlags::gradients, or the value
- * that has been stored there with a call to @p submit_gradient.
+ * number @p q_point after a call to FEEvaluation::evaluate() with
+ * EvaluationFlags::gradients, or the value that has been stored there with
+ * a call to FEEvaluationBase::submit_gradient().
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
/**
* Return the derivative of a finite element function at quadrature point
- * number @p q_point after a call to @p evaluate(...,true,...) in the
- * direction normal to the face:
- * $\boldsymbol \nabla u(\mathbf x_q) \cdot \mathbf n(\mathbf x_q)$
+ * number @p q_point after a call to
+ * FEEvaluation::evaluate(EvaluationFlags::gradients) the direction normal
+ * to the face: $\boldsymbol \nabla u(\mathbf x_q) \cdot \mathbf n(\mathbf
+ * x_q)$
*
- * This call is equivalent to calling `get_gradient() * get_normal_vector()`
+ * This call is equivalent to calling get_gradient() * get_normal_vector()
* but will use a more efficient internal representation of data.
*
* Note that the derived class FEEvaluationAccess overloads this operation
/**
* Write a contribution that is tested by the gradient to the field
* containing the values on quadrature points with component @p q_point.
- * Access to the same field as through get_gradient(). If applied before
- * the function @p integrate(...,true) is called, this specifies what is
- * tested by all basis function gradients on the current cell and integrated
- * over.
+ * Access to the same field as through get_gradient(). If applied before the
+ * function FEEvaluation::integrate(EvaluationFlags::gradients) is called,
+ * this specifies what is tested by all basis function gradients on the
+ * current cell and integrated over.
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
* Write a contribution that is tested by the gradient to the field
* containing the values on quadrature points with component @p
* q_point. Access to the same field as through get_gradient() or
- * get_normal_derivative(). If applied before the function @p
- * integrate(...,true) is called, this specifies what is tested by all basis
- * function gradients on the current cell and integrated over.
+ * get_normal_derivative(). If applied before the function
+ * FEEvaluation::integrate(EvaluationFlags::gradients) is called, this
+ * specifies what is tested by all basis function gradients on the current
+ * cell and integrated over.
*
* @note This operation writes the data to the same field as
* submit_gradient(). As a consequence, only one of these two can be
/**
* Return the Hessian of a finite element function at quadrature point
- * number @p q_point after a call to @p evaluate(...,true). If only the
- * diagonal or even the trace of the Hessian, the Laplacian, is needed, use
- * the other functions below.
+ * number @p q_point after a call to
+ * FEEvaluation::evaluate(EvaluationFlags::hessians). If only the diagonal
+ * or even the trace of the Hessian, the Laplacian, is needed, use the other
+ * functions below.
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
/**
* Return the diagonal of the Hessian of a finite element function at
- * quadrature point number @p q_point after a call to @p evaluate(...,true).
+ * quadrature point number @p q_point after a call to
+ * FEEvaluation::evaluate(EvaluationFlags::hessians).
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
get_hessian_diagonal(const unsigned int q_point) const;
/**
- * Return the Laplacian (i.e., the trace of the Hessian) of a finite
- * element function at quadrature point number @p q_point after a call to @p
- * evaluate(...,true). Compared to the case when computing the full Hessian,
- * some operations can be saved when only the Laplacian is requested.
+ * Return the Laplacian (i.e., the trace of the Hessian) of a finite element
+ * function at quadrature point number @p q_point after a call to
+ * FEEvaluation::evaluate(EvaluationFlags::hessians). Compared to the case
+ * when computing the full Hessian, some operations can be saved when only
+ * the Laplacian is requested.
*
* Note that the derived class FEEvaluationAccess overloads this operation
* with specializations for the scalar case (n_components == 1) and for the
const bool evaluate_gradients,
const bool evaluate_hessians)
{
- SelectEvaluator<
- dim,
- fe_degree,
- n_q_points_1d,
- n_components,
- VectorizedArrayType>::evaluate(*this->data,
- const_cast<VectorizedArrayType *>(
- values_array),
- this->values_quad,
- this->gradients_quad,
- this->hessians_quad,
- this->scratch_data,
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ const EvaluationFlags::EvaluationFlags flag =
+ ((evaluate_values) ? EvaluationFlags::values : EvaluationFlags::nothing) |
+ ((evaluate_gradients) ? EvaluationFlags::gradients :
+ EvaluationFlags::nothing) |
+ ((evaluate_hessians) ? EvaluationFlags::hessians :
+ EvaluationFlags::nothing);
-# ifdef DEBUG
- if (evaluate_values == true)
- this->values_quad_initialized = true;
- if (evaluate_gradients == true)
- this->gradients_quad_initialized = true;
- if (evaluate_hessians == true)
- this->hessians_quad_initialized = true;
-# endif
+ evaluate(values_array, flag);
}
evaluate(const VectorizedArrayType * values_array,
const EvaluationFlags::EvaluationFlags evaluation_flags)
{
- SelectEvaluator<dim,
- fe_degree,
- n_q_points_1d,
- n_components,
- VectorizedArrayType>::
- evaluate(*this->data,
- const_cast<VectorizedArrayType *>(values_array),
- this->values_quad,
- this->gradients_quad,
- this->hessians_quad,
- this->scratch_data,
- evaluation_flags & EvaluationFlags::values,
- evaluation_flags & EvaluationFlags::gradients,
- evaluation_flags & EvaluationFlags::hessians);
+ SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::evaluate(
+ n_components,
+ evaluation_flags,
+ *this->data,
+ const_cast<VectorizedArrayType *>(values_array),
+ this->values_quad,
+ this->gradients_quad,
+ this->hessians_quad,
+ this->scratch_data);
# ifdef DEBUG
if (evaluation_flags & EvaluationFlags::values)
n_components_,
Number,
VectorizedArrayType>::gather_evaluate(const VectorType &input_vector,
-
- const bool evaluate_values,
- const bool evaluate_gradients,
- const bool evaluate_hessians)
+ const bool evaluate_values,
+ const bool evaluate_gradients,
+ const bool evaluate_hessians)
{
const EvaluationFlags::EvaluationFlags flag =
((evaluate_values) ? EvaluationFlags::values : EvaluationFlags::nothing) |
[this->first_selected_component] *
VectorizedArrayType::size());
- evaluate(vec_values,
- evaluation_flag & EvaluationFlags::values,
- evaluation_flag & EvaluationFlags::gradients,
- evaluation_flag & EvaluationFlags::hessians);
+ evaluate(vec_values, evaluation_flag);
}
else
{
this->read_dof_values(input_vector);
- evaluate(this->begin_dof_values(),
- evaluation_flag & EvaluationFlags::values,
- evaluation_flag & EvaluationFlags::gradients,
- evaluation_flag & EvaluationFlags::hessians);
+ evaluate(this->begin_dof_values(), evaluation_flag);
}
}
const bool integrate_gradients,
VectorizedArrayType *values_array)
{
-# ifdef DEBUG
- if (integrate_values == true)
- Assert(this->values_quad_submitted == true,
- internal::ExcAccessToUninitializedField());
- if (integrate_gradients == true)
- Assert(this->gradients_quad_submitted == true,
- internal::ExcAccessToUninitializedField());
-# endif
- Assert(this->matrix_info != nullptr ||
- this->mapped_geometry->is_initialized(),
- ExcNotInitialized());
-
- SelectEvaluator<dim,
- fe_degree,
- n_q_points_1d,
- n_components,
- VectorizedArrayType>::integrate(*this->data,
- values_array,
- this->values_quad,
- this->gradients_quad,
- this->scratch_data,
- integrate_values,
- integrate_gradients,
- false);
-
-# ifdef DEBUG
- this->dof_values_initialized = true;
-# endif
+ EvaluationFlags::EvaluationFlags flag =
+ (integrate_values ? EvaluationFlags::values : EvaluationFlags::nothing) |
+ (integrate_gradients ? EvaluationFlags::gradients :
+ EvaluationFlags::nothing);
+ integrate(flag, values_array);
}
ExcMessage(
"Only EvaluationFlags::values and EvaluationFlags::gradients are supported."));
- SelectEvaluator<dim,
- fe_degree,
- n_q_points_1d,
- n_components,
- VectorizedArrayType>::integrate(*this->data,
- values_array,
- this->values_quad,
- this->gradients_quad,
- this->scratch_data,
- integration_flag &
- EvaluationFlags::values,
- integration_flag &
- EvaluationFlags::gradients,
- false);
+ SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+ integrate(n_components,
+ integration_flag,
+ *this->data,
+ values_array,
+ this->values_quad,
+ this->gradients_quad,
+ this->scratch_data,
+ false);
# ifdef DEBUG
this->dof_values_initialized = true;
n_components_,
Number,
VectorizedArrayType>::
- integrate_scatter(const EvaluationFlags::EvaluationFlags evaluation_flag,
+ integrate_scatter(const EvaluationFlags::EvaluationFlags integration_flag,
VectorType & destination)
{
// If the index storage is interleaved and contiguous and the vector storage
->component_dof_indices_offset[this->active_fe_index]
[this->first_selected_component] *
VectorizedArrayType::size());
- SelectEvaluator<
- dim,
- fe_degree,
- n_q_points_1d,
- n_components,
- VectorizedArrayType>::integrate(*this->data,
- vec_values,
- this->values_quad,
- this->gradients_quad,
- this->scratch_data,
- evaluation_flag &
- EvaluationFlags::values,
- evaluation_flag &
- EvaluationFlags::gradients,
- true);
+ SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+ integrate(n_components,
+ integration_flag,
+ *this->data,
+ vec_values,
+ this->values_quad,
+ this->gradients_quad,
+ this->scratch_data,
+ true);
}
else
{
- integrate(evaluation_flag & EvaluationFlags::values,
- evaluation_flag & EvaluationFlags::gradients,
- this->begin_dof_values());
+ integrate(integration_flag, this->begin_dof_values());
this->distribute_local_to_global(destination);
}
}
start_indices,
cell_points.data());
- SelectEvaluator<dim, -1, 0, dim, VectorizedDouble>::evaluate(
+ SelectEvaluator<dim, -1, 0, VectorizedDouble>::evaluate(
+ dim,
+ EvaluationFlags::values | EvaluationFlags::gradients |
+ (update_flags_cells & update_jacobian_grads ?
+ EvaluationFlags::hessians :
+ EvaluationFlags::nothing),
shape_info,
cell_points.data(),
cell_quads.data(),
cell_grads.data(),
cell_grad_grads.data(),
- scratch_data.data(),
- true,
- true,
- update_flags_cells & update_jacobian_grads);
+ scratch_data.data());
}
if (update_flags_cells & update_quadrature_points)
{
VectorizedArrayType>::apply(const VectorizedArrayType *in_array,
VectorizedArrayType * out_array) const
{
- internal::CellwiseInverseMassMatrixImpl<
- dim,
- fe_degree,
- n_components,
- VectorizedArrayType>::apply(fe_eval, in_array, out_array);
+ internal::
+ CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::apply(
+ n_components, fe_eval, in_array, out_array);
}
const VectorizedArrayType * in_array,
VectorizedArrayType * out_array) const
{
- internal::CellwiseInverseMassMatrixImpl<dim,
- fe_degree,
- n_components,
- VectorizedArrayType>::
- apply(fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
- inverse_coefficients,
- n_actual_components,
- in_array,
- out_array);
+ internal::
+ CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::apply(
+ n_actual_components,
+ fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+ inverse_coefficients,
+ in_array,
+ out_array);
}
const VectorizedArrayType *in_array,
VectorizedArrayType * out_array) const
{
- internal::CellwiseInverseMassMatrixImpl<dim,
- fe_degree,
- n_components,
- VectorizedArrayType>::
- transform_from_q_points_to_basis(
- fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
- n_actual_components,
- in_array,
- out_array);
+ internal::
+ CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::
+ transform_from_q_points_to_basis(
+ n_actual_components,
+ fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+ in_array,
+ out_array);
}
constexpr unsigned int n_comp = 1 + (spacedim - 1) / n_lanes;
constexpr unsigned int n_hessians = (dim * (dim + 1)) / 2;
- const bool evaluate_values = update_flags & update_quadrature_points;
- const bool evaluate_gradients =
- (cell_similarity != CellSimilarity::translation) &&
- (update_flags & update_contravariant_transformation);
- const bool evaluate_hessians =
- (cell_similarity != CellSimilarity::translation) &&
- (update_flags & update_jacobian_grads);
-
- Assert(!evaluate_values || n_q_points > 0, ExcInternalError());
- Assert(!evaluate_values || n_q_points == quadrature_points.size(),
+ EvaluationFlags::EvaluationFlags evaluation_flag =
+ (update_flags & update_quadrature_points ? EvaluationFlags::values :
+ EvaluationFlags::nothing) |
+ ((cell_similarity != CellSimilarity::translation) &&
+ (update_flags & update_contravariant_transformation) ?
+ EvaluationFlags::gradients :
+ EvaluationFlags::nothing) |
+ ((cell_similarity != CellSimilarity::translation) &&
+ (update_flags & update_jacobian_grads) ?
+ EvaluationFlags::hessians :
+ EvaluationFlags::nothing);
+
+ Assert(!(evaluation_flag & EvaluationFlags::values) || n_q_points > 0,
+ ExcInternalError());
+ Assert(!(evaluation_flag & EvaluationFlags::values) ||
+ n_q_points == quadrature_points.size(),
ExcDimensionMismatch(n_q_points, quadrature_points.size()));
- Assert(!evaluate_gradients || data.n_shape_functions > 0,
+ Assert(!(evaluation_flag & EvaluationFlags::gradients) ||
+ data.n_shape_functions > 0,
ExcInternalError());
- Assert(!evaluate_gradients || n_q_points == data.contravariant.size(),
+ Assert(!(evaluation_flag & EvaluationFlags::gradients) ||
+ n_q_points == data.contravariant.size(),
ExcDimensionMismatch(n_q_points, data.contravariant.size()));
- Assert(!evaluate_hessians || n_q_points == jacobian_grads.size(),
+ Assert(!(evaluation_flag & EvaluationFlags::hessians) ||
+ n_q_points == jacobian_grads.size(),
ExcDimensionMismatch(n_q_points, jacobian_grads.size()));
// shortcut in case we have an identity interpolation and only request
// the quadrature points
- if (evaluate_values && !evaluate_gradients & !evaluate_hessians &&
+ if (evaluation_flag == EvaluationFlags::values &&
data.shape_info.element_type ==
internal::MatrixFreeFunctions::tensor_symmetric_collocation)
{
}
// prepare arrays
- if (evaluate_values || evaluate_gradients || evaluate_hessians)
+ if (evaluation_flag != EvaluationFlags::nothing)
{
data.values_dofs.resize(n_comp * n_shape_values);
data.values_quad.resize(n_comp * n_q_points);
data.gradients_quad.resize(n_comp * n_q_points * dim);
data.scratch.resize(2 * std::max(n_q_points, n_shape_values));
- if (evaluate_hessians)
+ if (evaluation_flag & EvaluationFlags::hessians)
data.hessians_quad.resize(n_comp * n_q_points * n_hessians);
const std::vector<unsigned int> &renumber_to_lexicographic =
}
// do the actual tensorized evaluation
- SelectEvaluator<dim, -1, 0, n_comp, VectorizedArray<double>>::
- evaluate(data.shape_info,
- data.values_dofs.begin(),
- data.values_quad.begin(),
- data.gradients_quad.begin(),
- data.hessians_quad.begin(),
- data.scratch.begin(),
- evaluate_values,
- evaluate_gradients,
- evaluate_hessians);
+ SelectEvaluator<dim, -1, 0, VectorizedArray<double>>::evaluate(
+ n_comp,
+ evaluation_flag,
+ data.shape_info,
+ data.values_dofs.begin(),
+ data.values_quad.begin(),
+ data.gradients_quad.begin(),
+ data.hessians_quad.begin(),
+ data.scratch.begin());
}
// do the postprocessing
- if (evaluate_values)
+ if (evaluation_flag & EvaluationFlags::values)
{
for (unsigned int out_comp = 0; out_comp < n_comp; ++out_comp)
for (unsigned int i = 0; i < n_q_points; ++i)
data.values_quad[out_comp * n_q_points + i][in_comp];
}
- if (evaluate_gradients)
+ if (evaluation_flag & EvaluationFlags::gradients)
{
std::fill(data.contravariant.begin(),
data.contravariant.end(),
data.volume_elements[point] =
data.contravariant[point].determinant();
- if (evaluate_hessians)
+ if (evaluation_flag & EvaluationFlags::hessians)
{
constexpr int desymmetrize_3d[6][2] = {
{0, 0}, {1, 1}, {2, 2}, {0, 1}, {0, 2}, {1, 2}};
// ---------------------------------------------------------------------
-for (deal_II_dimension : DIMENSIONS; components : SPACE_DIMENSIONS;
- scalar_type : REAL_SCALARS)
+for (deal_II_dimension : DIMENSIONS; scalar_type : REAL_SCALARS)
{
- template void SelectEvaluator<deal_II_dimension,
- -1,
- 0,
- components,
- VectorizedArray<scalar_type>>::
- integrate(const internal::MatrixFreeFunctions::ShapeInfo<
+ template void
+ SelectEvaluator<deal_II_dimension, -1, 0, VectorizedArray<scalar_type>>::
+ integrate(const unsigned int,
+ const EvaluationFlags::EvaluationFlags,
+ const internal::MatrixFreeFunctions::ShapeInfo<
VectorizedArray<scalar_type>> &shape_info,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
- const bool,
- const bool,
const bool);
- template void SelectEvaluator<deal_II_dimension,
- -1,
- 0,
- components,
- VectorizedArray<scalar_type>>::
- evaluate(const internal::MatrixFreeFunctions::ShapeInfo<
+ template void
+ SelectEvaluator<deal_II_dimension, -1, 0, VectorizedArray<scalar_type>>::
+ evaluate(const unsigned int,
+ const EvaluationFlags::EvaluationFlags,
+ const internal::MatrixFreeFunctions::ShapeInfo<
VectorizedArray<scalar_type>> &shape_info,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
VectorizedArray<scalar_type> *,
- VectorizedArray<scalar_type> *,
- const bool,
- const bool,
- const bool);
+ VectorizedArray<scalar_type> *);
}
dim,
degree + 1,
2 * degree + 1,
- 1,
VectorizedArray<Number>,
VectorizedArray<Number>>::
- do_forward(prolongation_matrix_1d,
+ do_forward(1,
+ prolongation_matrix_1d,
evaluation_data.begin() +
c * Utilities::fixed_power<dim>(degree_size),
evaluation_data.begin() + c * n_scalar_cell_dofs,
dim,
degree + 1,
2 * degree + 2,
- 1,
VectorizedArray<Number>,
VectorizedArray<Number>>::
- do_forward(prolongation_matrix_1d,
+ do_forward(1,
+ prolongation_matrix_1d,
evaluation_data.begin() +
c * Utilities::fixed_power<dim>(degree_size),
evaluation_data.begin() + c * n_scalar_cell_dofs,
dim,
degree + 1,
2 * degree + 1,
- 1,
VectorizedArray<Number>,
VectorizedArray<Number>>::
- do_backward(prolongation_matrix_1d,
+ do_backward(1,
+ prolongation_matrix_1d,
false,
evaluation_data.begin() + c * n_scalar_cell_dofs,
evaluation_data.begin() +
dim,
degree + 1,
2 * degree + 2,
- 1,
VectorizedArray<Number>,
VectorizedArray<Number>>::
- do_backward(prolongation_matrix_1d,
+ do_backward(1,
+ prolongation_matrix_1d,
false,
evaluation_data.begin() + c * n_scalar_cell_dofs,
evaluation_data.begin() +