--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2008 - 2018 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Test serialization with shared triangulations.
+
+#include <deal.II/distributed/shared_tria.h>
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/lac/vector.h>
+
+#include <deal.II/numerics/vector_tools.h>
+
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/archive/text_oarchive.hpp>
+
+#include "../grid/tests.h"
+
+using namespace dealii;
+
+template <int dim>
+class InterpolationFunction : public Function<dim>
+{
+public:
+ InterpolationFunction()
+ : Function<dim>(1)
+ {}
+
+ virtual double
+ value(const Point<dim> &p, const unsigned int component = 0) const
+ {
+ return p.norm();
+ }
+};
+
+template <int dim, typename TriangulationType>
+void
+test(TriangulationType &triangulation)
+{
+ DoFHandler<dim> dof_handler(triangulation);
+ dof_handler.distribute_dofs(FE_Q<dim>(2));
+
+ using VectorType = Vector<double>;
+
+ VectorType vector(dof_handler.n_dofs());
+
+ VectorTools::interpolate(dof_handler, InterpolationFunction<dim>(), vector);
+
+ VectorType vector_loaded(dof_handler.n_dofs());
+
+ print_statistics(triangulation, false);
+
+ std::stringstream stream;
+ {
+ boost::archive::text_oarchive oa(stream);
+ oa << triangulation;
+ oa << vector;
+ }
+
+ triangulation.clear();
+
+ {
+ boost::archive::text_iarchive ia(stream);
+ ia >> triangulation;
+ ia >> vector_loaded;
+ }
+ print_statistics(triangulation, false);
+
+ // Verify that error is 0.
+ VectorType error(vector);
+ error.add(-1, vector_loaded);
+
+ deallog << (error.linfty_norm() < 1e-16 ? "PASSED" : "FAILED") << std::endl;
+}
+
+int
+main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ MPILogInitAll all;
+
+ deallog.push("2d");
+ {
+ constexpr int dim = 2;
+
+ parallel::shared::Triangulation<dim> triangulation(
+ MPI_COMM_WORLD,
+ ::Triangulation<dim>::none,
+ false,
+ parallel::shared::Triangulation<dim>::partition_metis);
+ GridGenerator::hyper_cube(triangulation);
+ triangulation.refine_global(3);
+
+ test<dim>(triangulation);
+ }
+ deallog.pop();
+
+ deallog.push("3d");
+ {
+ constexpr int dim = 3;
+
+ parallel::shared::Triangulation<dim> triangulation(
+ MPI_COMM_WORLD,
+ ::Triangulation<dim>::none,
+ false,
+ parallel::shared::Triangulation<dim>::partition_metis);
+ GridGenerator::hyper_cube(triangulation);
+ triangulation.refine_global(3);
+
+ test<dim>(triangulation);
+ }
+ deallog.pop();
+}
--- /dev/null
+
+DEAL:0:2d::n_levels: 4
+DEAL:0:2d::n_cells: 85
+DEAL:0:2d::n_active_cells: 64
+DEAL:0:2d::has_hanging_nodes: false
+DEAL:0:2d::
+DEAL:0:2d::n_levels: 4
+DEAL:0:2d::n_cells: 85
+DEAL:0:2d::n_active_cells: 64
+DEAL:0:2d::has_hanging_nodes: false
+DEAL:0:2d::
+DEAL:0:2d::PASSED
+DEAL:0:3d::n_levels: 4
+DEAL:0:3d::n_cells: 585
+DEAL:0:3d::n_active_cells: 512
+DEAL:0:3d::has_hanging_nodes: false
+DEAL:0:3d::
+DEAL:0:3d::n_levels: 4
+DEAL:0:3d::n_cells: 585
+DEAL:0:3d::n_active_cells: 512
+DEAL:0:3d::has_hanging_nodes: false
+DEAL:0:3d::
+DEAL:0:3d::PASSED
+
+DEAL:1:2d::n_levels: 4
+DEAL:1:2d::n_cells: 85
+DEAL:1:2d::n_active_cells: 64
+DEAL:1:2d::has_hanging_nodes: false
+DEAL:1:2d::
+DEAL:1:2d::n_levels: 4
+DEAL:1:2d::n_cells: 85
+DEAL:1:2d::n_active_cells: 64
+DEAL:1:2d::has_hanging_nodes: false
+DEAL:1:2d::
+DEAL:1:2d::PASSED
+DEAL:1:3d::n_levels: 4
+DEAL:1:3d::n_cells: 585
+DEAL:1:3d::n_active_cells: 512
+DEAL:1:3d::has_hanging_nodes: false
+DEAL:1:3d::
+DEAL:1:3d::n_levels: 4
+DEAL:1:3d::n_cells: 585
+DEAL:1:3d::n_active_cells: 512
+DEAL:1:3d::has_hanging_nodes: false
+DEAL:1:3d::
+DEAL:1:3d::PASSED
+