From 463f061ac6d6bef20225593ce9b15048fdc2311e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 21 Mar 2023 13:36:48 -0600 Subject: [PATCH] Apply concepts to grid_tools.h. --- include/deal.II/grid/grid_tools.h | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 025a4c95d3..4844cc2026 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -63,6 +63,11 @@ #include #include +#ifdef DEAL_II_HAVE_CXX20 +# include +#endif + + DEAL_II_NAMESPACE_OPEN // Forward declarations @@ -602,9 +607,13 @@ namespace GridTools * step-38. It is also used in step-49 and step-53. */ template - void - transform(const Transformation & transformation, - Triangulation &triangulation); + DEAL_II_CXX20_REQUIRES( + (std::invocable> && + std::assignable_from< + Point &, + std::invoke_result_t>>)) + void transform(const Transformation & transformation, + Triangulation &triangulation); /** * Shift each vertex of the triangulation by the given shift vector. This @@ -3704,10 +3713,14 @@ namespace GridTools - template - void - transform(const Predicate & predicate, - Triangulation &triangulation) + template + DEAL_II_CXX20_REQUIRES( + (std::invocable> && + std::assignable_from< + Point &, + std::invoke_result_t>>)) + void transform(const Transformation & transformation, + Triangulation &triangulation) { std::vector treated_vertices(triangulation.n_vertices(), false); @@ -3725,7 +3738,7 @@ namespace GridTools if (treated_vertices[cell->vertex_index(v)] == false) { // transform this vertex - cell->vertex(v) = predicate(cell->vertex(v)); + cell->vertex(v) = transformation(cell->vertex(v)); // and mark it as treated treated_vertices[cell->vertex_index(v)] = true; }; -- 2.39.5