From e1389de6a6ecd01d726d8fd5aefd9c10b7e78840 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 7 Jun 2010 21:29:49 +0000 Subject: [PATCH] Merge tests from branch_distributed_grids. git-svn-id: https://svn.dealii.org/trunk@21172 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/Makefile | 1 + ...ed_simple_sparsity_pattern_index_set_01.cc | 33 +++ .../cmp/generic | 203 +++++++++++++++++ ...ed_simple_sparsity_pattern_index_set_02.cc | 33 +++ .../cmp/generic | 208 ++++++++++++++++++ tests/lac/is_block_vector.cc | 77 +++++++ tests/lac/is_block_vector/cmp/generic | 2 + tests/lac/sparsity_pattern_common.h | 78 +++++-- 8 files changed, 619 insertions(+), 16 deletions(-) create mode 100644 tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc create mode 100644 tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic create mode 100644 tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc create mode 100644 tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic create mode 100644 tests/lac/is_block_vector.cc create mode 100644 tests/lac/is_block_vector/cmp/generic diff --git a/tests/lac/Makefile b/tests/lac/Makefile index 4507204acd..c5dace6c55 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -42,6 +42,7 @@ tests_x = vector-vector vector_memory \ block_vector_* \ block_matrices \ is_block_matrix \ + is_block_vector \ matrix_lib \ matrix_out \ pointer_matrix \ diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc b/tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc new file mode 100644 index 0000000000..f6727915e3 --- /dev/null +++ b/tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc @@ -0,0 +1,33 @@ +//-------------------------- compressed_simple_sparsity_pattern_index_set_01.cc ---------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008, 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. +// +//-------------------------- compressed_simple_sparsity_pattern_index_set_01.cc ---------------------- + + +// check CompressedSimpleSparsityPattern with an IndexSet that stores +// a contiguous range + +#include "sparsity_pattern_common.h" + +int main () +{ + std::ofstream logfile("compressed_simple_sparsity_pattern_index_set_01/output"); + logfile.setf(std::ios::fixed); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test_index_set (true); +} + + + diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic b/tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic new file mode 100644 index 0000000000..95ea192e14 --- /dev/null +++ b/tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic @@ -0,0 +1,203 @@ + +DEAL::3 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 4 +DEAL:: columns=4 5 6 19 +DEAL::4 4 +DEAL:: columns=5 6 7 20 +DEAL::4 4 +DEAL:: columns=6 7 8 21 +DEAL::4 4 +DEAL:: columns=7 8 9 22 +DEAL::4 4 +DEAL:: columns=8 9 10 23 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +D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AL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::OK diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc b/tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc new file mode 100644 index 0000000000..3470ac1525 --- /dev/null +++ b/tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc @@ -0,0 +1,33 @@ +//-------------------------- compressed_simple_sparsity_pattern_index_set_02.cc ---------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008, 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. +// +//-------------------------- compressed_simple_sparsity_pattern_index_set_02.cc ---------------------- + + +// check CompressedSimpleSparsityPattern with an IndexSet that stores +// a non-contiguous range + +#include "sparsity_pattern_common.h" + +int main () +{ + std::ofstream logfile("compressed_simple_sparsity_pattern_index_set_02/output"); + logfile.setf(std::ios::fixed); + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test_index_set (false); +} + + + diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic b/tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic new file mode 100644 index 0000000000..40817feca9 --- /dev/null +++ b/tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic @@ -0,0 +1,208 @@ + +DEAL::3 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 4 +DEAL:: columns=4 5 6 19 +DEAL::4 4 +DEAL:: columns=5 6 7 20 +DEAL::4 4 +DEAL:: columns=6 7 8 21 +DEAL::4 4 +DEAL:: columns=7 8 9 22 +DEAL::4 4 +DEAL:: columns=8 9 10 23 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 4 +DEAL:: columns=28 42 43 56 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 5 +DEAL:: columns=31 44 45 46 59 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 5 +DEAL:: columns=34 47 48 49 62 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 5 +DEAL:: columns=37 50 51 52 65 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 5 +DEAL:: columns=40 53 54 55 68 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::5 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::4 -1 +DEAL::3 -1 +DEAL::OK diff --git a/tests/lac/is_block_vector.cc b/tests/lac/is_block_vector.cc new file mode 100644 index 0000000000..f46b6c4dec --- /dev/null +++ b/tests/lac/is_block_vector.cc @@ -0,0 +1,77 @@ +//---------------------------- block_matrices.cc --------------------------- +// $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. +// +//---------------------------- block_matrices.cc --------------------------- + + +#include "../tests.h" +#include +#include + +#include +#include +#include + + + + +void test () +{ + std::ofstream logfile("is_block_vector/output"); + deallog << std::fixed; + deallog << std::setprecision(2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + deallog << IsBlockVector >::value << ' ' + << IsBlockVector >::value << ' ' + << IsBlockVector >::value << ' ' + << IsBlockVector >::value << std::endl; +} + + + + +int main () +{ + try + { + test (); + } + catch (std::exception &e) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << e.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + // abort + return 2; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + // abort + return 3; + }; + + + return 0; +} diff --git a/tests/lac/is_block_vector/cmp/generic b/tests/lac/is_block_vector/cmp/generic new file mode 100644 index 0000000000..203b7b1431 --- /dev/null +++ b/tests/lac/is_block_vector/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::0 0 1 1 diff --git a/tests/lac/sparsity_pattern_common.h b/tests/lac/sparsity_pattern_common.h index 6c14ab7b73..5b765bb3bb 100644 --- a/tests/lac/sparsity_pattern_common.h +++ b/tests/lac/sparsity_pattern_common.h @@ -1,8 +1,8 @@ //--------------------------- sparsity_pattern_common.h ------------------------- // $Id: sparsity_pattern_01.cc 15674 2008-01-24 17:40:56Z kanschat $ -// Version: $Name$ +// Version: $Name$ // -// Copyright (C) 2008 by the deal.II authors +// Copyright (C) 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -13,10 +13,9 @@ -// check - #include "../tests.h" #include +#include #include #include #include @@ -57,9 +56,10 @@ void do_reinit (CompressedSparsityPattern &sp) sp.reinit((N-1)*(N-1), (N-1)*(N-1)); } -void do_reinit (CompressedSimpleSparsityPattern &sp) +void do_reinit (CompressedSimpleSparsityPattern &sp, + const IndexSet &index_set = IndexSet()) { - sp.reinit((N-1)*(N-1), (N-1)*(N-1)); + sp.reinit((N-1)*(N-1), (N-1)*(N-1), index_set); } void do_reinit (CompressedSetSparsityPattern &sp) @@ -90,7 +90,7 @@ void row_length () { SP sparsity_pattern; build_sparsity (sparsity_pattern); - + for (unsigned int i=0; i > > &sparsity, ChunkSparsityPattern &sp4) { - sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1), + sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1), sparsity.begin(), sparsity.end(), chunk_size); } @@ -282,12 +282,12 @@ do_copy_from (const CompressedSparsityPattern &sparsity, { sparsity_x.push_back (std::set >()); - + for (unsigned int j=0; j >()); - + for (unsigned int j=0; j () deallog << "OK" << std::endl; } - + template <> void matrix_position () { @@ -556,7 +556,7 @@ void block_read_write () sparsity_pattern.block_write (tmp_write); SP sp5; - + std::istringstream tmp_read(tmp_write.str()); sp5.block_read (tmp_read); @@ -565,7 +565,7 @@ void block_read_write () deallog << sparsity_pattern.n_rows() - sp5.n_rows() << ' ' << sparsity_pattern.n_cols() - sp5.n_cols() << ' ' << std::endl; - + for (unsigned int i=0; i () } - + +template +void test_index_set (const bool contiguous) +{ + SP sp1, sp2; + + IndexSet index_set ((N-1)*(N-1)); + index_set.add_range (5,10); + + if (!contiguous) + for (unsigned int i=3*(N-1); i<4*(N-1); i += 3) + index_set.add_index (i); + + do_reinit (sp1); + do_reinit (sp2, index_set); + + FDMatrix(N,N).five_point_structure (sp1); + FDMatrix(N,N).five_point_structure (sp2); + + sp1.compress (); + sp2.compress (); + + + for (unsigned int i=0; i