From efbc9e7291bedddc553ec437d08cd9e3bad3bf38 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 20 Apr 2023 14:05:16 -0600 Subject: [PATCH] Add an example to the documentation of GridTools::transform(). --- include/deal.II/grid/grid_tools.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index c7b259c226..7bf25de6f9 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -555,7 +555,22 @@ namespace GridTools * predicate is either an object of a type that has an operator(), * or it is a pointer to a non-member function, or it is a lambda function * object. In either case, argument and return - * value have to be of type Point. + * value have to be of type Point. An example -- a simple + * transformation that moves the object two units to the + * right in the $x_1$ direction -- could look like as follows: + * @code + * Triangulation triangulation; + * ... // fill triangulation with something + * GridTools::transform ([](const Point &p) -> Point + * { + * Point q = p; + * q[0] += 2; + * return q; + * }, + * triangulation); + * @endcode + * Here, the transformation is provided by a lambda function that + * takes a `Point` as input and returns a `Point` as output. * * @note The transformations that make sense to use with this function * should have a Jacobian with a positive determinant. For example, -- 2.39.5