]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Update.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Feb 2013 04:59:37 +0000 (04:59 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 10 Feb 2013 04:59:37 +0000 (04:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@28304 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/chunk_sparse_matrix_01a.cc

index b5e51e0f0722d7c078020bab5ee013d308fec292..642be5f7d47be3e0f5df6af198927f9a155d91f1 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  chunk_sparse_matrix_01a.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005, 2008 by the deal.II authors
+//    Copyright (C) 2004, 2005, 2008, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
 // ChunkSparseMatrix::el() returns zero and operator() throws an exception
 
 #include "../tests.h"
-#include <deal.II/lac/chunk_sparse_matrix.h>    
+#include <deal.II/lac/chunk_sparse_matrix.h>
 #include <fstream>
 #include <iomanip>
 
 
 void test (const unsigned int chunk_size)
 {
-  ChunkSparsityPattern sp (5,5,3,chunk_size,false);
+  ChunkSparsityPattern sp (5,5,3,chunk_size);
   for (unsigned int i=0; i<5; ++i)
     for (unsigned int j=0; j<5; ++j)
       if ((i+2*j+1) % 3 == 0)
@@ -32,7 +32,7 @@ void test (const unsigned int chunk_size)
   sp.compress ();
 
   ChunkSparseMatrix<double> m(sp);
-  
+
                                    // first set a few entries
   for (unsigned int i=0; i<m.m(); ++i)
     for (unsigned int j=0; j<m.n(); ++j)
@@ -60,7 +60,10 @@ void test (const unsigned int chunk_size)
                                           // to get an exception if we access
                                           // any other element. if
                                           // chunk_size>1, then this isn't
-                                          // necessarily true
+                                          // necessarily true. because the
+                                          // matrix is square, we may also
+                                          // always access the diagonal
+                                          // element
           bool exc_thrown = false;
           try
             {
@@ -70,7 +73,7 @@ void test (const unsigned int chunk_size)
             {
               exc_thrown = true;
             }
-          Assert ((exc_thrown == true) || (chunk_size > 1),
+          Assert ((exc_thrown == true) || (chunk_size > 1) || (i==j),
                  ExcInternalError());
         }
 
@@ -104,10 +107,10 @@ int main ()
                << "Aborting!" << std::endl
                << "----------------------------------------------------"
                << std::endl;
-      
+
       return 1;
     }
-  catch (...) 
+  catch (...)
     {
       deallog << std::endl << 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.