]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Be explicit regarding zero tolerance in merge_triangulations 14084/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 1 Jul 2022 20:38:44 +0000 (22:38 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 1 Jul 2022 20:38:44 +0000 (22:38 +0200)
include/deal.II/grid/grid_generator.h
include/deal.II/grid/grid_tools.h
source/grid/grid_generator.cc
source/grid/grid_tools.cc

index a0f20e4c7a368ef9ceef4a7bc14d1891af1b13bd..d6de5006ab08ace235f3c8f14883e818c08c36b3 100644 (file)
@@ -1864,7 +1864,7 @@ namespace GridGenerator
    * {
    *   double length = std::numeric_limits<double>::max();
    *   for (const auto &cell : tria.active_cell_iterators())
-   *     for (unsigned int n = 0; n < GeometryInfo<dim>::lines_per_cell; ++n)
+   *     for (const auto n : cell->line_indices())
    *       length = std::min(length, (cell->line(n)->vertex(0) -
    *                                  cell->line(n)->vertex(1)).norm());
    *   return length;
@@ -1875,7 +1875,7 @@ namespace GridGenerator
    * @endcode
    *
    * This will merge any vertices that are closer than any pair of vertices on
-   * the input meshes.
+   * the input meshes. If the tolerance is set to zero, vertices are not merged.
    *
    * @note The two input triangulations must be
    * @ref GlossCoarseMesh "coarse meshes",
index 4ba5992256e0db9cab7018449d830f145041da67..5a0d81622928cf469b4ff552b697c702cd5db709 100644 (file)
@@ -439,7 +439,8 @@ namespace GridTools
    * vertices.
    *
    * Two vertices are considered equal if their difference in each coordinate
-   * direction is less than @p tol.
+   * direction is less than @p tol. This implies that nothing happens if
+   * the tolerance is set to zero.
    */
   template <int dim, int spacedim>
   void
index ebaaae4f0be0c86a398fc5c72b6dd4fbae2db268..41fa3a00f452e69101cea19121957878b88a0979 100644 (file)
@@ -6544,6 +6544,10 @@ namespace GridGenerator
       GridTools::consistently_order_cells(cells);
     result.clear();
     result.create_triangulation(vertices, cells, subcell_data);
+
+    Assert(duplicated_vertex_tolerance > 0.0 ||
+             n_accumulated_vertices == result.n_vertices(),
+           ExcInternalError());
   }
 
 
index d8c32794526653257a72360fb9acc6c31f8545c7..f4549dfb95d9dd927e334f8d51a05bcdaf1f2d9c 100644 (file)
@@ -744,6 +744,9 @@ namespace GridTools
                              std::vector<unsigned int> &   considered_vertices,
                              const double                  tol)
   {
+    if (tol == 0.0)
+      return; // nothing to do per definition
+
     AssertIndexRange(2, vertices.size());
     std::vector<unsigned int> new_vertex_numbers(vertices.size());
     std::iota(new_vertex_numbers.begin(), new_vertex_numbers.end(), 0);

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.