From: Peter Munch Date: Thu, 12 Mar 2020 07:03:55 +0000 (+0100) Subject: ECL: fix variable names and a std::function version X-Git-Tag: v9.2.0-rc1~427^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aaa6345f57d89ec5590ee0fb486b93fb8a37eec;p=dealii.git ECL: fix variable names and a std::function version --- diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 32b8ca42b4..45f562a141 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -1380,6 +1380,23 @@ public: const DataAccessOnFaces src_vector_face_access = DataAccessOnFaces::unspecified) const; + /** + * Same as above, but with std::function. + */ + template + void + loop_cell_centric( + const std::function &)> + & cell_operation, + OutVector & dst, + const InVector & src, + const bool zero_dst_vector = false, + const DataAccessOnFaces src_vector_face_access = + DataAccessOnFaces::unspecified) const; + /** * In the hp adaptive case, a subrange of cells as computed during the cell * loop might contain elements of different degrees. Use this function to @@ -5078,9 +5095,9 @@ MatrixFree::loop_cell_centric( { auto src_vector_face_access_temp = src_vector_face_access; if (DataAccessOnFaces::gradients == src_vector_face_access_temp) - src_vector_face_access_temp = DataAccessOnFaces::gradients_cell; + src_vector_face_access_temp = DataAccessOnFaces::gradients_all_faces; else if (DataAccessOnFaces::values == src_vector_face_access_temp) - src_vector_face_access_temp = DataAccessOnFaces::values_cell; + src_vector_face_access_temp = DataAccessOnFaces::values_all_faces; internal::MFWorker, InVector, @@ -5119,9 +5136,9 @@ MatrixFree::loop_cell_centric( { auto src_vector_face_access_temp = src_vector_face_access; if (DataAccessOnFaces::gradients == src_vector_face_access_temp) - src_vector_face_access_temp = DataAccessOnFaces::gradients_cell; + src_vector_face_access_temp = DataAccessOnFaces::gradients_all_faces; else if (DataAccessOnFaces::values == src_vector_face_access_temp) - src_vector_face_access_temp = DataAccessOnFaces::values_cell; + src_vector_face_access_temp = DataAccessOnFaces::values_all_faces; internal::MFWorker, InVector, @@ -5142,6 +5159,52 @@ MatrixFree::loop_cell_centric( } + +template +template +inline void +MatrixFree::loop_cell_centric( + const std::function &, + OutVector &, + const InVector &, + const std::pair &)> + & cell_operation, + OutVector & dst, + const InVector & src, + const bool zero_dst_vector, + const DataAccessOnFaces src_vector_face_access) const +{ + auto src_vector_face_access_temp = src_vector_face_access; + if (DataAccessOnFaces::gradients == src_vector_face_access_temp) + src_vector_face_access_temp = DataAccessOnFaces::gradients_all_faces; + else if (DataAccessOnFaces::values == src_vector_face_access_temp) + src_vector_face_access_temp = DataAccessOnFaces::values_all_faces; + + using Wrapper = + internal::MFClassWrapper, + InVector, + OutVector>; + Wrapper wrap(cell_operation, nullptr, nullptr); + + internal::MFWorker, + InVector, + OutVector, + Wrapper, + true> + worker(*this, + src, + dst, + zero_dst_vector, + wrap, + &Wrapper::cell_integrator, + &Wrapper::face_integrator, + &Wrapper::boundary_integrator, + src_vector_face_access_temp, + DataAccessOnFaces::none); + task_info.loop(worker); +} + + #endif // ifndef DOXYGEN