From: wolf Date: Thu, 10 May 2001 14:10:45 +0000 (+0000) Subject: Add new test to check for features of sparsity pattern. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d08f882ba89ae6f4783f968c45ad11a5696a33;p=dealii-svn.git Add new test to check for features of sparsity pattern. git-svn-id: https://svn.dealii.org/trunk@4588 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/Makefile.in b/tests/lac/Makefile.in index 17bfc11e7e..0b24e9655b 100644 --- a/tests/lac/Makefile.in +++ b/tests/lac/Makefile.in @@ -19,17 +19,19 @@ default: run-tests ############################################################ -block_matrices.exe : block_matrices.go $(libraries) -block_vector.exe : block_vector.go abort.go $(libraries) -full_matrix.exe : full_matrix.go $(libraries) -solver.exe : solver.go testmatrix.go $(libraries) -sparse_ilu.exe : sparse_ilu.go testmatrix.go $(libraries) -vector-vector.exe : vector-vector.go $(libraries) -#mgbase.exe : mgbase.go $(libraries) -#mg.exe : mg.go testmatrix.go $(libraries) - - -tests = block_matrices block_vector full_matrix solver sparse_ilu vector-vector +block_matrices.exe : block_matrices.go $(libraries) +block_vector.exe : block_vector.go abort.go $(libraries) +full_matrix.exe : full_matrix.go $(libraries) +solver.exe : solver.go testmatrix.go $(libraries) +sparsity_pattern.exe: sparsity_pattern.go testmatrix.go $(libraries) +sparse_ilu.exe : sparse_ilu.go testmatrix.go $(libraries) +vector-vector.exe : vector-vector.go $(libraries) +#mgbase.exe : mgbase.go $(libraries) +#mg.exe : mg.go testmatrix.go $(libraries) + + +tests = block_matrices block_vector full_matrix solver \ + sparsity_pattern sparse_ilu vector-vector ############################################################ diff --git a/tests/lac/sparsity_pattern.cc b/tests/lac/sparsity_pattern.cc new file mode 100644 index 0000000000..c74182b8bf --- /dev/null +++ b/tests/lac/sparsity_pattern.cc @@ -0,0 +1,101 @@ +//---------------------------- $RCSfile$ --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2001 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. +// +//---------------------------- $RCSfile$ --------------------------- + + +#include +#include +#include "testmatrix.h" +#include +#include +#include + + +int +main () +{ + ofstream logfile("sparsity_pattern.output"); + logfile.setf(ios::fixed); + logfile.precision(3); + deallog.attach(logfile); + deallog.depth_console(0); + + // generate usual sparsity pattern + const unsigned int N = 15; + SparsityPattern sp1((N-1)*(N-1), (N-1)*(N-1), 5); + FDMatrix(N,N).build_structure (sp1); + sp1.compress (); + deallog << sp1.n_rows() << " " << sp1.n_cols() << " " + << sp1.bandwidth() << " " << sp1.n_nonzero_elements() + << std::endl; + for (unsigned int i=0; i > > sparsity; + for (unsigned int row=0; row >()); + for (const unsigned int *p=sp3.get_column_numbers()+sp3.get_rowstart_indices()[row]; + p != sp3.get_column_numbers()+sp3.get_rowstart_indices()[row+1]; ++p) + sparsity.back().insert (*p); + }; + SparsityPattern sp4; + sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1), + sparsity.begin(), sparsity.end()); + + // now check for equivalence of sp3 and sp4 + for (unsigned int row=0; row