From 30253c57cfd1d7bf95875e19f835084291b496b7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 20 Nov 2018 08:58:30 -0700 Subject: [PATCH] Add a testcase. --- tests/grid/accessor_01.cc | 71 +++++++++++++++++++++++++++++++++++ tests/grid/accessor_01.output | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tests/grid/accessor_01.cc create mode 100644 tests/grid/accessor_01.output diff --git a/tests/grid/accessor_01.cc b/tests/grid/accessor_01.cc new file mode 100644 index 0000000000..b340738dcf --- /dev/null +++ b/tests/grid/accessor_01.cc @@ -0,0 +1,71 @@ +// --------------------------------------------------------------------- +// +// 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + + +// TriaAccessor<0,dim,spacedim> and TriaAccessor<0,1,spacedim> lacked +// get_triangulation() member functions because they are not derived +// from TriaAccessorBase. This led to awkward follow-up errors in +// strange places when using them in certain contexts. + +#include + +#include +#include +#include +#include + +#include "../tests.h" + +using namespace dealii; + + +template +void +test() +{ + Triangulation tria; + GridGenerator::hyper_cube(tria); + tria.refine_global(1); + + std::map::face_iterator, double> mymap; + + for (auto cell : tria.active_cell_iterators()) + { + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) + { + if (mymap.find(cell->face(i)) == mymap.end()) + { + mymap[cell->face(i)] = cell->index(); + } + } + } + + for (auto it : mymap) + deallog << it.first << ": " << it.second << std::endl; +} + + +int +main() +{ + initlog(); + + test<1, 1>(); + test<1, 2>(); + test<2, 2>(); + test<2, 3>(); + test<3, 3>(); +} diff --git a/tests/grid/accessor_01.output b/tests/grid/accessor_01.output new file mode 100644 index 0000000000..1929c09e74 --- /dev/null +++ b/tests/grid/accessor_01.output @@ -0,0 +1,67 @@ + +DEAL::0: 0.00000 +DEAL::1: 1.00000 +DEAL::2: 0.00000 +DEAL::0: 0.00000 +DEAL::1: 1.00000 +DEAL::2: 0.00000 +DEAL::4: 0.00000 +DEAL::5: 1.00000 +DEAL::6: 0.00000 +DEAL::7: 2.00000 +DEAL::8: 1.00000 +DEAL::9: 3.00000 +DEAL::10: 2.00000 +DEAL::11: 3.00000 +DEAL::12: 0.00000 +DEAL::13: 2.00000 +DEAL::14: 0.00000 +DEAL::15: 1.00000 +DEAL::4: 0.00000 +DEAL::5: 1.00000 +DEAL::6: 0.00000 +DEAL::7: 2.00000 +DEAL::8: 1.00000 +DEAL::9: 3.00000 +DEAL::10: 2.00000 +DEAL::11: 3.00000 +DEAL::12: 0.00000 +DEAL::13: 2.00000 +DEAL::14: 0.00000 +DEAL::15: 1.00000 +DEAL::6: 0.00000 +DEAL::7: 4.00000 +DEAL::8: 1.00000 +DEAL::9: 5.00000 +DEAL::10: 0.00000 +DEAL::11: 1.00000 +DEAL::12: 2.00000 +DEAL::13: 3.00000 +DEAL::14: 0.00000 +DEAL::15: 2.00000 +DEAL::16: 4.00000 +DEAL::17: 6.00000 +DEAL::18: 1.00000 +DEAL::19: 3.00000 +DEAL::20: 5.00000 +DEAL::21: 7.00000 +DEAL::22: 2.00000 +DEAL::23: 6.00000 +DEAL::24: 3.00000 +DEAL::25: 7.00000 +DEAL::26: 4.00000 +DEAL::27: 5.00000 +DEAL::28: 6.00000 +DEAL::29: 7.00000 +DEAL::30: 3.00000 +DEAL::31: 2.00000 +DEAL::32: 1.00000 +DEAL::33: 0.00000 +DEAL::34: 5.00000 +DEAL::35: 1.00000 +DEAL::36: 4.00000 +DEAL::37: 0.00000 +DEAL::38: 6.00000 +DEAL::39: 4.00000 +DEAL::40: 2.00000 +DEAL::41: 0.00000 -- 2.39.5