From: Martin Kronbichler Date: Mon, 9 Oct 2017 09:53:47 +0000 (+0200) Subject: Add assertion regarding vector access in FEEvaluation. X-Git-Tag: v9.0.0-rc1~972^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e3e13e781ebf77f660f8356e285e299c086a704;p=dealii.git Add assertion regarding vector access in FEEvaluation. --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index eca7223d3a..dafb516184 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -2923,9 +2923,22 @@ namespace internal typedef VectorType BaseVectorType; static BaseVectorType *get_vector_component (VectorType &vec, - const unsigned int) + const unsigned int component) { - return &vec; + // FEEvaluation allows to combine several vectors from a scalar + // FiniteElement into a "vector-valued" FEEvaluation object with + // multiple components. These components can be extracted with the other + // get_vector_component functions. If we do not get a vector of vectors + // (std::vector, std::vector, BlockVector), we + // must make sure that we do not duplicate the components in input + // and/or duplicate the resulting integrals. In such a case, we should + // only get the zeroth component in the vector contained set nullptr for + // the others which allows us to catch unintended use in + // read_write_operation. + if (component == 0) + return &vec; + else + return nullptr; } }; @@ -3016,6 +3029,16 @@ FEEvaluationBase // and sit on a different vector each) if (n_fe_components == 1) { + for (unsigned int c=0; c or a BlockVector to " + + "read_dof_values and distribute_local_to_global.")); + const unsigned int n_local_dofs = VectorizedArray::n_array_elements * dofs_per_cell; for (unsigned int comp=0; comp