From 5f964c544c6628705ffbb959b631e5149bdd62ae Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 9 Mar 2004 17:32:48 +0000 Subject: [PATCH] New tests. git-svn-id: https://svn.dealii.org/trunk@8703 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/Makefile | 3 +- tests/bits/subdomain_ids_01.cc | 106 ++++++++++++++++ tests/bits/subdomain_ids_02.cc | 115 ++++++++++++++++++ .../bits/subdomain_ids_01.output | 21 ++++ .../bits/subdomain_ids_02.output | 21 ++++ 5 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 tests/bits/subdomain_ids_01.cc create mode 100644 tests/bits/subdomain_ids_02.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_01.output create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_02.output diff --git a/tests/bits/Makefile b/tests/bits/Makefile index 892f3bc824..449742f13d 100644 --- a/tests/bits/Makefile +++ b/tests/bits/Makefile @@ -51,7 +51,8 @@ tests_x = anna_? \ full_matrix_vector_* \ solver_selector \ deal_solver_* \ - vector_* + vector_* \ + subdomain_ids_* ifeq ($(USE_CONTRIB_PETSC),yes) tests_x += petsc_* diff --git a/tests/bits/subdomain_ids_01.cc b/tests/bits/subdomain_ids_01.cc new file mode 100644 index 0000000000..07c80742c3 --- /dev/null +++ b/tests/bits/subdomain_ids_01.cc @@ -0,0 +1,106 @@ +//---------------------------- subdomain_ids_01.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_01.cc --------------------------- + +// check DoFTools::extract_subdomain_dofs + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +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 () +{ + 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 selected_dofs (dof_handler.n_dofs()); + for (unsigned int subdomain=0; subdomain<(1< (); + test<2> (); + test<3> (); + + return 0; +} diff --git a/tests/bits/subdomain_ids_02.cc b/tests/bits/subdomain_ids_02.cc new file mode 100644 index 0000000000..f646b6d0b6 --- /dev/null +++ b/tests/bits/subdomain_ids_02.cc @@ -0,0 +1,115 @@ +//---------------------------- subdomain_ids_02.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_02.cc --------------------------- + +// check DoFTools::get_subdomain_association + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +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 () +{ + 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 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/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_01.output new file mode 100644 index 0000000000..df72e56412 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_01.output @@ -0,0 +1,21 @@ + +DEAL::1D +DEAL::17 +DEAL::9 +DEAL::9 +DEAL::2D +DEAL::226 +DEAL::66 +DEAL::66 +DEAL::66 +DEAL::66 +DEAL::3D +DEAL::2699 +DEAL::439 +DEAL::439 +DEAL::439 +DEAL::439 +DEAL::439 +DEAL::439 +DEAL::439 +DEAL::439 diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_02.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_02.output new file mode 100644 index 0000000000..6a90d09141 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/subdomain_ids_02.output @@ -0,0 +1,21 @@ + +DEAL::1D +DEAL::65 +DEAL::32 +DEAL::33 +DEAL::2D +DEAL::3202 +DEAL::768 +DEAL::800 +DEAL::834 +DEAL::800 +DEAL::3D +DEAL::140579 +DEAL::16384 +DEAL::17152 +DEAL::17152 +DEAL::17968 +DEAL::17968 +DEAL::17152 +DEAL::18835 +DEAL::17968 -- 2.39.5