]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add the corresponding testcase for hp::DoFHandler as well, just to be on the safe... 278/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Nov 2014 05:44:02 +0000 (23:44 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 27 Nov 2014 05:44:22 +0000 (23:44 -0600)
tests/bits/serialize_hp_dof_handler.cc [new file with mode: 0644]
tests/bits/serialize_hp_dof_handler.output [new file with mode: 0644]

diff --git a/tests/bits/serialize_hp_dof_handler.cc b/tests/bits/serialize_hp_dof_handler.cc
new file mode 100644 (file)
index 0000000..28fe6c8
--- /dev/null
@@ -0,0 +1,61 @@
+// ---------------------------------------------------------------------
+//
+// 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/hp/dof_handler.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/hp/fe_collection.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);
+  hp::DoFHandler<2> dof_handler (triangulation);
+  FE_Q<2> finite_element (1);
+  hp::FECollection<2> fe;
+  fe.push_back (finite_element);
+  dof_handler.distribute_dofs (fe);
+
+  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_hp_dof_handler.output b/tests/bits/serialize_hp_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.