From: Luca Heltai Date: Wed, 27 Sep 2017 13:41:08 +0000 (+0200) Subject: Fixed WB comments. X-Git-Tag: v9.0.0-rc1~1018^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=783ce6db34ad4bb6469f0ca9bab3cf14f7becadd;p=dealii.git Fixed WB comments. --- diff --git a/doc/news/changes/minor/20170927LucaHeltai b/doc/news/changes/minor/20170927LucaHeltai new file mode 100644 index 0000000000..e1434009a6 --- /dev/null +++ b/doc/news/changes/minor/20170927LucaHeltai @@ -0,0 +1,10 @@ +Fixed: One of the fucntions GridTools::find_active_cell_around_point() +supports an additional `mapping` argument. This mapping was used +to actually tranform points from the real to the reference space, +but somewhere in the algorithm we look for the `closest_vertex` to +the target point. Such search was done ignoring if the `mapping` +actually changes the location of the vertices. This is now fixed, +and the internal function that looks for the closest vertex now +takes into account the `mapping` tranformation. +
+(Luca Heltai, 2017/09/27) diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 9586e715c8..89eafb28b4 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -583,8 +583,8 @@ namespace GridTools * location of vertices, like MappingQEulerian. * * @ref ConceptMeshType "MeshType concept". - * @param container The container to extract vertices from - * @param mapping The mapping to use to compute the points locations + * @param container The container to extract vertices from. + * @param mapping The mapping to use to compute the points locations. * * @author Luca Heltai, 2017. */ @@ -594,13 +594,13 @@ namespace GridTools const Mapping &mapping = StaticMappingQ1::mapping); /** - * Find and return the number of the closest vertex to a given point in the + * Find and return the index of the closest vertex to a given point in the * map of vertices passed as the first argument. * * @param vertices A map of index->vertex, as returned by - * extract_used_vertices() - * @param p The target point - * @return The index of the vertex that is closest to the target point `p` + * GridTools::extract_used_vertices(). + * @param p The target point. + * @return The index of the vertex that is closest to the target point `p`. * * @author Luca Heltai, 2017. */ @@ -610,9 +610,15 @@ namespace GridTools const Point &p); /** - * Find and return the number of the used vertex (or marked vertex) in a + * Find and return the index of the used vertex (or marked vertex) in a * given mesh that is located closest to a given point. * + * This function uses the locations of vertices as stored in the + * triangulation. This is usually sufficient, unless you are using a Mapping + * that moves the vertices around (for example, MappingQEulerian). In this + * case, you should call the function with the same name and with an + * additional Mapping argument. + * * @param mesh A variable of a type that satisfies the requirements of the * @ref ConceptMeshType "MeshType concept". * @param p The point for which we want to find the closest vertex. @@ -636,10 +642,14 @@ namespace GridTools const std::vector &marked_vertices = std::vector()); /** - * Find and return the number of the used vertex (or marked vertex) in a + * Find and return the index of the used vertex (or marked vertex) in a * given mesh that is located closest to a given point. Use the given * mapping to compute the actual location of the vertices. * + * If the Mapping does not modify the position of the mesh vertices (like, + * for example, MappingQEulerian does), then this function is equivalent to + * the one with the same name, and without the `mapping` argument. + * * @param mapping A mapping used to compute the vertex locations * @param mesh A variable of a type that satisfies the requirements of the * @ref ConceptMeshType "MeshType concept". diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 612d039126..65ca0031ac 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -4996,7 +4996,7 @@ next_cell: std::map > result; for (const auto &cell : container.active_cell_iterators()) { - auto vs = mapping.get_vertices(cell); + const auto vs = mapping.get_vertices(cell); for (unsigned int i=0; ivertex_index(i)]=vs[i]; }