From cf2e1ff143c4925dec730ba03cb1ee7a63424427 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 6 Aug 2003 14:12:24 +0000 Subject: [PATCH] Add two new tests. git-svn-id: https://svn.dealii.org/trunk@7902 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/Makefile | 5 ++- tests/bits/cylinder.cc | 64 ++++++++++++++++++++++++++++++ tests/bits/hyper_ball_3d.cc | 77 +++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 tests/bits/cylinder.cc create mode 100644 tests/bits/hyper_ball_3d.cc diff --git a/tests/bits/Makefile b/tests/bits/Makefile index 634aba7d9b..b8dab2f59f 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -94,6 +94,8 @@ parameter_handler_1.exe : parameter_handler_1.g.$(OBJEXT) $(libraries) parameter_handler_2.exe : parameter_handler_2.g.$(OBJEXT) $(libraries) sparse_lu_decomposition_1.exe: sparse_lu_decomposition_1.g.$(OBJEXT) $(libraries) block_sparse_matrix_1.exe:block_sparse_matrix_1.g.$(OBJEXT) $(libraries) +hyper_ball_3d.exe : hyper_ball_3d.g.$(OBJEXT) $(libraries) +cylinder.exe : cylinder.g.$(OBJEXT) $(libraries) tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \ @@ -117,7 +119,8 @@ tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \ roy_1 \ denis_1 \ unit_support_points parameter_handler_1 parameter_handler_2 \ - sparse_lu_decomposition_1 block_sparse_matrix_1 + sparse_lu_decomposition_1 block_sparse_matrix_1 \ + hyper_ball_3d cylinder ############################################################ diff --git a/tests/bits/cylinder.cc b/tests/bits/cylinder.cc new file mode 100644 index 0000000000..2cbf52b405 --- /dev/null +++ b/tests/bits/cylinder.cc @@ -0,0 +1,64 @@ +//---------------------------- cylinder.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- cylinder.cc --------------------------- + +// similar to the hyper_ball_3d test, but for the cylinder grid. here, +// the cause for the failure was different, though: the description of +// the cells was wrong, and they were not sent through the +// GridReordering class which would have cured the problem. + + +#include +#include +#include +#include +#include +#include + + + +int main () +{ + std::ofstream logfile("cylinder.output"); + deallog.attach(logfile); + deallog.depth_console(0); + logfile.precision (2); + + // generate a cylinder + Triangulation<3> tria; + GridGenerator::cylinder (tria, std::sqrt(2.)); + + // output all faces. here, we + // should have 18 (two layers of + // cells, each with 4 outer faces, + // plus 5 faces each for the top + // and bottom of the cylinder) + unsigned int external_faces = 0; + for (Triangulation<3>::face_iterator face=tria.begin_face(); + face!=tria.end_face(); ++face) + { + deallog << face << " " + << (int)face->boundary_indicator() << " " + << '<' << face->vertex(0) << '>' << std::endl + << " <" << face->vertex(1) << '>' << std::endl + << " <" << face->vertex(2) << '>' << std::endl + << " <" << face->vertex(3) << '>' << std::endl; + if (face->at_boundary()) + ++external_faces; + } + + deallog << "External faces: " << external_faces << std::endl; + + Assert (external_faces == 18, ExcInternalError()); + + return 0; +} diff --git a/tests/bits/hyper_ball_3d.cc b/tests/bits/hyper_ball_3d.cc new file mode 100644 index 0000000000..6bd4dc157e --- /dev/null +++ b/tests/bits/hyper_ball_3d.cc @@ -0,0 +1,77 @@ +//---------------------------- hyper_ball_3d.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2003 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- hyper_ball_3d.cc --------------------------- + +// test that the grid generated by GridGenerator::hyper_ball<3> has +// the right number of external faces. this was not always the case, +// due to a bug in the 3d grid reordering code that didn't find a +// valid reordering, though we know that there is one. when not +// calling the grid reordering, the triangulation can generate a mesh, +// but it will have internal faces with the "external" 255 marker, +// leading to more external faces than one originally wanted + + +#include +#include +#include +#include +#include +#include + + + +int main () +{ + std::ofstream logfile("hyper_ball_3d.output"); + deallog.attach(logfile); + deallog.depth_console(0); + logfile.precision (2); + + // generate a hyperball in 3d + Triangulation<3> tria; + GridGenerator::hyper_ball (tria, Point<3>(), std::sqrt(3.)); + + // output all faces. there should + // be 6 external ones, but there + // used to be a bug in the + // triangulation code that + // generated more than that, with + // some of them internal to the + // ball + unsigned int external_faces = 0; + for (Triangulation<3>::face_iterator face=tria.begin_face(); + face!=tria.end_face(); ++face) + { + deallog << face << " " + << (int)face->boundary_indicator() << " " + << face->vertex_index(0) + << " <" << face->vertex(0) << '>' + << std::endl + << " " << face->vertex_index(1) + << " <" << face->vertex(1) << '>' + << std::endl + << " " << face->vertex_index(2) + << " <" << face->vertex(2) << '>' + << std::endl + << " " << face->vertex_index(3) + << " <" << face->vertex(3) << '>' + << std::endl; + if (face->at_boundary()) + ++external_faces; + } + + deallog << "External faces: " << external_faces << std::endl; + + Assert (external_faces == 6, ExcInternalError()); + + return 0; +} -- 2.39.5