From b1cf97e9c909e0ffa737410f5a876645f7121952 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Sun, 15 Apr 2018 10:07:44 +0200 Subject: [PATCH] Add another test for GridTools::map_boundary_to_manifold_ids --- .../map_boundary_to_manifold_id_02.cc | 108 ++++++++++++++ .../map_boundary_to_manifold_id_02.output | 132 ++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 tests/manifold/map_boundary_to_manifold_id_02.cc create mode 100644 tests/manifold/map_boundary_to_manifold_id_02.output diff --git a/tests/manifold/map_boundary_to_manifold_id_02.cc b/tests/manifold/map_boundary_to_manifold_id_02.cc new file mode 100644 index 0000000000..2198997d6a --- /dev/null +++ b/tests/manifold/map_boundary_to_manifold_id_02.cc @@ -0,0 +1,108 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// Test the function map_boundary_to_manifold_ids for edges in 3d + +#include "../tests.h" + + +// all include files you need here +#include +#include +#include +#include +#include +#include + +template +void print_info(const Triangulation &tria) +{ + for (auto cell = tria.begin_active(); cell != tria.end(); ++cell) + { + deallog << "C: " << cell + << ", manifold id: " << (int)cell->manifold_id() << std::endl; + for (unsigned int f=0; f::faces_per_cell; ++f) + { + deallog << "f: " << cell->face(f) + << ", boundary id: " << (int)cell->face(f)->boundary_id() + << ", manifold id: " << (int)cell->face(f)->manifold_id() << std::endl; + if (dim >=3) + for (signed int e=0; e(GeometryInfo::lines_per_face); ++e) + deallog << "e: " << cell->face(f)->line(e) + << ", boundary id: " << (int)cell->face(f)->line(e)->boundary_id() + << ", manifold id: " << (int)cell->face(f)->line(e)->manifold_id() << std::endl; + } + } +} + +// Helper function +template +void test() +{ + deallog << "Testing dim=" << dim + << ", spacedim="<< spacedim << std::endl; + + deallog << "Default" << std::endl; + Triangulation tria; + GridGenerator::hyper_cube (tria, 0, 1, true); + print_info(tria); + deallog << std::endl; + + // Set the edge manifolds to something interesting + deallog << "Set edge manifold IDs" << std::endl; + for (auto cell = tria.begin_active(); cell != tria.end(); ++cell) + { + for (signed int e=0; e(GeometryInfo::lines_per_cell); ++e) + cell->line(e)->set_manifold_id(e); + for (unsigned int f=0; f::faces_per_cell; ++f) + { + cell->face(f)->set_boundary_id(f); + for (signed int e=0; e(GeometryInfo::lines_per_face); ++e) + cell->face(f)->line(e)->set_boundary_id(f); + } + } + print_info(tria); + deallog << std::endl; + + // Test + + // Test setting all manifold ids to an offset of the boundary id + deallog << "All manifold ids to offset boundary id" << std::endl; + auto bids = tria.get_boundary_ids(); + std::vector mids(bids.size(), 0); + for (unsigned int i=0; i rbids(bids.size(), 1); + GridTools::map_boundary_to_manifold_ids(bids, mids, tria, rbids); + print_info(tria); +} + +int main () +{ + initlog(); + test<3,3>(); + + return 0; +} + diff --git a/tests/manifold/map_boundary_to_manifold_id_02.output b/tests/manifold/map_boundary_to_manifold_id_02.output new file mode 100644 index 0000000000..a28a71a120 --- /dev/null +++ b/tests/manifold/map_boundary_to_manifold_id_02.output @@ -0,0 +1,132 @@ + +DEAL::Testing dim=3, spacedim=3 +DEAL::Default +DEAL::C: 0.0, manifold id: -1 +DEAL::f: 2, boundary id: 0, manifold id: -1 +DEAL::e: 2, boundary id: 0, manifold id: -1 +DEAL::e: 6, boundary id: 0, manifold id: -1 +DEAL::e: 1, boundary id: 0, manifold id: -1 +DEAL::e: 9, boundary id: 0, manifold id: -1 +DEAL::f: 3, boundary id: 1, manifold id: -1 +DEAL::e: 4, boundary id: 0, manifold id: -1 +DEAL::e: 7, boundary id: 0, manifold id: -1 +DEAL::e: 3, boundary id: 0, manifold id: -1 +DEAL::e: 10, boundary id: 0, manifold id: -1 +DEAL::f: 0, boundary id: 2, manifold id: -1 +DEAL::e: 0, boundary id: 0, manifold id: -1 +DEAL::e: 8, boundary id: 0, manifold id: -1 +DEAL::e: 2, boundary id: 0, manifold id: -1 +DEAL::e: 4, boundary id: 0, manifold id: -1 +DEAL::f: 4, boundary id: 3, manifold id: -1 +DEAL::e: 5, boundary id: 0, manifold id: -1 +DEAL::e: 11, boundary id: 0, manifold id: -1 +DEAL::e: 6, boundary id: 0, manifold id: -1 +DEAL::e: 7, boundary id: 0, manifold id: -1 +DEAL::f: 1, boundary id: 4, manifold id: -1 +DEAL::e: 1, boundary id: 0, manifold id: -1 +DEAL::e: 3, boundary id: 0, manifold id: -1 +DEAL::e: 0, boundary id: 0, manifold id: -1 +DEAL::e: 5, boundary id: 0, manifold id: -1 +DEAL::f: 5, boundary id: 5, manifold id: -1 +DEAL::e: 9, boundary id: 0, manifold id: -1 +DEAL::e: 10, boundary id: 0, manifold id: -1 +DEAL::e: 8, boundary id: 0, manifold id: -1 +DEAL::e: 11, boundary id: 0, manifold id: -1 +DEAL:: +DEAL::Set edge manifold IDs +DEAL::C: 0.0, manifold id: -1 +DEAL::f: 2, boundary id: 0, manifold id: -1 +DEAL::e: 2, boundary id: 2, manifold id: 8 +DEAL::e: 6, boundary id: 3, manifold id: 10 +DEAL::e: 1, boundary id: 4, manifold id: 0 +DEAL::e: 9, boundary id: 5, manifold id: 4 +DEAL::f: 3, boundary id: 1, manifold id: -1 +DEAL::e: 4, boundary id: 2, manifold id: 9 +DEAL::e: 7, boundary id: 3, manifold id: 11 +DEAL::e: 3, boundary id: 4, manifold id: 1 +DEAL::e: 10, boundary id: 5, manifold id: 5 +DEAL::f: 0, boundary id: 2, manifold id: -1 +DEAL::e: 0, boundary id: 4, manifold id: 2 +DEAL::e: 8, boundary id: 5, manifold id: 6 +DEAL::e: 2, boundary id: 2, manifold id: 8 +DEAL::e: 4, boundary id: 2, manifold id: 9 +DEAL::f: 4, boundary id: 3, manifold id: -1 +DEAL::e: 5, boundary id: 4, manifold id: 3 +DEAL::e: 11, boundary id: 5, manifold id: 7 +DEAL::e: 6, boundary id: 3, manifold id: 10 +DEAL::e: 7, boundary id: 3, manifold id: 11 +DEAL::f: 1, boundary id: 4, manifold id: -1 +DEAL::e: 1, boundary id: 4, manifold id: 0 +DEAL::e: 3, boundary id: 4, manifold id: 1 +DEAL::e: 0, boundary id: 4, manifold id: 2 +DEAL::e: 5, boundary id: 4, manifold id: 3 +DEAL::f: 5, boundary id: 5, manifold id: -1 +DEAL::e: 9, boundary id: 5, manifold id: 4 +DEAL::e: 10, boundary id: 5, manifold id: 5 +DEAL::e: 8, boundary id: 5, manifold id: 6 +DEAL::e: 11, boundary id: 5, manifold id: 7 +DEAL:: +DEAL::All manifold ids to offset boundary id +DEAL::C: 0.0, manifold id: -1 +DEAL::f: 2, boundary id: 0, manifold id: 10 +DEAL::e: 2, boundary id: 2, manifold id: 12 +DEAL::e: 6, boundary id: 3, manifold id: 13 +DEAL::e: 1, boundary id: 4, manifold id: 14 +DEAL::e: 9, boundary id: 5, manifold id: 15 +DEAL::f: 3, boundary id: 1, manifold id: 11 +DEAL::e: 4, boundary id: 2, manifold id: 12 +DEAL::e: 7, boundary id: 3, manifold id: 13 +DEAL::e: 3, boundary id: 4, manifold id: 14 +DEAL::e: 10, boundary id: 5, manifold id: 15 +DEAL::f: 0, boundary id: 2, manifold id: 12 +DEAL::e: 0, boundary id: 4, manifold id: 14 +DEAL::e: 8, boundary id: 5, manifold id: 15 +DEAL::e: 2, boundary id: 2, manifold id: 12 +DEAL::e: 4, boundary id: 2, manifold id: 12 +DEAL::f: 4, boundary id: 3, manifold id: 13 +DEAL::e: 5, boundary id: 4, manifold id: 14 +DEAL::e: 11, boundary id: 5, manifold id: 15 +DEAL::e: 6, boundary id: 3, manifold id: 13 +DEAL::e: 7, boundary id: 3, manifold id: 13 +DEAL::f: 1, boundary id: 4, manifold id: 14 +DEAL::e: 1, boundary id: 4, manifold id: 14 +DEAL::e: 3, boundary id: 4, manifold id: 14 +DEAL::e: 0, boundary id: 4, manifold id: 14 +DEAL::e: 5, boundary id: 4, manifold id: 14 +DEAL::f: 5, boundary id: 5, manifold id: 15 +DEAL::e: 9, boundary id: 5, manifold id: 15 +DEAL::e: 10, boundary id: 5, manifold id: 15 +DEAL::e: 8, boundary id: 5, manifold id: 15 +DEAL::e: 11, boundary id: 5, manifold id: 15 +DEAL::All manifold ids to offset boundary id + boundary id reset +DEAL::C: 0.0, manifold id: -1 +DEAL::f: 2, boundary id: 1, manifold id: 20 +DEAL::e: 2, boundary id: 1, manifold id: 22 +DEAL::e: 6, boundary id: 1, manifold id: 23 +DEAL::e: 1, boundary id: 1, manifold id: 24 +DEAL::e: 9, boundary id: 1, manifold id: 25 +DEAL::f: 3, boundary id: 1, manifold id: 21 +DEAL::e: 4, boundary id: 1, manifold id: 22 +DEAL::e: 7, boundary id: 1, manifold id: 23 +DEAL::e: 3, boundary id: 1, manifold id: 24 +DEAL::e: 10, boundary id: 1, manifold id: 25 +DEAL::f: 0, boundary id: 1, manifold id: 22 +DEAL::e: 0, boundary id: 1, manifold id: 24 +DEAL::e: 8, boundary id: 1, manifold id: 25 +DEAL::e: 2, boundary id: 1, manifold id: 22 +DEAL::e: 4, boundary id: 1, manifold id: 22 +DEAL::f: 4, boundary id: 1, manifold id: 23 +DEAL::e: 5, boundary id: 1, manifold id: 24 +DEAL::e: 11, boundary id: 1, manifold id: 25 +DEAL::e: 6, boundary id: 1, manifold id: 23 +DEAL::e: 7, boundary id: 1, manifold id: 23 +DEAL::f: 1, boundary id: 1, manifold id: 24 +DEAL::e: 1, boundary id: 1, manifold id: 24 +DEAL::e: 3, boundary id: 1, manifold id: 24 +DEAL::e: 0, boundary id: 1, manifold id: 24 +DEAL::e: 5, boundary id: 1, manifold id: 24 +DEAL::f: 5, boundary id: 1, manifold id: 25 +DEAL::e: 9, boundary id: 1, manifold id: 25 +DEAL::e: 10, boundary id: 1, manifold id: 25 +DEAL::e: 8, boundary id: 1, manifold id: 25 +DEAL::e: 11, boundary id: 1, manifold id: 25 -- 2.39.5