]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix an issue reported by David Wells.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Nov 2014 05:33:44 +0000 (23:33 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Nov 2014 05:44:21 +0000 (23:44 -0600)
The problem here is that class DoFHandler only uses pointers to the
DoF faces and levels objects in the .h file, so we thought that we
don't have to #include the respective header files where these classes
are declared. But we also have a serialization function that uses
them and if you call it, the compiler will complain about undeclared
classes being used.

doc/news/changes.h
include/deal.II/dofs/dof_faces.h
include/deal.II/dofs/dof_handler.h
include/deal.II/dofs/dof_levels.h
tests/bits/serialize_dof_handler.cc [new file with mode: 0644]
tests/bits/serialize_dof_handler.output [new file with mode: 0644]

index f5d1fa511b38b5158b4a9bf4d38270e3c536906b..3c1ec709734650783eb632aea7b1f10c97bc64f2 100644 (file)
@@ -333,6 +333,12 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li> Fixed: Serializing an object of type DoFHandler did not work without
+  including additional header files.
+  <br>
+  (David Wells, Wolfgang Bangerth, 2014/11/26)
+  </li>
+
   <li> New: The class FEEvaluation with its fast tensor evaluation routines
   can now be initialized from a mapping, a finite element, a quadrature, and
   update flags on the fly similar to FEValues. This provides an alternative
index a228b710564aa30bb76bb27bdf04ded874e2d882..089412c651f96963cc031602145c63e483399630 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2006 - 2013 by the deal.II authors
+// Copyright (C) 2006 - 2014 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -24,9 +24,6 @@
 
 DEAL_II_NAMESPACE_OPEN
 
-template <int, int> class DoFHandler;
-template <int, int> class MGDoFHandler;
-
 namespace internal
 {
   /**
index c38a675aa7c5be4f89889383b69a6870bc368090..b3816e5f18e4951bdf027713208b41dfa2d8e376 100644 (file)
@@ -27,6 +27,8 @@
 #include <deal.II/dofs/block_info.h>
 #include <deal.II/dofs/dof_iterator_selector.h>
 #include <deal.II/dofs/number_cache.h>
+#include <deal.II/dofs/dof_faces.h>
+#include <deal.II/dofs/dof_levels.h>
 #include <deal.II/dofs/function_map.h>
 
 #include <boost/serialization/split_member.hpp>
@@ -41,9 +43,6 @@ namespace internal
 {
   namespace DoFHandler
   {
-    template <int dim> class DoFLevel;
-    template <int dim> class DoFFaces;
-
     struct Implementation;
 
     namespace Policy
index db32eeb9d51f5d51e422d7f85a1e64c1cf6ef306..eaf9ea1fc986912d56f3b768a6de882b3b446e92 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 1998 - 2013 by the deal.II authors
+// Copyright (C) 1998 - 2014 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -26,9 +26,6 @@
 
 DEAL_II_NAMESPACE_OPEN
 
-template <int, int> class DoFHandler;
-template <int, int> class MGDoFHandler;
-
 
 namespace internal
 {
diff --git a/tests/bits/serialize_dof_handler.cc b/tests/bits/serialize_dof_handler.cc
new file mode 100644 (file)
index 0000000..33b992f
--- /dev/null
@@ -0,0 +1,58 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2014 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Test an issue reported by David Wells: serializing a DoFHandler object did
+// not work right out of the box without manually including additional header
+// files
+
+#include "../tests.h"
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+
+#include <boost/archive/text_oarchive.hpp>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <fstream>
+
+
+int main ()
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  Triangulation<2> triangulation;
+  GridGenerator::hyper_cube (triangulation);
+  triangulation.refine_global (4);
+  DoFHandler<2> dof_handler (triangulation);
+  FE_Q<2> finite_element (1);
+  dof_handler.distribute_dofs (finite_element);
+
+  std::ostringstream out_stream;
+  boost::archive::text_oarchive archive(out_stream);
+
+  archive << dof_handler;
+  dof_handler.clear ();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/bits/serialize_dof_handler.output b/tests/bits/serialize_dof_handler.output
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.