]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add test for BlockList
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 19 Oct 2010 19:46:54 +0000 (19:46 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 19 Oct 2010 19:46:54 +0000 (19:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@22388 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/block_info.cc
tests/deal.II/block_list_01.cc [new file with mode: 0644]
tests/deal.II/block_list_01/cmp/generic [new file with mode: 0644]
tests/deal.II/newton_01.cc

index 705f22ce25d55f713bba25dc22e3783d10d92d40..a60170c5d7b8a2b5a9a7234379135c99f209e13f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$ 
 //
-//    Copyright (C) 2009 by the deal.II authors
+//    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
@@ -12,7 +12,6 @@
 //----------------------------------------------------------------------
 
 #include "../tests.h"
-#include <base/logstream.h>
 #include <dofs/block_info.h>
 #include <multigrid/mg_dof_handler.h>
 #include <grid/tria.h>
@@ -81,7 +80,8 @@ void test_fe (const FiniteElement<dim>& fe)
 
 int main () 
 {
-  std::ofstream logfile("block_info/output");
+  std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output");
+  std::ofstream logfile(logname.c_str());
   deallog.attach(logfile);
   deallog.depth_console(0);
 
diff --git a/tests/deal.II/block_list_01.cc b/tests/deal.II/block_list_01.cc
new file mode 100644 (file)
index 0000000..a89eed1
--- /dev/null
@@ -0,0 +1,67 @@
+//----------------------------------------------------------------------
+//    $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.
+//
+//----------------------------------------------------------------------
+
+#include "../tests.h"
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <grid/tria_iterator.h>
+#include <dofs/dof_accessor.h>
+#include <fe/fe_q.h>
+#include <fe/fe_raviart_thomas.h>
+
+#include <lac/block_list.h>
+
+using namespace dealii;
+
+
+template <int dim>
+void
+test_block_list(const Triangulation<dim>& tr, const FiniteElement<dim>& fe)
+{
+  deallog << fe.get_name() << std::endl;
+  
+  DoFHandler<dim> dof;
+  dof.initialize(tr, fe);
+  
+  BlockList bl;
+  bl.initialize(tr.n_active_cells(), dof.begin_active(), dof.end());
+
+  for (unsigned int i=0;i<bl.size();++i)
+    {
+      deallog << "Block " << std::setw(3) << i;
+      for (BlockList::const_iterator b = bl.begin(i);b != bl.end(i);++b)
+       deallog << ' ' << std::setw(4) << (*b);
+      deallog << std::endl;
+    }
+}
+
+
+int main()
+{
+  std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output");
+  std::ofstream logfile(logname.c_str());
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  Triangulation<2> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(2);
+  FE_Q<2> fe1(1);
+  FE_Q<2> fe2(2);
+  FE_RaviartThomas<2> fe3(0);
+  
+  test_block_list(tr, fe1);
+  test_block_list(tr, fe2);
+  test_block_list(tr, fe3);
+}
diff --git a/tests/deal.II/block_list_01/cmp/generic b/tests/deal.II/block_list_01/cmp/generic
new file mode 100644 (file)
index 0000000..71d0a57
--- /dev/null
@@ -0,0 +1,52 @@
+
+DEAL::FE_Q<2>(1)
+DEAL::Block 0   0    1    2    3   
+DEAL::Block 1   1    4    3    5   
+DEAL::Block 2   2    3    6    7   
+DEAL::Block 3   3    5    7    8   
+DEAL::Block 4   4    9    5    10  
+DEAL::Block 5   9    11   10   12  
+DEAL::Block 6   5    10   8    13  
+DEAL::Block 7   10   12   13   14  
+DEAL::Block 8   6    7    15   16  
+DEAL::Block 9   7    8    16   17  
+DEAL::Block 10  15   16   18   19  
+DEAL::Block 11  16   17   19   20  
+DEAL::Block 12  8    13   17   21  
+DEAL::Block 13  13   14   21   22  
+DEAL::Block 14  17   21   20   23  
+DEAL::Block 15  21   22   23   24  
+DEAL::FE_Q<2>(2)
+DEAL::Block 0   0    1    2    3    4    5    6    7    8   
+DEAL::Block 1   1    9    3    10   5    11   12   13   14  
+DEAL::Block 2   2    3    15   16   17   18   7    19   20  
+DEAL::Block 3   3    10   16   21   18   22   13   23   24  
+DEAL::Block 4   9    25   10   26   11   27   28   29   30  
+DEAL::Block 5   25   31   26   32   27   33   34   35   36  
+DEAL::Block 6   10   26   21   37   22   38   29   39   40  
+DEAL::Block 7   26   32   37   41   38   42   35   43   44  
+DEAL::Block 8   15   16   45   46   47   48   19   49   50  
+DEAL::Block 9   16   21   46   51   48   52   23   53   54  
+DEAL::Block 10  45   46   55   56   57   58   49   59   60  
+DEAL::Block 11  46   51   56   61   58   62   53   63   64  
+DEAL::Block 12  21   37   51   65   52   66   39   67   68  
+DEAL::Block 13  37   41   65   69   66   70   43   71   72  
+DEAL::Block 14  51   65   61   73   62   74   67   75   76  
+DEAL::Block 15  65   69   73   77   74   78   71   79   80  
+DEAL::FE_RaviartThomas<2>(0)
+DEAL::Block 0   0    1    2    3   
+DEAL::Block 1   1    4    5    6   
+DEAL::Block 2   7    8    3    9   
+DEAL::Block 3   8    10   6    11  
+DEAL::Block 4   4    12   13   14  
+DEAL::Block 5   12   15   16   17  
+DEAL::Block 6   10   18   14   19  
+DEAL::Block 7   18   20   17   21  
+DEAL::Block 8   22   23   9    24  
+DEAL::Block 9   23   25   11   26  
+DEAL::Block 10  27   28   24   29  
+DEAL::Block 11  28   30   26   31  
+DEAL::Block 12  25   32   19   33  
+DEAL::Block 13  32   34   21   35  
+DEAL::Block 14  30   36   33   37  
+DEAL::Block 15  36   38   35   39  
index f14efdf6ce2b90a8a1d2834f76c3eb99c8a26b73..9b7dca1c0f9fba89f3c6d61eabf53044d28a388d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$ 
 //
-//    Copyright (C) 2008, 2009 by the deal.II authors
+//    Copyright (C) 2008, 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
@@ -11,6 +11,7 @@
 //
 //-----------------------------------------------------------------------------
 
+#include "../tests.h"
 #include <numerics/operator.h>
 #include <numerics/newton.h>
 #include <numerics/vectors.h>
@@ -125,9 +126,10 @@ void test ()
 
 int main()
 {
-  std::ofstream logfile("newton_01/output");
+  std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output");
+  std::ofstream logfile(logname.c_str());
   deallog.attach(logfile);
-  deallog.depth_console(10);
+  deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
 
   test ();

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.