]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Merge tests from branch_distributed_grids.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 7 Jun 2010 21:29:49 +0000 (21:29 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 7 Jun 2010 21:29:49 +0000 (21:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@21172 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/Makefile
tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc [new file with mode: 0644]
tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic [new file with mode: 0644]
tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc [new file with mode: 0644]
tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic [new file with mode: 0644]
tests/lac/is_block_vector.cc [new file with mode: 0644]
tests/lac/is_block_vector/cmp/generic [new file with mode: 0644]
tests/lac/sparsity_pattern_common.h

index 4507204acdc82839ae2ddb5e0fa2fec81a166db1..c5dace6c550ab54112f9111a549ecae94728c716 100644 (file)
@@ -42,6 +42,7 @@ tests_x = vector-vector vector_memory \
        block_vector_* \
        block_matrices \
        is_block_matrix \
+       is_block_vector \
        matrix_lib \
        matrix_out \
        pointer_matrix \
diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc b/tests/lac/compressed_simple_sparsity_pattern_index_set_01.cc
new file mode 100644 (file)
index 0000000..f672791
--- /dev/null
@@ -0,0 +1,33 @@
+//--------------------------  compressed_simple_sparsity_pattern_index_set_01.cc  ----------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2008, 2009 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_simple_sparsity_pattern_index_set_01.cc  ----------------------
+
+
+// check CompressedSimpleSparsityPattern with an IndexSet that stores
+// a contiguous range
+
+#include "sparsity_pattern_common.h"
+
+int main ()
+{
+  std::ofstream logfile("compressed_simple_sparsity_pattern_index_set_01/output");
+  logfile.setf(std::ios::fixed);
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test_index_set<CompressedSimpleSparsityPattern> (true);
+}
+
+
+
diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic b/tests/lac/compressed_simple_sparsity_pattern_index_set_01/cmp/generic
new file mode 100644 (file)
index 0000000..95ea192
--- /dev/null
@@ -0,0 +1,203 @@
+
+DEAL::3 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 4
+DEAL::      columns=4 5 6 19 
+DEAL::4 4
+DEAL::      columns=5 6 7 20 
+DEAL::4 4
+DEAL::      columns=6 7 8 21 
+DEAL::4 4
+DEAL::      columns=7 8 9 22 
+DEAL::4 4
+DEAL::      columns=8 9 10 23 
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+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EAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::OK
diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc b/tests/lac/compressed_simple_sparsity_pattern_index_set_02.cc
new file mode 100644 (file)
index 0000000..3470ac1
--- /dev/null
@@ -0,0 +1,33 @@
+//--------------------------  compressed_simple_sparsity_pattern_index_set_02.cc  ----------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2008, 2009 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_simple_sparsity_pattern_index_set_02.cc  ----------------------
+
+
+// check CompressedSimpleSparsityPattern with an IndexSet that stores
+// a non-contiguous range
+
+#include "sparsity_pattern_common.h"
+
+int main ()
+{
+  std::ofstream logfile("compressed_simple_sparsity_pattern_index_set_02/output");
+  logfile.setf(std::ios::fixed);
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test_index_set<CompressedSimpleSparsityPattern> (false);
+}
+
+
+
diff --git a/tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic b/tests/lac/compressed_simple_sparsity_pattern_index_set_02/cmp/generic
new file mode 100644 (file)
index 0000000..40817fe
--- /dev/null
@@ -0,0 +1,208 @@
+
+DEAL::3 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 4
+DEAL::      columns=4 5 6 19 
+DEAL::4 4
+DEAL::      columns=5 6 7 20 
+DEAL::4 4
+DEAL::      columns=6 7 8 21 
+DEAL::4 4
+DEAL::      columns=7 8 9 22 
+DEAL::4 4
+DEAL::      columns=8 9 10 23 
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 4
+DEAL::      columns=28 42 43 56 
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 5
+DEAL::      columns=31 44 45 46 59 
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 5
+DEAL::      columns=34 47 48 49 62 
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 5
+DEAL::      columns=37 50 51 52 65 
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 5
+DEAL::      columns=40 53 54 55 68 
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5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-1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::5 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::4 -1
+DEAL::3 -1
+DEAL::OK
diff --git a/tests/lac/is_block_vector.cc b/tests/lac/is_block_vector.cc
new file mode 100644 (file)
index 0000000..f46b6c4
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  block_matrices.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2010 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.
+//
+//----------------------------  block_matrices.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/block_vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <algorithm>
+
+
+
+
+void test ()
+{
+  std::ofstream logfile("is_block_vector/output");
+  deallog << std::fixed;
+  deallog << std::setprecision(2);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  deallog << IsBlockVector<Vector<double> >::value << ' '
+         << IsBlockVector<Vector<float> >::value << ' '
+         << IsBlockVector<BlockVector<double> >::value << ' '
+         << IsBlockVector<BlockVector<float> >::value << std::endl;
+}
+
+
+
+
+int main ()
+{
+  try
+    {
+      test ();
+    }
+  catch (std::exception &e)
+    {
+      std::cerr << std::endl << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+      std::cerr << "Exception on processing: " << e.what() << std::endl
+          << "Aborting!" << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+                                      // abort
+      return 2;
+    }
+  catch (...)
+    {
+      std::cerr << std::endl << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+          << "Aborting!" << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+                                      // abort
+      return 3;
+    };
+
+
+  return 0;
+}
diff --git a/tests/lac/is_block_vector/cmp/generic b/tests/lac/is_block_vector/cmp/generic
new file mode 100644 (file)
index 0000000..203b7b1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::0 0 1 1
index 6c14ab7b73c367ff292c06faa6b9f52c2e64abe0..5b765bb3bbdd4f773c3ea73b493a98c0884be8f7 100644 (file)
@@ -1,8 +1,8 @@
 //---------------------------  sparsity_pattern_common.h  -------------------------
 //    $Id: sparsity_pattern_01.cc 15674 2008-01-24 17:40:56Z kanschat $
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2008 by the deal.II authors
+//    Copyright (C) 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 
 
 
-// check
-
 #include "../tests.h"
 #include <base/logstream.h>
+#include <base/index_set.h>
 #include <lac/sparsity_pattern.h>
 #include <lac/compressed_sparsity_pattern.h>
 #include <lac/compressed_simple_sparsity_pattern.h>
@@ -57,9 +56,10 @@ void do_reinit (CompressedSparsityPattern &sp)
   sp.reinit((N-1)*(N-1), (N-1)*(N-1));
 }
 
-void do_reinit (CompressedSimpleSparsityPattern &sp)
+void do_reinit (CompressedSimpleSparsityPattern &sp,
+               const IndexSet &index_set = IndexSet())
 {
-  sp.reinit((N-1)*(N-1), (N-1)*(N-1));
+  sp.reinit((N-1)*(N-1), (N-1)*(N-1), index_set);
 }
 
 void do_reinit (CompressedSetSparsityPattern &sp)
@@ -90,7 +90,7 @@ void row_length ()
 {
   SP sparsity_pattern;
   build_sparsity (sparsity_pattern);
-  
+
   for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
     deallog << sparsity_pattern.row_length(i) << std::endl;
 
@@ -266,7 +266,7 @@ void
 do_copy_from (const std::list<std::set<unsigned int,std::greater<unsigned int> > > &sparsity,
              ChunkSparsityPattern &sp4)
 {
-  sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1), 
+  sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1),
                 sparsity.begin(), sparsity.end(),
                 chunk_size);
 }
