]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test for BlockCompressedSimpleSparsityPattern::column_number()
authorTimo Heister <timo.heister@gmail.com>
Tue, 25 Sep 2012 15:58:47 +0000 (15:58 +0000)
committerTimo Heister <timo.heister@gmail.com>
Tue, 25 Sep 2012 15:58:47 +0000 (15:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@26729 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/block_compressed_01.cc [new file with mode: 0644]
tests/lac/block_compressed_01/cmp/generic [new file with mode: 0644]

diff --git a/tests/lac/block_compressed_01.cc b/tests/lac/block_compressed_01.cc
new file mode 100644 (file)
index 0000000..d783bc7
--- /dev/null
@@ -0,0 +1,64 @@
+//----------------------------------------------------------------------
+//    $Id: block_compressed_simple_sparsity_pattern_indexset_01.cc 25686 2012-07-04 14:18:43Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006, 2008 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.
+//
+//----------------------------------------------------------------------
+
+
+// Test BlockCompressedSimpleSparsityPattern column_number
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/block_sparsity_pattern.h>
+
+#include <iomanip>
+#include <fstream>
+
+int main()
+{
+  std::ofstream logfile("block_compressed_01/output");
+  logfile.setf(std::ios::fixed);
+  deallog << std::setprecision(2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  BlockCompressedSimpleSparsityPattern csp(2,2);
+  csp.block(0,0).reinit(2,2);
+  csp.block(1,0).reinit(1,2);
+  csp.block(0,1).reinit(2,1);
+  csp.block(1,1).reinit(1,1);
+  csp.collect_sizes();
+  for (int i=0;i<3;++i)
+    csp.add(i,i);
+  csp.add(1,0);
+  csp.add(1,2);
+  csp.compress();
+  
+  deallog << "blocks: " << csp.n_block_rows() << "x" << csp.n_block_cols() << std::endl;
+  deallog << "size: " << csp.n_rows() << "x" << csp.n_cols() << std::endl;
+  deallog << "size block(1,0):" << csp.block(1,0).n_rows() << "x" << csp.block(1,0).n_cols() << std::endl;
+  
+  csp.print(logfile);
+
+  deallog << std::endl;
+  for (unsigned int i=0;i<3;++i)
+    {
+      deallog << "row " << i << ": ";
+      
+      for (unsigned int j=0;j<csp.row_length(i);++j)
+       deallog << csp.column_number(i,j) << " ";
+
+      deallog << std::endl;
+    }
+  
+  return 0;
+}
diff --git a/tests/lac/block_compressed_01/cmp/generic b/tests/lac/block_compressed_01/cmp/generic
new file mode 100644 (file)
index 0000000..5d2549f
--- /dev/null
@@ -0,0 +1,11 @@
+
+DEAL::blocks: 2x2
+DEAL::size: 3x3
+DEAL::size block(1,0):1x2
+[0,0]
+[1,0,1,2]
+[2,2]
+DEAL::
+DEAL::row 0: 0 
+DEAL::row 1: 0 1 2 
+DEAL::row 2: 0 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.