From 3261802f3a9372b8948c0268e86a4988fde1dccf Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 1 Apr 2004 20:41:39 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@8952 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/subdomain_ids_06.cc | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 tests/bits/subdomain_ids_06.cc diff --git a/tests/bits/subdomain_ids_06.cc b/tests/bits/subdomain_ids_06.cc new file mode 100644 index 0000000000..00e8ff9a09 --- /dev/null +++ b/tests/bits/subdomain_ids_06.cc @@ -0,0 +1,104 @@ +//---------------------------- subdomain_ids_06.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2001, 2002, 2003, 2004 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_ids_06.cc --------------------------- + +// check GridTools::count_cells_with_subdomain_association + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("subdomain_ids_06.output"); + + +template +void test () +{ + deallog << dim << 'D' << std::endl; + Triangulation tria; + GridGenerator::hyper_cube(tria, -1, 1); + tria.refine_global (2); + + // we now have a number of cells, + // flag them with some subdomain + // ids based on their position, in + // particular we take the quadrant + // (octant) + typename Triangulation::active_cell_iterator + cell = tria.begin_active (), + endc = tria.end (); + for (; cell!=endc; ++cell) + { + unsigned int subdomain = 0; + for (unsigned int d=0; dcenter()(d) > 0) + subdomain |= (1<set_subdomain_id (subdomain); + } + + std::vector subdomain_association (tria.n_active_cells()); + GridTools::get_subdomain_association (tria, + subdomain_association); + for (unsigned int subdomain=0; subdomain<(1< + (std::count (subdomain_association.begin(), + subdomain_association.end(), subdomain)) + == + GridTools::count_cells_with_subdomain_association (tria, + subdomain), + ExcInternalError()); + + // ...and that this is also the correct + // number + Assert (GridTools::count_cells_with_subdomain_association (tria, + subdomain) + == (tria.n_active_cells() / (1< (); + test<2> (); + test<3> (); + + return 0; +} -- 2.39.5