@@ -282,12 +282,12 @@ do_copy_from (const CompressedSparsityPattern &sparsity,
     {
       sparsity_x.push_back
        (std::set<unsigned int,std::greater<unsigned int> >());
-      
+
       for (unsigned int j=0; j<sparsity.n_cols(); ++j)
        if (sparsity.exists(i,j))
          sparsity_x.back().insert (j);
     }
-  
+
   do_copy_from (sparsity_x, sp4);
 }
 
@@ -322,12 +322,12 @@ do_copy_from (const CompressedSetSparsityPattern &sparsity,
     {
       sparsity_x.push_back
        (std::set<unsigned int,std::greater<unsigned int> >());
-      
+
       for (unsigned int j=0; j<sparsity.n_cols(); ++j)
        if (sparsity.exists(i,j))
          sparsity_x.back().insert (j);
     }
-  
+
   do_copy_from (sparsity_x, sp4);
 }
 
@@ -514,7 +514,7 @@ void matrix_position<ChunkSparsityPattern> ()
   deallog << "OK" << std::endl;
 }
 
-  
+
 template <>
 void matrix_position<CompressedSparsityPattern> ()
 {
@@ -556,7 +556,7 @@ void block_read_write ()
   sparsity_pattern.block_write (tmp_write);
 
   SP sp5;
-  
+
   std::istringstream tmp_read(tmp_write.str());
   sp5.block_read (tmp_read);
 
@@ -565,7 +565,7 @@ void block_read_write ()
   deallog << sparsity_pattern.n_rows() - sp5.n_rows() << ' '
          << sparsity_pattern.n_cols() - sp5.n_cols() << ' '
          << std::endl;
-  
+
   for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
     for (unsigned int j=0; j<sparsity_pattern.n_cols(); ++j)
       Assert (sparsity_pattern.exists(i,j) == sp5.exists (i,j),
@@ -605,4 +605,50 @@ void block_read_write<CompressedSetSparsityPattern> ()
 }
 
 
-  
+
+template <typename SP>
+void test_index_set (const bool contiguous)
+{
+  SP sp1, sp2;
+
+  IndexSet index_set ((N-1)*(N-1));
+  index_set.add_range (5,10);
+
+  if (!contiguous)
+    for (unsigned int i=3*(N-1); i<4*(N-1); i += 3)
+      index_set.add_index (i);
+
+  do_reinit (sp1);
+  do_reinit (sp2, index_set);
+
+  FDMatrix(N,N).five_point_structure (sp1);
+  FDMatrix(N,N).five_point_structure (sp2);
+
+  sp1.compress ();
+  sp2.compress ();
+
+
+  for (unsigned int i=0; i<sp1.n_rows(); ++i)
+    {
+      deallog << sp1.row_length(i) << ' '
+             << (index_set.is_element(i) ? (int)sp2.row_length(i) : -1)
+             << std::endl;
+      if (index_set.is_element(i))
+       Assert (sp2.row_length(i) == sp1.row_length(i), ExcInternalError());
+
+      if (index_set.is_element(i))
+       {
+         deallog << "      columns=";
+         for (unsigned int j=0; j<sp2.row_length(i); ++j)
+           {
+             deallog << sp1.column_number(i,j) << ' ';
+             Assert (sp1.column_number(i,j) ==
+                     sp2.column_number(i,j),
+                     ExcInternalError());
+           }
+         deallog << std::endl;
+       }
+    }
+
+  deallog << "OK" << std::endl;
+}

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.