]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 25 Sep 2009 02:48:15 +0000 (02:48 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 25 Sep 2009 02:48:15 +0000 (02:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@19539 0785d39b-7218-0410-832d-ea1e28bc413d

tests/hp/Makefile
tests/hp/fe_nothing_01.cc [new file with mode: 0644]
tests/hp/fe_nothing_01/cmp/generic [new file with mode: 0644]

index 947bdb32a3b6032666ff6612a0bdd24046f482b4..e04049175cff78a1914f3a1eb225ac33cd98c2df 100644 (file)
@@ -1,6 +1,6 @@
 ############################################################
 # $Id$
-# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008 by the deal.II authors
+# Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 ############################################################
 
 ############################################################
@@ -17,7 +17,7 @@ libraries = $(lib-deal2-1d.g) \
             $(lib-lac.g)  \
             $(lib-base.g)
 
-default: run-tests 
+default: run-tests
 
 ############################################################
 
@@ -26,6 +26,7 @@ tests_x = hp_dof_handler \
          q_collection_* \
          mapping_collection_* \
          fe_collection_* \
+         fe_nothing_* \
          continuous_* \
          n_dofs \
          random \
diff --git a/tests/hp/fe_nothing_01.cc b/tests/hp/fe_nothing_01.cc
new file mode 100644 (file)
index 0000000..bfdc0c7
--- /dev/null
@@ -0,0 +1,103 @@
+//----------------------------  fe_nothing_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 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.
+//
+//----------------------------  fe_nothing_01.cc  ---------------------------
+
+
+// test that FE_Nothing works as intended
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <fe/fe_nothing.h>
+#include <fe/fe_q.h>
+#include <hp/fe_collection.h>
+#include <hp/dof_handler.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_refinement.h>
+#include <dofs/dof_accessor.h>
+#include <dofs/dof_tools.h>
+#include <fe/fe_q.h>
+#include <hp/dof_handler.h>
+#include <hp/fe_values.h>
+
+
+#include <fstream>
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim>       triangulation;
+  GridGenerator :: hyper_cube (triangulation, -0.5, 0.5);
+  triangulation.refine_global(4);
+
+  hp::FECollection<dim>    fe_collection;
+  fe_collection.push_back (FE_Q<dim>(1));
+  fe_collection.push_back (FE_Nothing<dim>());
+
+  hp::DoFHandler<dim>      dof_handler (triangulation);
+
+                                  // loop over cells, and set cells
+                                  // within a circle to be of type
+                                  // FE_Nothing, while outside the
+                                  // circle to be of type FE_Q(1)
+  typename hp::DoFHandler<dim>::active_cell_iterator
+    cell = dof_handler.begin_active(),
+    endc = dof_handler.end();
+
+  for(; cell != endc; cell++)
+    {
+      Point<dim> center = cell->center();
+      if( std::sqrt(center.square()) < 0.25 )
+       cell->set_active_fe_index(1);
+      else
+       cell->set_active_fe_index(0);
+    }
+
+                                  // Attempt to distribute dofs.
+                                  // Fails here with assertion from
+                                  // hp_vertex_dof_identities().
+                                  // Seems this function expects all
+                                  // elements to be of type FE_Q, and
+                                  // therefore have dofs at the cell
+                                  // vertices.
+
+  dof_handler.distribute_dofs (fe_collection);
+
+  deallog << "   Number of active cells:       "
+         << triangulation.n_active_cells()
+         << std::endl
+         << "   Number of degrees of freedom: "
+         << dof_handler.n_dofs()
+         << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("fe_nothing_01/output");
+  logfile.precision(2);
+
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/hp/fe_nothing_01/cmp/generic b/tests/hp/fe_nothing_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.