From 13c2c4cc2b49de9345f2130a8b0166d48afc96ed Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 25 Aug 2010 16:12:46 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@21711 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/Makefile | 2 +- tests/deal.II/subdomain_on_refinement.cc | 71 +++++++++++++++++++ .../subdomain_on_refinement/cmp/generic | 4 ++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 tests/deal.II/subdomain_on_refinement.cc create mode 100644 tests/deal.II/subdomain_on_refinement/cmp/generic diff --git a/tests/deal.II/Makefile b/tests/deal.II/Makefile index 53a5037840..135a11efd6 100644 --- a/tests/deal.II/Makefile +++ b/tests/deal.II/Makefile @@ -57,7 +57,7 @@ tests_x = block_info block_matrices \ boundaries \ sparsity_pattern* \ grid_tools \ - subdomain_ids \ + subdomain_* \ filtered_iterator* \ grid_in* \ grid_in_3d \ diff --git a/tests/deal.II/subdomain_on_refinement.cc b/tests/deal.II/subdomain_on_refinement.cc new file mode 100644 index 0000000000..80d8567fe5 --- /dev/null +++ b/tests/deal.II/subdomain_on_refinement.cc @@ -0,0 +1,71 @@ +//---------------------------- subdomain_on_refinement.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2001, 2002, 2003, 2004, 2005 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. +// +//---------------------------- subdomain_on_refinement.cc --------------------------- + +// check that the subdomain id is inherited from mother to child + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("subdomain_on_refinement/output"); + + +DeclException2 (ExcNumberMismatch, + int, int, + << "The numbers " << arg1 << " and " << arg2 + << " should be equal, but are not."); + + +template +void test () +{ + Triangulation tria; + GridGenerator::hyper_cube(tria, -1, 1); + tria.begin_active()->set_subdomain_id (42); + tria.refine_global (2); + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end (); + for (; cell!=endc; ++cell) + Assert (cell->subdomain_id() == 42, + ExcInternalError()); + deallog << "OK" << std::endl; +} + + +int main () +{ + deallog << std::setprecision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test<1> (); + test<2> (); + test<3> (); + + return 0; +} diff --git a/tests/deal.II/subdomain_on_refinement/cmp/generic b/tests/deal.II/subdomain_on_refinement/cmp/generic new file mode 100644 index 0000000000..fb71de2867 --- /dev/null +++ b/tests/deal.II/subdomain_on_refinement/cmp/generic @@ -0,0 +1,4 @@ + +DEAL::OK +DEAL::OK +DEAL::OK -- 2.39.5