From 525f2206ed35272508a6357b219447a1fb1541ab Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 24 Dec 2022 15:51:18 -0500 Subject: [PATCH] isotropic refinement: add some more test output. These don't print anything because the lines are all consistently oriented. --- tests/simplex/refinement_01.cc | 35 ++++++++++++++++++++++++++++++++++ tests/simplex/refinement_02.cc | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/tests/simplex/refinement_01.cc b/tests/simplex/refinement_01.cc index 78deca4433..63fb37dd68 100644 --- a/tests/simplex/refinement_01.cc +++ b/tests/simplex/refinement_01.cc @@ -21,6 +21,8 @@ #include #include +#include + #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> 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"); diff --git a/tests/simplex/refinement_02.cc b/tests/simplex/refinement_02.cc index 58a2ef2dcd..55ba55f608 100644 --- a/tests/simplex/refinement_02.cc +++ b/tests/simplex/refinement_02.cc @@ -21,6 +21,8 @@ #include #include +#include + #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> 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() << " "; -- 2.39.5