]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 29 Mar 2006 18:06:41 +0000 (18:06 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 29 Mar 2006 18:06:41 +0000 (18:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@12756 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/Makefile
tests/bits/get_dof_indices_01.cc [new file with mode: 0644]

index f8a973c8b0106600914e153b1603b7a5b47a79e4..53e7381099ff50e560b9771aa31c8542517faa36 100644 (file)
@@ -72,7 +72,8 @@ tests_x = geometry_info_* \
          get_fe_from_name \
          christian_* \
          oliver_* \
-         accessor_equality*
+         accessor_equality* \
+         get_dof_indices_*
 
 # tests for the hp branch:
 #        fe_collection_*
diff --git a/tests/bits/get_dof_indices_01.cc b/tests/bits/get_dof_indices_01.cc
new file mode 100644 (file)
index 0000000..9e1d72f
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  get_dof_indices_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  get_dof_indices_01.cc  ---------------------------
+
+
+// make sure we can call DoFCellAccessor::get_dof_indices also for
+// inactive cells
+
+#include "../tests.h"
+#include <base/function.h>
+#include <base/logstream.h>
+#include <lac/vector.h>
+
+#include <grid/tria.h>
+#include <dofs/dof_handler.h>
+#include <grid/grid_generator.h>
+#include <grid/grid_refinement.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/tria_boundary_lib.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim> triangulation;
+  DoFHandler<dim> dof_handler(triangulation);
+  
+  GridGenerator::hyper_cube (triangulation);
+  triangulation.refine_global (1);
+
+  FE_Q<dim> fe(1);
+  dof_handler.distribute_dofs (fe);
+
+                                  // loop over all cells, active or
+                                  // not
+  std::vector<unsigned int> local_dof_indices (fe.dofs_per_cell);
+  for (typename DoFHandler<dim>::cell_iterator cell=dof_handler.begin();
+       cell != dof_handler.end(); ++cell)
+    {
+      cell->get_dof_indices (local_dof_indices);
+
+      deallog << "Cell = " << cell
+             << ", DoFs=";
+      for (unsigned int i=0; i<fe.dofs_per_cell; ++i)
+       {
+         Assert (local_dof_indices[i] != DoFHandler<dim>::invalid_dof_index,
+                 ExcInternalError());
+         deallog << local_dof_indices[i] << ' ';
+       }
+      
+      deallog << std::endl;
+    }
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("get_dof_indices_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1>();
+  test<2>();
+  test<3>();
+  
+  return 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.