]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed WB comments. 5106/head
authorLuca Heltai <luca.heltai@sissa.it>
Wed, 27 Sep 2017 13:41:08 +0000 (15:41 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Wed, 27 Sep 2017 13:43:04 +0000 (15:43 +0200)
doc/news/changes/minor/20170927LucaHeltai [new file with mode: 0644]
include/deal.II/grid/grid_tools.h
source/grid/grid_tools.cc

diff --git a/doc/news/changes/minor/20170927LucaHeltai b/doc/news/changes/minor/20170927LucaHeltai
new file mode 100644 (file)
index 0000000..e143400
--- /dev/null
@@ -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. 
+<br>
+(Luca Heltai, 2017/09/27)
index 9586e715c861ee23e722e1c36a0faccea403025f..89eafb28b4f4d96cbfdc7dc1bff2f8acc8cad825 100644 (file)
@@ -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<dim,spacedim> &mapping = StaticMappingQ1<dim,spacedim>::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<spacedim>         &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<bool>       &marked_vertices = std::vector<bool>());
 
   /**
-   * 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".
index 612d0391261bd5ca6468fb17535717bd5165664c..65ca0031accc84dba393ac5267fcbefbd19a9423 100644 (file)
@@ -4996,7 +4996,7 @@ next_cell:
     std::map<unsigned int, Point<spacedim> > 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; i<vs.size(); ++i)
           result[cell->vertex_index(i)]=vs[i];
       }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.