--- /dev/null
+//---------------------------------------------------------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2009, 2010, 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.
+//
+//---------------------------------------------------------------------------
+
+
+// SolutionTransfer locks up when a process has no locally owned cells
+
+#include "../tests.h"
+#include "coarse_grid_common.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/tensor.h>
+#include <deal.II/base/function.h>
+#include <deal.II/numerics/vectors.h>
+#include <deal.II/grid/filtered_iterator.h>
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/grid/tria_boundary_lib.h>
+#include <deal.II/numerics/data_out.h>
+#include <deal.II/distributed/solution_transfer.h>
+#include <deal.II/lac/petsc_parallel_vector.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_system.h>
+
+#include <fstream>
+#include <sstream>
+
+
+template<int dim>
+void test()
+{
+ parallel::distributed::Triangulation<2> tria(MPI_COMM_WORLD,
+ typename Triangulation<2>::MeshSmoothing
+ (Triangulation<2>::smoothing_on_refinement |
+ Triangulation<2>::smoothing_on_coarsening));
+
+ GridGenerator::hyper_cube (tria,-1.0,1.0);
+
+ DoFHandler<2> dh(tria);
+ FE_Q<2> fe(1);
+
+ dh.distribute_dofs(fe);
+
+ IndexSet locally_owned_dofs = dh.locally_owned_dofs ();
+ IndexSet locally_relevant_dofs;
+
+ DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
+
+ PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
+ solution = 0;
+ solution.update_ghost_values();
+
+ parallel::distributed::SolutionTransfer<2,PETScWrappers::MPI::Vector> soltrans(dh);
+
+ tria.set_all_refine_flags();
+ tria.prepare_coarsening_and_refinement();
+
+ soltrans.prepare_for_coarsening_and_refinement (solution);
+
+
+ tria.execute_coarsening_and_refinement();
+
+ dh.distribute_dofs (fe);
+ locally_owned_dofs = dh.locally_owned_dofs ();
+ DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
+
+ PETScWrappers::MPI::Vector tmp(MPI_COMM_WORLD,dh.n_dofs(),dh.n_locally_owned_dofs());
+
+ std::cout<<"I WAS HERE"<<std::endl;
+
+ soltrans.interpolate (tmp);
+
+ std::cout<<"I AM HERE"<<std::endl;
+
+ solution.reinit(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
+ solution = tmp;
+ solution.update_ghost_values();
+}
+
+
+int main(int argc, char *argv[])
+{
+ abort ();
+
+ PetscInitialize(&argc,&argv,0,0);
+
+
+ unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD);
+
+
+ deallog.push(Utilities::int_to_string(myid));
+
+ if (myid == 0)
+ {
+ std::ofstream logfile(output_file_for_mpi("solution_transfer_01").c_str());
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ deallog.push("2d");
+ test<2>();
+ deallog.pop();
+ deallog.push("3d");
+ test<3>();
+ deallog.pop();
+ }
+ else
+ {
+ test<2>();
+ test<3>();
+ }
+
+ PetscFinalize();
+}