From 56f5e254a1c32d5d09d0e59178219d281d8c344f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 9 Feb 2023 16:13:13 -0700 Subject: [PATCH] Add test. --- tests/grid/reference_cell_type_05.cc | 75 +++++++++++++++++++ tests/grid/reference_cell_type_05.output | 94 ++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 tests/grid/reference_cell_type_05.cc create mode 100644 tests/grid/reference_cell_type_05.output diff --git a/tests/grid/reference_cell_type_05.cc b/tests/grid/reference_cell_type_05.cc new file mode 100644 index 0000000000..bc270205f4 --- /dev/null +++ b/tests/grid/reference_cell_type_05.cc @@ -0,0 +1,75 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2020 - 2022 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. +// +// --------------------------------------------------------------------- + + +// Test consistency of ReferenceCell::face_to_cell_vertices(), +// ReferenceCell::vertex(), and ReferenceCell:face_vertex_location(). + +#include + +#include + +#include "../tests.h" + + +using namespace dealii; + +template +void +test(const ReferenceCell &reference_cell) +{ + deallog << "ReferenceCell: " << reference_cell.to_string() << std::endl; + for (unsigned int f = 0; f < reference_cell.n_faces(); ++f) + for (unsigned int v = 0; + v < reference_cell.face_reference_cell(f).n_vertices(); + ++v) + { + deallog << "Face=" << f << ", vertex=" << v << ", location=" + << reference_cell.face_vertex_location(f, v) << std::endl; + Assert(reference_cell.face_vertex_location(f, v) == + reference_cell.vertex( + reference_cell.face_to_cell_vertices( + f, v, ReferenceCell::default_combined_face_orientation())), + ExcInternalError()); + } +} + +int +main() +{ + initlog(); + + { + deallog.push("1D"); + test<1>(ReferenceCells::Line); + deallog.pop(); + } + + { + deallog.push("2D"); + test<2>(ReferenceCells::Quadrilateral); + test<2>(ReferenceCells::Triangle); + deallog.pop(); + } + + { + deallog.push("3D"); + test<3>(ReferenceCells::Tetrahedron); + test<3>(ReferenceCells::Pyramid); + test<3>(ReferenceCells::Wedge); + test<3>(ReferenceCells::Hexahedron); + deallog.pop(); + } +} diff --git a/tests/grid/reference_cell_type_05.output b/tests/grid/reference_cell_type_05.output new file mode 100644 index 0000000000..38861332f6 --- /dev/null +++ b/tests/grid/reference_cell_type_05.output @@ -0,0 +1,94 @@ + +DEAL:1D::ReferenceCell: Line +DEAL:1D::Face=0, vertex=0, location=0.00000 +DEAL:1D::Face=1, vertex=0, location=1.00000 +DEAL:2D::ReferenceCell: Quad +DEAL:2D::Face=0, vertex=0, location=0.00000 0.00000 +DEAL:2D::Face=0, vertex=1, location=0.00000 1.00000 +DEAL:2D::Face=1, vertex=0, location=1.00000 0.00000 +DEAL:2D::Face=1, vertex=1, location=1.00000 1.00000 +DEAL:2D::Face=2, vertex=0, location=0.00000 0.00000 +DEAL:2D::Face=2, vertex=1, location=1.00000 0.00000 +DEAL:2D::Face=3, vertex=0, location=0.00000 1.00000 +DEAL:2D::Face=3, vertex=1, location=1.00000 1.00000 +DEAL:2D::ReferenceCell: Tri +DEAL:2D::Face=0, vertex=0, location=0.00000 0.00000 +DEAL:2D::Face=0, vertex=1, location=1.00000 0.00000 +DEAL:2D::Face=1, vertex=0, location=1.00000 0.00000 +DEAL:2D::Face=1, vertex=1, location=0.00000 1.00000 +DEAL:2D::Face=2, vertex=0, location=0.00000 1.00000 +DEAL:2D::Face=2, vertex=1, location=0.00000 0.00000 +DEAL:3D::ReferenceCell: Tet +DEAL:3D::Face=0, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=0, vertex=1, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=0, vertex=2, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=1, vertex=0, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=1, vertex=1, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=1, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=2, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=2, vertex=1, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=2, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=3, vertex=0, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=3, vertex=1, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=3, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::ReferenceCell: Pyramid +DEAL:3D::Face=0, vertex=0, location=-1.00000 -1.00000 0.00000 +DEAL:3D::Face=0, vertex=1, location=1.00000 -1.00000 0.00000 +DEAL:3D::Face=0, vertex=2, location=-1.00000 1.00000 0.00000 +DEAL:3D::Face=0, vertex=3, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=1, vertex=0, location=-1.00000 -1.00000 0.00000 +DEAL:3D::Face=1, vertex=1, location=-1.00000 1.00000 0.00000 +DEAL:3D::Face=1, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=2, vertex=0, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=2, vertex=1, location=1.00000 -1.00000 0.00000 +DEAL:3D::Face=2, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=3, vertex=0, location=1.00000 -1.00000 0.00000 +DEAL:3D::Face=3, vertex=1, location=-1.00000 -1.00000 0.00000 +DEAL:3D::Face=3, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=4, vertex=0, location=-1.00000 1.00000 0.00000 +DEAL:3D::Face=4, vertex=1, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=4, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::ReferenceCell: Wedge +DEAL:3D::Face=0, vertex=0, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=0, vertex=1, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=0, vertex=2, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=1, vertex=0, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=1, vertex=1, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=1, vertex=2, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=2, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=2, vertex=1, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=2, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=2, vertex=3, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=3, vertex=0, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=3, vertex=1, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=3, vertex=2, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=3, vertex=3, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=4, vertex=0, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=4, vertex=1, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=4, vertex=2, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=4, vertex=3, location=0.00000 0.00000 1.00000 +DEAL:3D::ReferenceCell: Hex +DEAL:3D::Face=0, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=0, vertex=1, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=0, vertex=2, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=0, vertex=3, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=1, vertex=0, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=1, vertex=1, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=1, vertex=2, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=1, vertex=3, location=1.00000 1.00000 1.00000 +DEAL:3D::Face=2, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=2, vertex=1, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=2, vertex=2, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=2, vertex=3, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=3, vertex=0, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=3, vertex=1, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=3, vertex=2, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=3, vertex=3, location=1.00000 1.00000 1.00000 +DEAL:3D::Face=4, vertex=0, location=0.00000 0.00000 0.00000 +DEAL:3D::Face=4, vertex=1, location=1.00000 0.00000 0.00000 +DEAL:3D::Face=4, vertex=2, location=0.00000 1.00000 0.00000 +DEAL:3D::Face=4, vertex=3, location=1.00000 1.00000 0.00000 +DEAL:3D::Face=5, vertex=0, location=0.00000 0.00000 1.00000 +DEAL:3D::Face=5, vertex=1, location=1.00000 0.00000 1.00000 +DEAL:3D::Face=5, vertex=2, location=0.00000 1.00000 1.00000 +DEAL:3D::Face=5, vertex=3, location=1.00000 1.00000 1.00000 -- 2.39.5