From: Denis Davydov Date: Tue, 23 May 2017 15:15:52 +0000 (+0200) Subject: factor out pre- and post-processing of dst/src inside MatrixFreeOperators::Base:... X-Git-Tag: v9.0.0-rc1~1577^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8de5aadb3ee3901db20176b5b10a4e3a6bc6a53;p=dealii.git factor out pre- and post-processing of dst/src inside MatrixFreeOperators::Base::mult_add() into two functions --- diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 2717bee872..f1d1d199a7 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -342,6 +342,18 @@ namespace MatrixFreeOperators protected: + /** + * Perform necessary operations related to constraints before calling + * apply_add() or Tapply_add() inside mult_add(). + */ + void preprocess_constraints(VectorType &dst, const VectorType &src) const; + + /** + * Perform necessary operations related to constraints after calling + * apply_add() or Tapply_add() inside mult_add(). + */ + void postprocess_constraints(VectorType &dst, const VectorType &src) const; + /** * Set constrained entries (both from hanging nodes and edge constraints) * of @p dst to one. @@ -1180,13 +1192,9 @@ namespace MatrixFreeOperators template void - Base::mult_add (VectorType &dst, - const VectorType &src, - const bool transpose) const + Base::preprocess_constraints (VectorType &dst, + const VectorType &src) const { - AssertDimension(dst.size(), src.size()); - AssertDimension(n_blocks(dst), n_blocks(src)); - AssertDimension(n_blocks(dst), selected_rows.size()); typedef typename Base::value_type Number; adjust_ghost_range_if_necessary(src, false); adjust_ghost_range_if_necessary(dst, true); @@ -1204,12 +1212,34 @@ namespace MatrixFreeOperators subblock(const_cast(src),j).local_element(edge_constrained_indices[j][i]) = 0.; } } + } + + + template + void + Base::mult_add (VectorType &dst, + const VectorType &src, + const bool transpose) const + { + AssertDimension(dst.size(), src.size()); + AssertDimension(n_blocks(dst), n_blocks(src)); + AssertDimension(n_blocks(dst), selected_rows.size()); + preprocess_constraints (dst,src); if (transpose) Tapply_add(dst,src); else apply_add(dst,src); + postprocess_constraints(dst,src); + } + + + template + void + Base::postprocess_constraints (VectorType &dst, + const VectorType &src) const + { for (unsigned int j=0; j &