From 6ca6375e59459cea9445c91e697686394e6f20ff Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 29 Mar 2004 20:48:56 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@8898 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/sparsity_pattern_iterator_01.cc | 75 +++++++++++++++++++ .../bits/sparsity_pattern_iterator_01.output | 15 ++++ 2 files changed, 90 insertions(+) create mode 100644 tests/bits/sparsity_pattern_iterator_01.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/bits/sparsity_pattern_iterator_01.output diff --git a/tests/bits/sparsity_pattern_iterator_01.cc b/tests/bits/sparsity_pattern_iterator_01.cc new file mode 100644 index 0000000000..c8f5d46b3e --- /dev/null +++ b/tests/bits/sparsity_pattern_iterator_01.cc @@ -0,0 +1,75 @@ +//---------------------------- sparsity_pattern_iterator_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 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. +// +//---------------------------- sparsity_pattern_iterator_01.cc --------------------------- + + +// test SparsityPattern::iterator + +#include "../tests.h" +#include +#include +#include + + +void test () +{ + SparsityPattern sp (5,5,3); + for (unsigned int i=0; i<5; ++i) + for (unsigned int j=0; j<5; ++j) + if ((i+2*j+1) % 3 == 0) + sp.add (i,j); + sp.compress (); + + SparsityPattern::const_iterator i = sp.begin(); + for (; i!=sp.end(); ++i) + deallog << i->row() << ' ' << i->column() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int main () +{ + std::ofstream logfile("sparsity_pattern_iterator_01.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + test (); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/sparsity_pattern_iterator_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/sparsity_pattern_iterator_01.output new file mode 100644 index 0000000000..c905b79a7b --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/sparsity_pattern_iterator_01.output @@ -0,0 +1,15 @@ + +DEAL::0 0 +DEAL::0 1 +DEAL::0 4 +DEAL::1 1 +DEAL::1 2 +DEAL::2 2 +DEAL::2 0 +DEAL::2 3 +DEAL::3 3 +DEAL::3 1 +DEAL::3 4 +DEAL::4 4 +DEAL::4 2 +DEAL::OK -- 2.39.5