From: bangerth Date: Wed, 29 Oct 2008 22:49:41 +0000 (+0000) Subject: Add simpler test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=015d374a7981f7ac029b7c8a6c57d9389b79c624;p=dealii-svn.git Add simpler test. git-svn-id: https://svn.dealii.org/trunk@17405 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/Makefile b/tests/deal.II/Makefile index d1b2f64881..1c6deb6e6b 100644 --- a/tests/deal.II/Makefile +++ b/tests/deal.II/Makefile @@ -80,7 +80,7 @@ tests_x = block_matrices \ rt_hessian \ rt_covariant \ coarsening_* \ - number_cache + number_cache_* # from above list of regular expressions, generate the real set of # tests diff --git a/tests/deal.II/number_cache/cmp/generic b/tests/deal.II/number_cache/cmp/generic deleted file mode 100644 index 0ce9e3a50a..0000000000 --- a/tests/deal.II/number_cache/cmp/generic +++ /dev/null @@ -1,301 +0,0 @@ - -DEAL::Reading grid_in/2d.xda -DEAL:: 29037 -DEAL:: 29037 -DEAL:: 58529 -DEAL:: 58529 -DEAL:: 29037 -DEAL:: 29037 -DEAL:: 0 -DEAL:: 0 -DEAL:: 29037 -DEAL:: 29037 -DEAL:: 29037 -DEAL:: 29037 -DEAL:: Refining... -DEAL:: 29070 -DEAL:: 29081 -DEAL:: 58603 -DEAL:: 58633 -DEAL:: 29070 -DEAL:: 29081 -DEAL:: 0 -DEAL:: 0 -DEAL:: 29026 -DEAL:: 29037 -DEAL:: 29026 -DEAL:: 29037 -DEAL:: 44 -DEAL:: 44 -DEAL:: 44 -DEAL:: 44 -DEAL::Reading grid_in_3d/1.in -DEAL:: 16480 -DEAL:: 16480 -DEAL:: 54668 -DEAL:: 54668 -DEAL:: 52008 -DEAL:: 52008 -DEAL:: 16480 -DEAL:: 16480 -DEAL:: 16480 -DEAL:: 16480 -DEAL:: 16480 -DEAL:: 16480 -DEAL:: Refining... -DEAL:: 16557 -DEAL:: 16568 -DEAL:: 55050 -DEAL:: 55142 -DEAL:: 52308 -DEAL:: 52364 -DEAL:: 16557 -DEAL:: 16568 -DEAL:: 16469 -DEAL:: 16480 -DEAL:: 16469 -DEAL:: 16480 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL::Reading grid_in_3d/2.in -DEAL:: 360 -DEAL:: 360 -DEAL:: 1390 -DEAL:: 1390 -DEAL:: 1218 -DEAL:: 1218 -DEAL:: 360 -DEAL:: 360 -DEAL:: 360 -DEAL:: 360 -DEAL:: 360 -DEAL:: 360 -DEAL:: Refining... -DEAL:: 437 -DEAL:: 448 -DEAL:: 1732 -DEAL:: 1808 -DEAL:: 1500 -DEAL:: 1550 -DEAL:: 437 -DEAL:: 448 -DEAL:: 349 -DEAL:: 360 -DEAL:: 349 -DEAL:: 360 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL::Reading grid_in_3d/3.in -DEAL:: 2 -DEAL:: 2 -DEAL:: 20 -DEAL:: 20 -DEAL:: 11 -DEAL:: 11 -DEAL:: 2 -DEAL:: 2 -DEAL:: 2 -DEAL:: 2 -DEAL:: 2 -DEAL:: 2 -DEAL:: Refining... -DEAL:: 9 -DEAL:: 10 -DEAL:: 62 -DEAL:: 74 -DEAL:: 41 -DEAL:: 47 -DEAL:: 9 -DEAL:: 10 -DEAL:: 1 -DEAL:: 2 -DEAL:: 1 -DEAL:: 2 -DEAL:: 8 -DEAL:: 8 -DEAL:: 8 -DEAL:: 8 -DEAL::Reading grid_in_3d/4.in -DEAL:: 13824 -DEAL:: 13824 -DEAL:: 44210 -DEAL:: 44210 -DEAL:: 42816 -DEAL:: 42816 -DEAL:: 13824 -DEAL:: 13824 -DEAL:: 13824 -DEAL:: 13824 -DEAL:: 13824 -DEAL:: 13824 -DEAL:: Refining... -DEAL:: 13901 -DEAL:: 13912 -DEAL:: 44578 -DEAL:: 44664 -DEAL:: 43110 -DEAL:: 43164 -DEAL:: 13901 -DEAL:: 13912 -DEAL:: 13813 -DEAL:: 13824 -DEAL:: 13813 -DEAL:: 13824 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL:: 88 -DEAL::Reading grid_in_3d/evil_0.in -DEAL:: 10 -DEAL:: 10 -DEAL:: 80 -DEAL:: 80 -DEAL:: 50 -DEAL:: 50 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: Refining... -DEAL:: 38 -DEAL:: 42 -DEAL:: 224 -DEAL:: 260 -DEAL:: 161 -DEAL:: 182 -DEAL:: 38 -DEAL:: 42 -DEAL:: 6 -DEAL:: 10 -DEAL:: 6 -DEAL:: 10 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL::Reading grid_in_3d/evil_1.in -DEAL:: 10 -DEAL:: 10 -DEAL:: 80 -DEAL:: 80 -DEAL:: 50 -DEAL:: 50 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: Refining... -DEAL:: 38 -DEAL:: 42 -DEAL:: 224 -DEAL:: 260 -DEAL:: 161 -DEAL:: 182 -DEAL:: 38 -DEAL:: 42 -DEAL:: 6 -DEAL:: 10 -DEAL:: 6 -DEAL:: 10 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL::Reading grid_in_3d/evil_2.in -DEAL:: 10 -DEAL:: 10 -DEAL:: 80 -DEAL:: 80 -DEAL:: 50 -DEAL:: 50 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: Refining... -DEAL:: 38 -DEAL:: 42 -DEAL:: 224 -DEAL:: 260 -DEAL:: 161 -DEAL:: 182 -DEAL:: 38 -DEAL:: 42 -DEAL:: 6 -DEAL:: 10 -DEAL:: 6 -DEAL:: 10 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL::Reading grid_in_3d/evil_3.in -DEAL:: 10 -DEAL:: 10 -DEAL:: 80 -DEAL:: 80 -DEAL:: 50 -DEAL:: 50 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: Refining... -DEAL:: 38 -DEAL:: 42 -DEAL:: 224 -DEAL:: 260 -DEAL:: 161 -DEAL:: 182 -DEAL:: 38 -DEAL:: 42 -DEAL:: 6 -DEAL:: 10 -DEAL:: 6 -DEAL:: 10 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL::Reading grid_in_3d/evil_4.in -DEAL:: 10 -DEAL:: 10 -DEAL:: 80 -DEAL:: 80 -DEAL:: 50 -DEAL:: 50 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: 10 -DEAL:: Refining... -DEAL:: 38 -DEAL:: 42 -DEAL:: 224 -DEAL:: 260 -DEAL:: 161 -DEAL:: 182 -DEAL:: 38 -DEAL:: 42 -DEAL:: 6 -DEAL:: 10 -DEAL:: 6 -DEAL:: 10 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 -DEAL:: 32 diff --git a/tests/deal.II/number_cache_01.cc b/tests/deal.II/number_cache_01.cc new file mode 100644 index 0000000000..343e4da20d --- /dev/null +++ b/tests/deal.II/number_cache_01.cc @@ -0,0 +1,106 @@ +//---------------------------- number_cache_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008 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. +// +//---------------------------- number_cache_01.cc --------------------------- + + +// test that we correctly compute the number of lines, quads, hexes, etc and +// store them in the number cache of the Triangulation class. use a simple +// grid for this + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +std::ofstream logfile("number_cache_01/output"); + + + +template +void output (const Triangulation &tria) +{ + + deallog << " " << tria.n_active_cells() << std::endl; + deallog << " " << tria.n_cells() << std::endl; + deallog << " " << tria.n_active_lines() << std::endl; + deallog << " " << tria.n_lines() << std::endl; + deallog << " " << tria.n_active_quads() << std::endl; + deallog << " " << tria.n_quads() << std::endl; + deallog << " " << tria.n_active_hexs() << std::endl; + deallog << " " << tria.n_hexs() << std::endl; + + for (unsigned int i=0; i +void test () +{ + deallog << dim << "d" << std::endl; + + Triangulation tria; + GridGenerator::hyper_cube (tria); + + output (tria); + + deallog << "Refining..." << std::endl; + + tria.begin_active()->set_refine_flag (); + tria.execute_coarsening_and_refinement (); + + output (tria); +} + + +int main () +{ + deallog << std::setprecision (2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1> (); + test<2> (); + test<3> (); +} + diff --git a/tests/deal.II/number_cache/1.in b/tests/deal.II/number_cache_01/1.in similarity index 100% rename from tests/deal.II/number_cache/1.in rename to tests/deal.II/number_cache_01/1.in diff --git a/tests/deal.II/number_cache/1.nc b/tests/deal.II/number_cache_01/1.nc similarity index 100% rename from tests/deal.II/number_cache/1.nc rename to tests/deal.II/number_cache_01/1.nc diff --git a/tests/deal.II/number_cache/2.in b/tests/deal.II/number_cache_01/2.in similarity index 100% rename from tests/deal.II/number_cache/2.in rename to tests/deal.II/number_cache_01/2.in diff --git a/tests/deal.II/number_cache/3.in b/tests/deal.II/number_cache_01/3.in similarity index 100% rename from tests/deal.II/number_cache/3.in rename to tests/deal.II/number_cache_01/3.in diff --git a/tests/deal.II/number_cache/4.in b/tests/deal.II/number_cache_01/4.in similarity index 100% rename from tests/deal.II/number_cache/4.in rename to tests/deal.II/number_cache_01/4.in diff --git a/tests/deal.II/number_cache_01/cmp/generic b/tests/deal.II/number_cache_01/cmp/generic new file mode 100644 index 0000000000..b2a4130c09 --- /dev/null +++ b/tests/deal.II/number_cache_01/cmp/generic @@ -0,0 +1,91 @@ + +DEAL::1d +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL::Refining... +DEAL:: 2 +DEAL:: 3 +DEAL:: 2 +DEAL:: 3 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 1 +DEAL:: 0 +DEAL:: 1 +DEAL:: 2 +DEAL:: 2 +DEAL:: 2 +DEAL:: 2 +DEAL::2d +DEAL:: 1 +DEAL:: 1 +DEAL:: 4 +DEAL:: 4 +DEAL:: 1 +DEAL:: 1 +DEAL:: 0 +DEAL:: 0 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL::Refining... +DEAL:: 4 +DEAL:: 5 +DEAL:: 12 +DEAL:: 16 +DEAL:: 4 +DEAL:: 5 +DEAL:: 0 +DEAL:: 0 +DEAL:: 0 +DEAL:: 1 +DEAL:: 0 +DEAL:: 1 +DEAL:: 4 +DEAL:: 4 +DEAL:: 4 +DEAL:: 4 +DEAL::3d +DEAL:: 1 +DEAL:: 1 +DEAL:: 12 +DEAL:: 12 +DEAL:: 6 +DEAL:: 6 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL:: 1 +DEAL::Refining... +DEAL:: 8 +DEAL:: 9 +DEAL:: 54 +DEAL:: 66 +DEAL:: 36 +DEAL:: 42 +DEAL:: 8 +DEAL:: 9 +DEAL:: 0 +DEAL:: 1 +DEAL:: 0 +DEAL:: 1 +DEAL:: 8 +DEAL:: 8 +DEAL:: 8 +DEAL:: 8 diff --git a/tests/deal.II/number_cache/evil_0.in b/tests/deal.II/number_cache_01/evil_0.in similarity index 100% rename from tests/deal.II/number_cache/evil_0.in rename to tests/deal.II/number_cache_01/evil_0.in diff --git a/tests/deal.II/number_cache/evil_1.in b/tests/deal.II/number_cache_01/evil_1.in similarity index 100% rename from tests/deal.II/number_cache/evil_1.in rename to tests/deal.II/number_cache_01/evil_1.in diff --git a/tests/deal.II/number_cache/evil_2.in b/tests/deal.II/number_cache_01/evil_2.in similarity index 100% rename from tests/deal.II/number_cache/evil_2.in rename to tests/deal.II/number_cache_01/evil_2.in diff --git a/tests/deal.II/number_cache/evil_3.in b/tests/deal.II/number_cache_01/evil_3.in similarity index 100% rename from tests/deal.II/number_cache/evil_3.in rename to tests/deal.II/number_cache_01/evil_3.in diff --git a/tests/deal.II/number_cache/evil_4.in b/tests/deal.II/number_cache_01/evil_4.in similarity index 100% rename from tests/deal.II/number_cache/evil_4.in rename to tests/deal.II/number_cache_01/evil_4.in diff --git a/tests/deal.II/number_cache_02.cc b/tests/deal.II/number_cache_02.cc new file mode 100644 index 0000000000..2cfcaa1904 --- /dev/null +++ b/tests/deal.II/number_cache_02.cc @@ -0,0 +1,133 @@ +//---------------------------- number_cache_02.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008 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. +// +//---------------------------- number_cache_02.cc --------------------------- + + +// test that we correctly compute the number of lines, quads, hexes, etc and +// store them in the number cache of the Triangulation class. use the meshes +// from grid_in (2d) and grid_in_3d (3d) for this + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +std::ofstream logfile("number_cache_02/output"); + + + +template +void output (const Triangulation &tria) +{ + + deallog << " " << tria.n_active_cells() << std::endl; + deallog << " " << tria.n_cells() << std::endl; + deallog << " " << tria.n_active_lines() << std::endl; + deallog << " " << tria.n_lines() << std::endl; + deallog << " " << tria.n_active_quads() << std::endl; + deallog << " " << tria.n_quads() << std::endl; + deallog << " " << tria.n_active_hexs() << std::endl; + deallog << " " << tria.n_hexs() << std::endl; + + for (unsigned int i=0; i +void test (const char *filename) +{ + deallog << "Reading " << filename << std::endl; + + Triangulation tria; + GridIn gi; + gi.attach_triangulation (tria); + std::ifstream in (filename); + + try + { + gi.read_xda (in); + } + catch (std::exception &exc) + { + deallog << " caught exception:" << std::endl + << exc.what() + << std::endl; + return; + } + + output (tria); + + // now refine a few cells and output again + deallog << " Refining..." << std::endl; + typename Triangulation::active_cell_iterator + cell = tria.begin_active(); + for (unsigned int i=0; i<=std::min (tria.n_active_cells() / 3, + 10U); ++i, ++cell) + cell->set_refine_flag (); + tria.execute_coarsening_and_refinement (); + + output (tria); +} + + +int main () +{ + deallog << std::setprecision (2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<2> ("grid_in/2d.xda"); + + test<3> ("grid_in_3d/1.in"); + test<3> ("grid_in_3d/2.in"); + test<3> ("grid_in_3d/3.in"); + test<3> ("grid_in_3d/4.in"); + + test<3> ("grid_in_3d/evil_0.in"); + test<3> ("grid_in_3d/evil_1.in"); + test<3> ("grid_in_3d/evil_2.in"); + test<3> ("grid_in_3d/evil_3.in"); + test<3> ("grid_in_3d/evil_4.in"); +} +