From a0076fb5f7772595b004b8621293842beb8bb008 Mon Sep 17 00:00:00 2001 From: kanschat Date: Tue, 19 Oct 2010 19:46:54 +0000 Subject: [PATCH] add test for BlockList git-svn-id: https://svn.dealii.org/trunk@22388 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/deal.II/block_info.cc | 6 +-- tests/deal.II/block_list_01.cc | 67 +++++++++++++++++++++++++ tests/deal.II/block_list_01/cmp/generic | 52 +++++++++++++++++++ tests/deal.II/newton_01.cc | 8 +-- 4 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 tests/deal.II/block_list_01.cc create mode 100644 tests/deal.II/block_list_01/cmp/generic diff --git a/tests/deal.II/block_info.cc b/tests/deal.II/block_info.cc index 705f22ce25..a60170c5d7 100644 --- a/tests/deal.II/block_info.cc +++ b/tests/deal.II/block_info.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2009 by the deal.II authors +// Copyright (C) 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -12,7 +12,6 @@ //---------------------------------------------------------------------- #include "../tests.h" -#include #include #include #include @@ -81,7 +80,8 @@ void test_fe (const FiniteElement& fe) int main () { - std::ofstream logfile("block_info/output"); + std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + std::ofstream logfile(logname.c_str()); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/deal.II/block_list_01.cc b/tests/deal.II/block_list_01.cc new file mode 100644 index 0000000000..a89eed199b --- /dev/null +++ b/tests/deal.II/block_list_01.cc @@ -0,0 +1,67 @@ +//---------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2009, 2010 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. +// +//---------------------------------------------------------------------- + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace dealii; + + +template +void +test_block_list(const Triangulation& tr, const FiniteElement& fe) +{ + deallog << fe.get_name() << std::endl; + + DoFHandler dof; + dof.initialize(tr, fe); + + BlockList bl; + bl.initialize(tr.n_active_cells(), dof.begin_active(), dof.end()); + + for (unsigned int i=0;i tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(2); + FE_Q<2> fe1(1); + FE_Q<2> fe2(2); + FE_RaviartThomas<2> fe3(0); + + test_block_list(tr, fe1); + test_block_list(tr, fe2); + test_block_list(tr, fe3); +} diff --git a/tests/deal.II/block_list_01/cmp/generic b/tests/deal.II/block_list_01/cmp/generic new file mode 100644 index 0000000000..71d0a576e3 --- /dev/null +++ b/tests/deal.II/block_list_01/cmp/generic @@ -0,0 +1,52 @@ + +DEAL::FE_Q<2>(1) +DEAL::Block 0 0 1 2 3 +DEAL::Block 1 1 4 3 5 +DEAL::Block 2 2 3 6 7 +DEAL::Block 3 3 5 7 8 +DEAL::Block 4 4 9 5 10 +DEAL::Block 5 9 11 10 12 +DEAL::Block 6 5 10 8 13 +DEAL::Block 7 10 12 13 14 +DEAL::Block 8 6 7 15 16 +DEAL::Block 9 7 8 16 17 +DEAL::Block 10 15 16 18 19 +DEAL::Block 11 16 17 19 20 +DEAL::Block 12 8 13 17 21 +DEAL::Block 13 13 14 21 22 +DEAL::Block 14 17 21 20 23 +DEAL::Block 15 21 22 23 24 +DEAL::FE_Q<2>(2) +DEAL::Block 0 0 1 2 3 4 5 6 7 8 +DEAL::Block 1 1 9 3 10 5 11 12 13 14 +DEAL::Block 2 2 3 15 16 17 18 7 19 20 +DEAL::Block 3 3 10 16 21 18 22 13 23 24 +DEAL::Block 4 9 25 10 26 11 27 28 29 30 +DEAL::Block 5 25 31 26 32 27 33 34 35 36 +DEAL::Block 6 10 26 21 37 22 38 29 39 40 +DEAL::Block 7 26 32 37 41 38 42 35 43 44 +DEAL::Block 8 15 16 45 46 47 48 19 49 50 +DEAL::Block 9 16 21 46 51 48 52 23 53 54 +DEAL::Block 10 45 46 55 56 57 58 49 59 60 +DEAL::Block 11 46 51 56 61 58 62 53 63 64 +DEAL::Block 12 21 37 51 65 52 66 39 67 68 +DEAL::Block 13 37 41 65 69 66 70 43 71 72 +DEAL::Block 14 51 65 61 73 62 74 67 75 76 +DEAL::Block 15 65 69 73 77 74 78 71 79 80 +DEAL::FE_RaviartThomas<2>(0) +DEAL::Block 0 0 1 2 3 +DEAL::Block 1 1 4 5 6 +DEAL::Block 2 7 8 3 9 +DEAL::Block 3 8 10 6 11 +DEAL::Block 4 4 12 13 14 +DEAL::Block 5 12 15 16 17 +DEAL::Block 6 10 18 14 19 +DEAL::Block 7 18 20 17 21 +DEAL::Block 8 22 23 9 24 +DEAL::Block 9 23 25 11 26 +DEAL::Block 10 27 28 24 29 +DEAL::Block 11 28 30 26 31 +DEAL::Block 12 25 32 19 33 +DEAL::Block 13 32 34 21 35 +DEAL::Block 14 30 36 33 37 +DEAL::Block 15 36 38 35 39 diff --git a/tests/deal.II/newton_01.cc b/tests/deal.II/newton_01.cc index f14efdf6ce..9b7dca1c0f 100644 --- a/tests/deal.II/newton_01.cc +++ b/tests/deal.II/newton_01.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2008, 2009 by the deal.II authors +// Copyright (C) 2008, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -11,6 +11,7 @@ // //----------------------------------------------------------------------------- +#include "../tests.h" #include #include #include @@ -125,9 +126,10 @@ void test () int main() { - std::ofstream logfile("newton_01/output"); + std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output"); + std::ofstream logfile(logname.c_str()); deallog.attach(logfile); - deallog.depth_console(10); + deallog.depth_console(0); deallog.threshold_double(1.e-10); test (); -- 2.39.5