* The equation may contain variable coefficients, so the user is required
* to provide an array for the inverse of the local coefficient (this class
* provide a helper method 'fill_inverse_JxW_values' to get the inverse of a
- * constant-coefficient operator).
+ * constant-coefficient operator). The local coefficient can either be scalar
+ * in each component, or dyadic, i.e. couple between components.
*/
template <int dim,
int fe_degree,
* namely FEEvaluation::dofs_per_cell long. The inverse of the
* local coefficient (also containing the inverse JxW values) must be
* passed as first argument. Passing more than one component in the
- * coefficient is allowed.
+ * coefficient is allowed. The coefficients are interpreted as scalar
+ * in each component.
*/
void
apply(const AlignedVector<VectorizedArrayType> &inverse_coefficient,
const unsigned int n_actual_components,
const VectorizedArrayType * in_array,
- VectorizedArrayType * out_array,
- const bool dyadic_coefficients = false) const;
+ VectorizedArrayType * out_array) const;
/**
* Applies the inverse @ref GlossMassMatrix "mass matrix" operation on an input array, using the
* The second-rank tensor at each quadrature point defines a linear operator
* on a vector holding the dof components. It is assumed that the passed
* input and output arrays are of correct size, namely
- * FEEvaluation::dofs_per_cell long.
+ * FEEvaluation::dofs_per_cell long. The `in_array` and `out_array`
+ * arguments may point to the same memory position.
* `inverse_dyadic_coefficients` must be dofs_per_component long, and every
* element must be a second-rank tensor of dimension `n_components`. All
- * entries should also contain the inverse JxW values. The `in_array` and
- * `out_array` arguments may point to the same memory position.
+ * entries should also contain the inverse JxW values.
*/
void
apply(const AlignedVector<Tensor<2, n_components, VectorizedArrayType>>
apply(const AlignedVector<VectorizedArrayType> &inverse_coefficients,
const unsigned int n_actual_components,
const VectorizedArrayType * in_array,
- VectorizedArrayType * out_array,
- const bool dyadic_coefficients) const
+ VectorizedArrayType * out_array) const
{
if (fe_degree > -1)
- internal::CellwiseInverseMassMatrixImplFlexible<
- dim,
- VectorizedArrayType>::template run<fe_degree>(n_actual_components,
- fe_eval,
- inverse_coefficients,
- dyadic_coefficients,
- in_array,
- out_array);
+ internal::CellwiseInverseMassMatrixImplFlexible<dim,
+ VectorizedArrayType>::
+ template run<fe_degree>(
+ n_actual_components,
+ fe_eval,
+ ArrayView<const VectorizedArrayType>(inverse_coefficients.data(),
+ inverse_coefficients.size()),
+ false,
+ in_array,
+ out_array);
else
internal::CellwiseInverseMassFactory<dim, VectorizedArrayType>::apply(
n_actual_components,
fe_eval,
- inverse_coefficients,
- dyadic_coefficients,
+ ArrayView<const VectorizedArrayType>(inverse_coefficients.data(),
+ inverse_coefficients.size()),
+ false,
in_array,
out_array);
}
const VectorizedArrayType *in_array,
VectorizedArrayType * out_array) const
{
- const unsigned int dofs_per_component = inverse_dyadic_coefficients.size();
- constexpr unsigned int n_tensor_components = n_components * n_components;
-
- AlignedVector<VectorizedArrayType> inverse_coefficients(
- dofs_per_component * n_tensor_components);
-
- // Flatten the inverse dyadic coefficients into `inverse_coefficients`
- {
- auto begin = inverse_coefficients.begin();
- for (unsigned int q = 0; q < dofs_per_component; ++q)
- {
- const auto end = std::next(begin, n_tensor_components);
- inverse_dyadic_coefficients[q].unroll(begin, end);
- begin = end;
- }
- }
+ const unsigned int unrolled_size =
+ inverse_dyadic_coefficients.size() * (n_components * n_components);
- apply(inverse_coefficients, n_components, in_array, out_array, true);
+ if (fe_degree > -1)
+ internal::CellwiseInverseMassMatrixImplFlexible<dim,
+ VectorizedArrayType>::
+ template run<fe_degree>(n_components,
+ fe_eval,
+ ArrayView<const VectorizedArrayType>(
+ &inverse_dyadic_coefficients[0][0][0],
+ unrolled_size),
+ true,
+ in_array,
+ out_array);
+ else
+ internal::CellwiseInverseMassFactory<dim, VectorizedArrayType>::apply(
+ n_components,
+ fe_eval,
+ ArrayView<const VectorizedArrayType>(
+ &inverse_dyadic_coefficients[0][0][0], unrolled_size),
+ true,
+ in_array,
+ out_array);
}