From 1ccf8f0b7c47829704976322f21f7cc40f2b1111 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 9 Mar 2004 21:01:40 +0000 Subject: [PATCH] New tests. git-svn-id: https://svn.dealii.org/trunk@8708 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/subdomain_ids_01.cc | 6 -- tests/bits/subdomain_ids_02.cc | 6 -- tests/bits/subdomain_ids_03.cc | 92 +++++++++++++++++++++++++++ tests/bits/subdomain_ids_04.cc | 113 +++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+), 12 deletions(-) create mode 100644 tests/bits/subdomain_ids_03.cc create mode 100644 tests/bits/subdomain_ids_04.cc diff --git a/tests/bits/subdomain_ids_01.cc b/tests/bits/subdomain_ids_01.cc index 07c80742c3..0506548be4 100644 --- a/tests/bits/subdomain_ids_01.cc +++ b/tests/bits/subdomain_ids_01.cc @@ -35,12 +35,6 @@ std::ofstream logfile("subdomain_ids_01.output"); -DeclException2 (ExcNumberMismatch, - int, int, - << "The numbers " << arg1 << " and " << arg2 - << " should be equal, but are not."); - - template void test () { diff --git a/tests/bits/subdomain_ids_02.cc b/tests/bits/subdomain_ids_02.cc index f646b6d0b6..597ac2ecf1 100644 --- a/tests/bits/subdomain_ids_02.cc +++ b/tests/bits/subdomain_ids_02.cc @@ -35,12 +35,6 @@ std::ofstream logfile("subdomain_ids_02.output"); -DeclException2 (ExcNumberMismatch, - int, int, - << "The numbers " << arg1 << " and " << arg2 - << " should be equal, but are not."); - - template void test () { diff --git a/tests/bits/subdomain_ids_03.cc b/tests/bits/subdomain_ids_03.cc new file mode 100644 index 0000000000..56bc4838b8 --- /dev/null +++ b/tests/bits/subdomain_ids_03.cc @@ -0,0 +1,92 @@ +//---------------------------- subdomain_ids_03.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_03.cc --------------------------- + +// check DoFRenumbering::compute_subdomain_wise + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("subdomain_ids_03.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; + + std::vector new_indices (dof_handler.n_dofs()); + DoFRenumbering::compute_subdomain_wise (new_indices, dof_handler); + + for (unsigned int i=0; i (); + test<2> (); + test<3> (); + + return 0; +} diff --git a/tests/bits/subdomain_ids_04.cc b/tests/bits/subdomain_ids_04.cc new file mode 100644 index 0000000000..cf2584316c --- /dev/null +++ b/tests/bits/subdomain_ids_04.cc @@ -0,0 +1,113 @@ +//---------------------------- subdomain_ids_04.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_04.cc --------------------------- + +// check DoFRenumbering::subdomain_wise + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +std::ofstream logfile("subdomain_ids_04.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; + + // renumber by subdomain + DoFRenumbering::subdomain_wise (dof_handler); + + // then get the subdomain association of + // all dofs. this should yield consecutive + // regions of dofs with increasing + // subdomain numbers. first output these + // numbers, then also check that this is + // indeed so + std::vector subdomain_association (dof_handler.n_dofs()); + DoFTools::get_subdomain_association (dof_handler, subdomain_association); + + for (unsigned int i=0; i (); + test<2> (); + test<3> (); + + return 0; +} -- 2.39.5