]> https://gitweb.dealii.org/ - dealii.git/commitdiff
isotropic refinement: add some more test output.
authorDavid Wells <drwells@email.unc.edu>
Sat, 24 Dec 2022 20:51:18 +0000 (15:51 -0500)
committerDavid Wells <drwells@email.unc.edu>
Sat, 24 Dec 2022 20:56:15 +0000 (15:56 -0500)
These don't print anything because the lines are all consistently oriented.

tests/simplex/refinement_01.cc
tests/simplex/refinement_02.cc

index 78deca44336f8d3ea6a7246f5cffd510a55df181..63fb37dd68c484ae83f814bbc22bea8825e73eee 100644 (file)
@@ -21,6 +21,8 @@
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/tria.h>
 
+#include <set>
+
 #include "../tests.h"
 
 #include "./simplex_grids.h"
@@ -55,6 +57,39 @@ test(const unsigned int v)
       tria.execute_coarsening_and_refinement();
     }
 
+  // verify that all faces have consistently set orientation flags.
+  std::set<std::pair<unsigned int, unsigned int>> all_faces;
+  for (const auto &cell : tria.active_cell_iterators())
+    {
+      const auto v0 = cell->vertex_index(0);
+      const auto v1 = cell->vertex_index(1);
+      const auto v2 = cell->vertex_index(2);
+
+      const auto p0  = cell->face_orientation(0) ? std::make_pair(v0, v1) :
+                                                   std::make_pair(v1, v0);
+      const auto p1  = cell->face_orientation(1) ? std::make_pair(v1, v2) :
+                                                   std::make_pair(v2, v1);
+      const auto p2  = cell->face_orientation(2) ? std::make_pair(v2, v0) :
+                                                   std::make_pair(v0, v2);
+      const auto p0w = std::make_pair(p0.second, p0.first);
+      const auto p1w = std::make_pair(p1.second, p1.first);
+      const auto p2w = std::make_pair(p2.second, p2.first);
+
+      all_faces.insert(p0);
+      all_faces.insert(p1);
+      all_faces.insert(p2);
+
+      if (all_faces.count(p0w) == 1)
+        deallog << "found inconsistent line (" << p0w.first << ", "
+                << p0w.second << ")" << std::endl;
+      if (all_faces.count(p1w) == 1)
+        deallog << "found inconsistent line (" << p1w.first << ", "
+                << p1w.second << ")" << std::endl;
+      if (all_faces.count(p2w) == 1)
+        deallog << "found inconsistent line (" << p2w.first << ", "
+                << p2w.second << ")" << std::endl;
+    }
+
   GridOut grid_out;
 #if false
   std::ofstream out("mesh." + std::to_string(v) + ".vtk");
index 58a2ef2dcdcc284b20a69fffc59f32b5309bd9cf..55ba55f60898da78a2b1c5559128f928b9ff5662 100644 (file)
@@ -21,6 +21,8 @@
 #include <deal.II/grid/grid_out.h>
 #include <deal.II/grid/tria.h>
 
+#include <set>
+
 #include "../tests.h"
 
 #include "./simplex_grids.h"
@@ -51,6 +53,39 @@ test(const unsigned int v)
       tria.execute_coarsening_and_refinement();
     }
 
+  // verify that all faces have consistently set orientation flags.
+  std::set<std::pair<unsigned int, unsigned int>> all_faces;
+  for (const auto &cell : tria.active_cell_iterators())
+    {
+      const auto v0 = cell->vertex_index(0);
+      const auto v1 = cell->vertex_index(1);
+      const auto v2 = cell->vertex_index(2);
+
+      const auto p0  = cell->face_orientation(0) ? std::make_pair(v0, v1) :
+                                                   std::make_pair(v1, v0);
+      const auto p1  = cell->face_orientation(1) ? std::make_pair(v1, v2) :
+                                                   std::make_pair(v2, v1);
+      const auto p2  = cell->face_orientation(2) ? std::make_pair(v2, v0) :
+                                                   std::make_pair(v0, v2);
+      const auto p0w = std::make_pair(p0.second, p0.first);
+      const auto p1w = std::make_pair(p1.second, p1.first);
+      const auto p2w = std::make_pair(p2.second, p2.first);
+
+      all_faces.insert(p0);
+      all_faces.insert(p1);
+      all_faces.insert(p2);
+
+      if (all_faces.count(p0w) == 1)
+        deallog << "found inconsistent line (" << p0w.first << ", "
+                << p0w.second << ")" << std::endl;
+      if (all_faces.count(p1w) == 1)
+        deallog << "found inconsistent line (" << p1w.first << ", "
+                << p1w.second << ")" << std::endl;
+      if (all_faces.count(p2w) == 1)
+        deallog << "found inconsistent line (" << p2w.first << ", "
+                << p2w.second << ")" << std::endl;
+    }
+
   for (const auto &cell : tria.active_cell_iterators())
     {
       deallog << cell->level() << ':' << cell->index() << "     ";

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.