]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix a problem with the FE_Nothing element.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 18 Feb 2011 18:44:17 +0000 (18:44 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 18 Feb 2011 18:44:17 +0000 (18:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@23397 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/fe/fe_nothing.cc
tests/hp/fe_nothing_09.cc [new file with mode: 0644]
tests/hp/fe_nothing_09/cmp/generic [new file with mode: 0644]
tests/hp/fe_nothing_10.cc [new file with mode: 0644]
tests/hp/fe_nothing_10/cmp/generic [new file with mode: 0644]

index 105eb1abeb4340ca4b0f221ac117e7450280781d..b3966391e0b520df29654b0721d05b186ba004d8 100644 (file)
@@ -78,6 +78,12 @@ should be fixed now.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: It wasn't possible to use the FE_Nothing element inside an FESystem
+object and hand the result over to an FEValues object. This is now fixed.
+<br>
+(Wolfgang Bangerth, 2011/02/18)
+</li>
+
 <li> New: There is now a function DataOutBase::write_visit_record that does
 the equivalent for VisIt that DataOutBase::write_pvtu_record does for ParaView:
 generate a file that contains a list of all other VTK or VTU files of which the
index debdf705d27760a959a3ff1429cbb6a4de3bc730..facbdce6d8d70d0a8aacdb9a47c2bf4169e89196 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009 by the deal.II authors
+//    Copyright (C) 2009, 2011 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -123,7 +123,8 @@ FE_Nothing<dim>::get_data (const UpdateFlags  /*flags*/,
                 // Create a default data object.  Normally we would then
                 // need to resize things to hold the appropriate numbers
                 // of dofs, but in this case all data fields are empty.
-  typename Mapping<dim>::InternalDataBase* data = new typename Mapping<dim>::InternalDataBase();
+  typename Mapping<dim>::InternalDataBase* data
+    = new typename FiniteElement<dim>::InternalDataBase();
   return data;
 }
 
diff --git a/tests/hp/fe_nothing_09.cc b/tests/hp/fe_nothing_09.cc
new file mode 100644 (file)
index 0000000..af11beb
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  fe_nothing_09.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2011 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_09.cc  ---------------------------
+
+
+// test that FE_Nothing can be called with interpolate_boundary_values
+// with vector elements. this failed at the time of writing the test
+// with an internal error
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/function.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 <fe/fe_system.h>
+#include <hp/dof_handler.h>
+#include <hp/fe_values.h>
+#include <numerics/vectors.h>
+
+
+#include <fstream>
+
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim>       triangulation;
+  GridGenerator :: hyper_cube (triangulation, -1, 1);
+  triangulation.refine_global(1);
+
+  hp::FECollection<dim>    fe_collection;
+  fe_collection.push_back (FESystem<dim>(FE_Q<dim>(1), 2));
+  fe_collection.push_back (FESystem<dim>(FE_Nothing<dim>(), 2));
+
+  hp::DoFHandler<dim>      dof_handler (triangulation);
+
+  typename hp::DoFHandler<dim>::active_cell_iterator
+    cell = dof_handler.begin_active(),
+    endc = dof_handler.end();
+
+  for(; cell != endc; cell++)
+    if (cell->center()[0] > 0)
+      cell->set_active_fe_index(1);
+    else
+      cell->set_active_fe_index(0);
+
+  dof_handler.distribute_dofs (fe_collection);
+  deallog << dof_handler.n_dofs() << " dofs" << std::endl;
+
+  std::map<unsigned int, double> bv;
+  VectorTools::interpolate_boundary_values (dof_handler,
+                                           0,
+                                           ZeroFunction<dim>(2),
+                                           bv);
+  for (std::map<unsigned int, double>::iterator
+        p = bv.begin(); p!=bv.end(); ++p)
+    deallog << p->first << ' ' << p->second << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("fe_nothing_09/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_09/cmp/generic b/tests/hp/fe_nothing_09/cmp/generic
new file mode 100644 (file)
index 0000000..cd6e4f7
--- /dev/null
@@ -0,0 +1,51 @@
+
+DEAL::4 dofs
+DEAL::0 0
+DEAL::1 0
+DEAL::12 dofs
+DEAL::0 0
+DEAL::1 0
+DEAL::2 0
+DEAL::3 0
+DEAL::4 0
+DEAL::5 0
+DEAL::8 0
+DEAL::9 0
+DEAL::10 0
+DEAL::11 0
+DEAL::36 dofs
+DEAL::0 0
+DEAL::1 0
+DEAL::2 0
+DEAL::3 0
+DEAL::4 0
+DEAL::5 0
+DEAL::6 0
+DEAL::7 0
+DEAL::8 0
+DEAL::9 0
+DEAL::10 0
+DEAL::11 0
+DEAL::12 0
+DEAL::13 0
+DEAL::16 0
+DEAL::17 0
+DEAL::18 0
+DEAL::19 0
+DEAL::20 0
+DEAL::21 0
+DEAL::22 0
+DEAL::23 0
+DEAL::24 0
+DEAL::25 0
+DEAL::26 0
+DEAL::27 0
+DEAL::28 0
+DEAL::29 0
+DEAL::30 0
+DEAL::31 0
+DEAL::32 0
+DEAL::33 0
+DEAL::34 0
+DEAL::35 0
+DEAL::OK
diff --git a/tests/hp/fe_nothing_10.cc b/tests/hp/fe_nothing_10.cc
new file mode 100644 (file)
index 0000000..050c16c
--- /dev/null
@@ -0,0 +1,55 @@
+//----------------------------  fe_nothing_10.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2011 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_10.cc  ---------------------------
+
+
+// an extract of _09 that failed at the time of writing the test
+// with an internal error
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <fe/fe_nothing.h>
+#include <fe/fe_system.h>
+#include <hp/fe_values.h>
+
+
+#include <fstream>
+
+
+template <int dim>
+void test ()
+{
+  FESystem<dim> fe(FE_Nothing<dim>(), 2);
+  FEValues<dim> fe_values (fe, QGauss<dim>(2), update_values);
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("fe_nothing_10/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_10/cmp/generic b/tests/hp/fe_nothing_10/cmp/generic
new file mode 100644 (file)
index 0000000..5f42bb2
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::OK
+DEAL::OK
+DEAL::OK
+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.