From 7d5a7eb46c05b673f2538659d44ebc8fd081257f Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 29 Sep 2003 14:34:26 +0000 Subject: [PATCH] Add some new tests. git-svn-id: https://svn.dealii.org/trunk@8047 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/Makefile | 3 +- tests/bits/mesh_3d_10.cc | 105 +++++++++++++++++++++++++++++++++++++++ tests/bits/mesh_3d_8.cc | 104 ++++++++++++++++++++++++++++++++++++++ tests/bits/mesh_3d_9.cc | 103 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 tests/bits/mesh_3d_10.cc create mode 100644 tests/bits/mesh_3d_8.cc create mode 100644 tests/bits/mesh_3d_9.cc diff --git a/tests/bits/Makefile b/tests/bits/Makefile index d0d52be1fa..d7f143d1fd 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -112,6 +112,7 @@ mesh_3d_6.exe : mesh_3d_6.g.$(OBJEXT) $(libraries) mesh_3d_7.exe : mesh_3d_7.g.$(OBJEXT) $(libraries) mesh_3d_8.exe : mesh_3d_8.g.$(OBJEXT) $(libraries) mesh_3d_9.exe : mesh_3d_9.g.$(OBJEXT) $(libraries) +mesh_3d_10.exe : mesh_3d_10.g.$(OBJEXT) $(libraries) tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \ @@ -142,7 +143,7 @@ tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \ sparse_lu_decomposition_1 block_sparse_matrix_1 \ hyper_ball_3d cylinder coarsening_3d \ mesh_3d_1 mesh_3d_2 mesh_3d_3 mesh_3d_4 mesh_3d_5 \ - mesh_3d_6 mesh_3d_7 + mesh_3d_6 mesh_3d_7 mesh_3d_8 mesh_3d_9 mesh_3d_10 ############################################################ diff --git a/tests/bits/mesh_3d_10.cc b/tests/bits/mesh_3d_10.cc new file mode 100644 index 0000000000..df60d67573 --- /dev/null +++ b/tests/bits/mesh_3d_10.cc @@ -0,0 +1,105 @@ +//---------------------------- mesh_3d_10.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. +// +//---------------------------- mesh_3d_10.cc --------------------------- + + +// check that face orientation flags work. at one point in time we +// mixed up the generation of edges associated with faces for the +// non-standard case when refining the mesh. like in mesh_3d_10, but +// make sure that each cell has 8 distinct vertices if looking at the +// vertices of the faces + +#include "mesh_3d.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void check_this (Triangulation<3> &tria) +{ + for (Triangulation<3>::cell_iterator cell=tria.begin(); + cell != tria.end(); ++cell) + { + std::set vertices; + for (unsigned int f=0; f::faces_per_cell; ++f) + { + vertices.insert (cell->face(f)->vertex_index(0)); + vertices.insert (cell->face(f)->vertex_index(1)); + vertices.insert (cell->face(f)->vertex_index(2)); + vertices.insert (cell->face(f)->vertex_index(3)); + } + Assert (vertices.size() == 8, ExcInternalError()); + } + deallog << " ok." << std::endl; +} + + +void check (Triangulation<3> &tria) +{ + deallog << "Initial check" << std::endl; + check_this (tria); + + for (unsigned int r=0; r<3; ++r) + { + tria.refine_global (1); + deallog << "Check " << r << std::endl; + check_this (tria); + } + + coarsen_global (tria); + deallog << "Check " << 1 << std::endl; + check_this (tria); + + tria.refine_global (1); + deallog << "Check " << 2 << std::endl; + check_this (tria); +} + + +int main () +{ + std::ofstream logfile("mesh_3d_10.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + { + Triangulation<3> coarse_grid; + create_two_cubes (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + create_L_shape (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + GridGenerator::hyper_ball (coarse_grid); + check (coarse_grid); + } + +} + + + diff --git a/tests/bits/mesh_3d_8.cc b/tests/bits/mesh_3d_8.cc new file mode 100644 index 0000000000..9b7be4a7c5 --- /dev/null +++ b/tests/bits/mesh_3d_8.cc @@ -0,0 +1,104 @@ +//---------------------------- mesh_3d_8.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. +// +//---------------------------- mesh_3d_8.cc --------------------------- + + +// check that face orientation flags work. at one point in time we +// mixed up the generation of edges associated with faces for the +// non-standard case when refining the mesh. thus make sure that each +// edge only appears once in the list of edges of every cell. + +#include "mesh_3d.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void check_this (Triangulation<3> &tria) +{ + for (Triangulation<3>::cell_iterator cell=tria.begin(); + cell != tria.end(); ++cell) + { + deallog << " Cell=" << cell << std::endl; + + std::set::line_iterator> lines; + for (unsigned int l=0; l::lines_per_cell; ++l) + { + Assert (lines.find (cell->line(l)) == lines.end(), + ExcInternalError()); + lines.insert (cell->line(l)); + deallog << " line(" << l << ")=" << cell->line(l) << std::endl; + } + } +} + + +void check (Triangulation<3> &tria) +{ + deallog << "Initial check" << std::endl; + check_this (tria); + + for (unsigned int r=0; r<3; ++r) + { + tria.refine_global (1); + deallog << "Check " << r << std::endl; + check_this (tria); + } + + coarsen_global (tria); + deallog << "Check " << 1 << std::endl; + check_this (tria); + + tria.refine_global (1); + deallog << "Check " << 2 << std::endl; + check_this (tria); +} + + +int main () +{ + std::ofstream logfile("mesh_3d_8.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + { + Triangulation<3> coarse_grid; + create_two_cubes (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + create_L_shape (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + GridGenerator::hyper_ball (coarse_grid); + check (coarse_grid); + } + +} + + + diff --git a/tests/bits/mesh_3d_9.cc b/tests/bits/mesh_3d_9.cc new file mode 100644 index 0000000000..e8cf07093d --- /dev/null +++ b/tests/bits/mesh_3d_9.cc @@ -0,0 +1,103 @@ +//---------------------------- mesh_3d_9.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. +// +//---------------------------- mesh_3d_9.cc --------------------------- + + +// check that face orientation flags work. at one point in time we +// mixed up the generation of edges associated with faces for the +// non-standard case when refining the mesh. like in mesh_3d_8, but +// make sure that each cell has 8 distinct vertices if looking at the +// vertices of the edges + +#include "mesh_3d.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +void check_this (Triangulation<3> &tria) +{ + for (Triangulation<3>::cell_iterator cell=tria.begin(); + cell != tria.end(); ++cell) + { + std::set vertices; + for (unsigned int l=0; l::lines_per_cell; ++l) + { + vertices.insert (cell->line(l)->vertex_index(0)); + vertices.insert (cell->line(l)->vertex_index(1)); + } + Assert (vertices.size() == 8, ExcInternalError()); + } + deallog << " ok." << std::endl; +} + + +void check (Triangulation<3> &tria) +{ + deallog << "Initial check" << std::endl; + check_this (tria); + + for (unsigned int r=0; r<3; ++r) + { + tria.refine_global (1); + deallog << "Check " << r << std::endl; + check_this (tria); + } + + coarsen_global (tria); + deallog << "Check " << 1 << std::endl; + check_this (tria); + + tria.refine_global (1); + deallog << "Check " << 2 << std::endl; + check_this (tria); +} + + +int main () +{ + std::ofstream logfile("mesh_3d_9.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + { + Triangulation<3> coarse_grid; + create_two_cubes (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + create_L_shape (coarse_grid); + check (coarse_grid); + } + + { + Triangulation<3> coarse_grid; + GridGenerator::hyper_ball (coarse_grid); + check (coarse_grid); + } + +} + + + -- 2.39.5