From 6ce1ae7a6e13b977321556dbdc6f5aabec8b2032 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 30 Mar 2004 14:39:27 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@8916 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/sparse_matrix_iterator_10.cc | 83 +++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 tests/bits/sparse_matrix_iterator_10.cc diff --git a/tests/bits/sparse_matrix_iterator_10.cc b/tests/bits/sparse_matrix_iterator_10.cc new file mode 100644 index 0000000000..3039b2fff0 --- /dev/null +++ b/tests/bits/sparse_matrix_iterator_10.cc @@ -0,0 +1,83 @@ +//---------------------------- sparse_matrix_iterator_10.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. +// +//---------------------------- sparse_matrix_iterator_10.cc --------------------------- + + +// this test, extracted from dof_constraints_09 and sparse_matrix_iterator_10, +// used to fail with aborts. this test is equivalent to +// sparse_matrix_iterator_09, except that we use the postfix operator++ +// instead of the prefix form + +#include "../tests.h" +#include +#include +#include +#include + + +void test () +{ + // create a sparsity pattern with totally + // empty lines (not even diagonals, since + // not quadratic) + SparsityPattern sparsity(4,5,1); + sparsity.add (1,1); + sparsity.add (3,1); + sparsity.compress (); + + // attach a sparse matrix to it + SparseMatrix A(sparsity); + + // and loop over the elements of it + for (SparseMatrix::const_iterator k=A.begin(); + k!=A.end(); k++) + deallog << k->row() << ' ' << k->column() << ' ' << k->value() + << std::endl; +} + + + +int main () +{ + std::ofstream logfile("sparse_matrix_iterator_10.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; + }; +} -- 2.39.5