apply_boundary_values_* \
error_estimator_* \
cylinder_shell_* \
- grid_in_*
+ grid_in_* \
+ compressed_sparsity_pattern_*
# tests for the hp branch:
# fe_collection_*
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_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.
+//
+//---------------------------- compressed_sparsity_pattern_01.cc ---------------------------
+
+
+// check CompressedSparsityPattern::n_nonzero_elements. test n_rows() and
+// n_cols() in passing
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ // set up a sparsity pattern. since
+ // CompressedSparsityPatterns are most
+ // often used for 3d, use a rather large
+ // number of entries per row
+ const unsigned int N = 1000;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<40; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+
+ Assert (csp.n_rows() == N, ExcInternalError());
+ Assert (csp.n_cols() == N, ExcInternalError());
+ deallog << csp.n_nonzero_elements () << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_01.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_02.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.
+//
+//---------------------------- compressed_sparsity_pattern_02.cc ---------------------------
+
+
+// check CompressedSparsityPattern::bandwidth
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ // set up a sparsity pattern. since
+ // CompressedSparsityPatterns are most
+ // often used for 3d, use a rather large
+ // number of entries per row
+ const unsigned int N = 1000;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<40; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+
+ deallog << csp.bandwidth () << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_02.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_03.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.
+//
+//---------------------------- compressed_sparsity_pattern_03.cc ---------------------------
+
+
+// check CompressedSparsityPattern::row_length
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ // set up a sparsity pattern. since
+ // CompressedSparsityPatterns are most
+ // often used for 3d, use a rather large
+ // number of entries per row
+ const unsigned int N = 1000;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<40; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+
+ for (unsigned int i=0; i<N; ++i)
+ deallog << i << ' ' << csp.row_length (i) << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_03.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_04.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.
+//
+//---------------------------- compressed_sparsity_pattern_04.cc ---------------------------
+
+
+// check CompressedSparsityPattern::column_number. since we create quite some
+// output here, choose smaller number of rows and entries than in the other
+// tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ const unsigned int N = 100;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<10; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<csp.row_length (i); ++j)
+ deallog << i << ' ' << j << ' ' << csp.column_number (i,j)
+ << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_04.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_05.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.
+//
+//---------------------------- compressed_sparsity_pattern_05.cc ---------------------------
+
+
+// check CompressedSparsityPattern::symmetrize. since we create quite some
+// output here, choose smaller number of rows and entries than in the other
+// tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ const unsigned int N = 100;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<10; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+ csp.symmetrize ();
+
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<csp.row_length (i); ++j)
+ deallog << i << ' ' << j << ' ' << csp.column_number (i,j)
+ << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_05.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_06.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.
+//
+//---------------------------- compressed_sparsity_pattern_06.cc ---------------------------
+
+
+// check CompressedSparsityPattern::print_gnuplot. since we create quite some
+// output here, choose smaller number of rows and entries than in the other
+// tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+std::ofstream logfile("compressed_sparsity_pattern_06.output");
+
+void test ()
+{
+ const unsigned int N = 100;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<10; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+ csp.symmetrize ();
+
+ csp.print_gnuplot (logfile);
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_07.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.
+//
+//---------------------------- compressed_sparsity_pattern_07.cc ---------------------------
+
+
+// check CompressedSparsityPattern::exists. since we create quite some
+// output here, choose smaller number of rows and entries than in the other
+// tests
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ const unsigned int N = 100;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<10; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+ csp.symmetrize ();
+
+ for (unsigned int i=0; i<N; ++i)
+ {
+ deallog << i << ' ';
+ for (unsigned int j=0; j<N; ++j)
+ deallog << (csp.exists(i,j) ? 'x' : ' ');
+ deallog << std::endl;
+ }
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_07.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_08.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.
+//
+//---------------------------- compressed_sparsity_pattern_08.cc ---------------------------
+
+
+// check CompressedSparsityPattern::max_entries_per_row
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ // set up a sparsity pattern. since
+ // CompressedSparsityPatterns are most
+ // often used for 3d, use a rather large
+ // number of entries per row
+ const unsigned int N = 1000;
+ CompressedSparsityPattern csp (N,N);
+ for (unsigned int i=0; i<N; ++i)
+ for (unsigned int j=0; j<40; ++j)
+ csp.add (i, (i+(i+1)*(j*j+i))%N);
+
+ deallog << ' ' << csp.max_entries_per_row () << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_08.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}
--- /dev/null
+//---------------------------- compressed_sparsity_pattern_09.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.
+//
+//---------------------------- compressed_sparsity_pattern_09.cc ---------------------------
+
+
+// check CompressedSparsityPattern::empty
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <iostream>
+#include <fstream>
+
+
+void test ()
+{
+ const unsigned int N = 1000;
+ CompressedSparsityPattern csp;
+ Assert (csp.empty() == true, ExcInternalError());
+
+ csp.reinit (N, N);
+ Assert (csp.empty() == false, ExcInternalError());
+
+ deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+ std::ofstream logfile("compressed_sparsity_pattern_09.output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ test ();
+ return 0;
+}