From d288c5bb1a0390d7cd7a86e659a27714ee6b6e32 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 10 Oct 2009 17:00:48 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@19807 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/subdomain_ids_08.cc | 117 ++++++++++++++++++++++++ tests/bits/subdomain_ids_08/cmp/generic | 24 +++++ 2 files changed, 141 insertions(+) create mode 100644 tests/bits/subdomain_ids_08.cc create mode 100644 tests/bits/subdomain_ids_08/cmp/generic diff --git a/tests/bits/subdomain_ids_08.cc b/tests/bits/subdomain_ids_08.cc new file mode 100644 index 0000000000..719ddab085 --- /dev/null +++ b/tests/bits/subdomain_ids_08.cc @@ -0,0 +1,117 @@ +//---------------------------- subdomain_ids_08.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 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_08.cc --------------------------- + +// check DoFTools::dof_indices_with_subdomain_association. after +// reordering based on subdomain, the index range should be contiguous + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("subdomain_ids_08/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); + }; + + // distribute some degrees of freedom and + // output some information on them + FESystem fe(FE_Q(2),dim, FE_DGQ(1), 1); + DoFHandler dof_handler (tria); + dof_handler.distribute_dofs (fe); + deallog << dof_handler.n_dofs() << std::endl; + + + DoFRenumbering::subdomain_wise (dof_handler); + + std::vector subdomain_association (dof_handler.n_dofs()); + DoFTools::get_subdomain_association (dof_handler, + subdomain_association); + for (unsigned int subdomain=0; subdomain<(1< (); + test<2> (); + test<3> (); + + return 0; +} diff --git a/tests/bits/subdomain_ids_08/cmp/generic b/tests/bits/subdomain_ids_08/cmp/generic new file mode 100644 index 0000000000..04d0daf75e --- /dev/null +++ b/tests/bits/subdomain_ids_08/cmp/generic @@ -0,0 +1,24 @@ + +DEAL::1D +DEAL::17 +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::OK +DEAL::2D +DEAL::226 +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::OK +DEAL::3D +DEAL::2699 +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::Index set is contiguous. +DEAL::OK -- 2.39.5