]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduced p::d::CellDataTransfer. 7537/head
authorMarc Fehling <marc.fehling@gmx.net>
Tue, 18 Dec 2018 14:25:20 +0000 (15:25 +0100)
committerMarc Fehling <marc.fehling@gmx.net>
Sat, 12 Jan 2019 00:25:13 +0000 (01:25 +0100)
15 files changed:
doc/news/changes/minor/20181218MarcFehling [new file with mode: 0644]
include/deal.II/distributed/cell_data_transfer.h [new file with mode: 0644]
include/deal.II/distributed/cell_data_transfer.templates.h [new file with mode: 0644]
source/distributed/CMakeLists.txt
source/distributed/cell_data_transfer.cc [new file with mode: 0644]
source/distributed/cell_data_transfer.inst.in [new file with mode: 0644]
tests/mpi/cell_data_transfer_01.cc [new file with mode: 0644]
tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=2.output [new file with mode: 0644]
tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=8.output [new file with mode: 0644]
tests/mpi/cell_data_transfer_02.cc [new file with mode: 0644]
tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=2.output [new file with mode: 0644]
tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output [new file with mode: 0644]
tests/mpi/cell_data_transfer_03.cc [new file with mode: 0644]
tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=2.output [new file with mode: 0644]
tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=8.output [new file with mode: 0644]

diff --git a/doc/news/changes/minor/20181218MarcFehling b/doc/news/changes/minor/20181218MarcFehling
new file mode 100644 (file)
index 0000000..b11458c
--- /dev/null
@@ -0,0 +1,4 @@
+New: Class parallel::distributed::CellDataTransfer has been introduced to transfer 
+cell by cell data across distributed meshes in case of refinement/serialization.
+<br>
+(Marc Fehling, 2018/12/18)
diff --git a/include/deal.II/distributed/cell_data_transfer.h b/include/deal.II/distributed/cell_data_transfer.h
new file mode 100644 (file)
index 0000000..bcfac1e
--- /dev/null
@@ -0,0 +1,356 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+#ifndef dealii_distributed_cell_data_transfer_h
+#define dealii_distributed_cell_data_transfer_h
+
+#include <deal.II/base/config.h>
+
+#include <deal.II/base/smartpointer.h>
+
+#include <deal.II/distributed/tria.h>
+
+#include <boost/range/iterator_range.hpp>
+
+#include <functional>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+namespace parallel
+{
+  namespace distributed
+  {
+    /**
+     * Transfer data that is associated with each active cell (like error
+     * indicators) while refining and/or coarsening a distributed triangulation
+     * and handle the necessary communication.
+     *
+     * This class therefore does for cell-related information what
+     * parallel::distributed::SolutionTransfer does for the values of degrees of
+     * freedom defined on a parallel::distributed::Triangulation.
+     *
+     * This class has been designed to operate on any kind of datatype that is
+     * serializable. A non-distributed Vector container has to be provided,
+     * which holds the cell-wise data in the same order as active cells are
+     * traversed. In other words, each entry corresponds to the cell with the
+     * same index CellAccessor::active_cell_index(), and the container has to be
+     * of size Triangulation::n_active_cells().
+     *
+     * <h3>Transferring cell-wise data</h3>
+     *
+     * The following code snippet demonstrates how to transfer cell-related data
+     * across refinement/coarsening of the registered triangulation.
+     *
+     * @code
+     * // prepare the triangulation,
+     * triangulation.prepare_coarsening_and_refinement();
+     *
+     * // prepare the CellDataTransfer object for coarsening and refinement
+     * // and give the cell data vector that we intend to unpack later,
+     * Vector<double> data_to_transfer (triangulation.n_active_cells());
+     * //[fill data_to_transfer with cell-wise values...]
+     *
+     * parallel::distributed::CellDataTransfer<dim, spacedim, Vector<double>>
+     *   cell_data_trans(triangulation);
+     * cell_data_trans.prepare_for_coarsening_and_refinement(data_to_transfer);
+     *
+     * // actually execute the refinement,
+     * triangulation.execute_coarsening_and_refinement();
+     *
+     * // unpack transferred data,
+     * Vector<double> transferred_data (triangulation.n_active_cells());
+     * cell_data_trans.unpack(transferred_data);
+     *
+     * @endcode
+     *
+     *
+     * <h3>Use for serialization</h3>
+     *
+     * This class can be used to serialize and later deserialize a distributed
+     * mesh with attached data to separate files.
+     *
+     * For serialization, the following code snippet saves not only the
+     * triangulation itself, but also the cell-wise data attached:
+     * @code
+     * Vector<double> data_to_transfer (triangulation.n_active_cells());
+     * //[fill data_to_transfer with cell-wise values...]
+     *
+     * parallel::distributed::CellDataTransfer<dim, spacedim, Vector<double>>
+     *   cell_data_trans(triangulation);
+     * cell_data_trans.prepare_for_serialization(data_to_transfer);
+     *
+     * triangulation.save(filename);
+     * @endcode
+     *
+     * Later, during deserialization, both triangulation and data can be
+     * restored as follows:
+     * @code
+     * //[create coarse mesh...]
+     * triangulation.load(filename);
+     *
+     * parallel::distributed::CellDataTransfer<dim, spacedim, Vector<double>>
+     *   cell_data_trans(triangulation);
+     * Vector<double> transferred_data (triangulation.n_active_cells());
+     * cell_data_trans.deserialize(transferred_data);
+     * @endcode
+     *
+     * @note If you use more than one object to transfer data via the
+     * parallel::distributed::Triangulation::register_data_attach() and
+     * parallel::distributed::Triangulation::notify_ready_for_unpack() interface
+     * with the aim of serialization, the calls to the corresponding
+     * prepare_for_serialization() and deserialize() functions need to happen in
+     * the same order, respectively. Classes relying on this interface are e.g.
+     * parallel::distributed::CellDataTransfer,
+     * parallel::distributed::SolutionTransfer, and Particles::ParticleHandler.
+     *
+     * @note See the documentation of parallel::distributed::SolutionTransfer for
+     * matching code snippets for both transfer and serialization.
+     *
+     * @ingroup distributed
+     * @author Marc Fehling, 2018
+     */
+    template <int dim, int spacedim = dim, typename VectorType = Vector<double>>
+    class CellDataTransfer
+    {
+    public:
+      /**
+       * When data is transferred during coarsening, it is not trivial to decide
+       * how to handle data of child cells which will be coarsened. Or in other
+       * words, which data should be stored in the corresponding parent cell.
+       *
+       * In this namespace, we offer a few strategies that cope with this
+       * problem. Such strategies can be passed to the
+       * parallel::distributed::CellDataTransfer constructor.
+       */
+      struct CoarseningStrategies
+      {
+        /**
+         * Evaluate data from @p input_vector on children of @p parent.
+         * Check if data on all children match, and return that value.
+         */
+        static typename VectorType::value_type
+        check_equality(const typename parallel::distributed::
+                         Triangulation<dim, spacedim>::cell_iterator &parent,
+                       const VectorType &input_vector)
+        {
+          const typename VectorType::value_type value =
+            input_vector[parent->child(0)->active_cell_index()];
+
+          for (unsigned int child_index = 1; child_index < parent->n_children();
+               ++child_index)
+            Assert(
+              value ==
+                input_vector[parent->child(child_index)->active_cell_index()],
+              ExcMessage(
+                "Values on cells that will be coarsened are not equal!"));
+
+          return value;
+        }
+
+        /**
+         * Evaluate data from @p input_vector on children of @p parent.
+         * Return sum.
+         */
+        static typename VectorType::value_type
+        sum(const typename parallel::distributed::Triangulation<dim, spacedim>::
+              cell_iterator & parent,
+            const VectorType &input_vector)
+        {
+          typename VectorType::value_type sum = 0;
+
+          for (unsigned int child_index = 0; child_index < parent->n_children();
+               ++child_index)
+            sum +=
+              input_vector[parent->child(child_index)->active_cell_index()];
+
+          return sum;
+        }
+
+        /**
+         * Evaluate data from @p input_vector on children of @p parent.
+         * Return mean value.
+         */
+        static typename VectorType::value_type
+        mean(const typename parallel::distributed::
+               Triangulation<dim, spacedim>::cell_iterator &parent,
+             const VectorType &                             input_vector)
+        {
+          return sum(parent, input_vector) / parent->n_children();
+        }
+      };
+
+      /**
+       * Constructor.
+       *
+       * @param[in] triangulation The triangulation on which all operations will
+       *   happen. At the time when this constructor is called, the refinement
+       *   in question has not happened yet.
+       * @param[in] transfer_variable_size_data Specify whether your VectorType
+       *   container stores values that differ in size. A varying amount of data
+       *   may be packed per cell, if for example the underlying ValueType of
+       *   the VectorType container is a container itself.
+       * @param[in] coarsening_strategy Function deciding which data to store on
+       *   a cell whose children will get coarsened into.
+       */
+      CellDataTransfer(const parallel::distributed::Triangulation<dim, spacedim>
+                         &        triangulation,
+                       const bool transfer_variable_size_data = false,
+                       const std::function<typename VectorType::value_type(
+                         const typename parallel::distributed::
+                           Triangulation<dim, spacedim>::cell_iterator &parent,
+                         const VectorType &input_vector)> coarsening_strategy =
+                         &CoarseningStrategies::check_equality);
+
+      /**
+       * Prepare the current object for coarsening and refinement. It registers
+       * the data transfer of @p in on the underlying triangulation. @p in includes
+       * data to be interpolated onto the new (refined and/or coarsened) grid.
+       * See documentation of this class for more information on how to use this
+       * functionality.
+       *
+       * This function can be called only once for the specified container
+       * until data transfer has been completed. If multiple vectors shall be
+       * transferred via this class, use the function below.
+       */
+      void
+      prepare_for_coarsening_and_refinement(const VectorType &in);
+
+      /**
+       * Same as the function above, only for a list of vectors.
+       */
+      void
+      prepare_for_coarsening_and_refinement(
+        const std::vector<const VectorType *> &all_in);
+
+      /**
+       * Prepare the serialization of the given vector. The serialization is
+       * done by Triangulation::save(). See documentation of this class for more
+       * information on how to use this functionality.
+       *
+       * This function can be called only once for the specified container
+       * until data transfer has been completed. If multiple vectors shall be
+       * transferred via this class, use the function below.
+       */
+      void
+      prepare_for_serialization(const VectorType &in);
+
+      /**
+       * Same as the function above, only for a list of vectors.
+       */
+      void
+      prepare_for_serialization(const std::vector<const VectorType *> &all_in);
+
+      /**
+       * Unpack the information previously stored in this object before
+       * the mesh was refined or coarsened onto the current set of cells.
+       */
+      void
+      unpack(VectorType &out);
+
+      /**
+       * Same as the function above, only for a list of vectors.
+       */
+      void
+      unpack(std::vector<VectorType *> &all_out);
+
+      /**
+       * Execute the deserialization of the stored information.
+       * This needs to be done after calling Triangulation::load().
+       */
+      void
+      deserialize(VectorType &out);
+
+      /**
+       * Same as the function above, only for a list of vectors.
+       */
+      void
+      deserialize(std::vector<VectorType *> &all_out);
+
+    private:
+      /**
+       * Pointer to the triangulation to work with.
+       */
+      SmartPointer<const parallel::distributed::Triangulation<dim, spacedim>,
+                   CellDataTransfer<dim, spacedim, VectorType>>
+        triangulation;
+
+      /**
+       * Specifies if size of data to transfer varies from cell to cell.
+       */
+      const bool transfer_variable_size_data;
+
+      /**
+       * Function deciding which data to store from @p input_vector on a
+       * cell @p parent, whose children will get coarsened into.
+       */
+      const std::function<typename VectorType::value_type(
+        const typename parallel::distributed::Triangulation<dim, spacedim>::
+          cell_iterator & parent,
+        const VectorType &input_vector)>
+        coarsening_strategy;
+
+      /**
+       * A vector that stores pointers to all the vectors we are supposed to
+       * copy over from the old to the new mesh.
+       */
+      std::vector<const VectorType *> input_vectors;
+
+      /**
+       * The handle that triangulation has assigned to this object
+       * with which we can access our memory offset and our pack function.
+       */
+      unsigned int handle;
+
+      /**
+       * Registers the pack_callback() function to the triangulation
+       * and stores the returning handle.
+       */
+      void
+      register_data_attach();
+
+      /**
+       * A callback function used to pack the data on the current mesh into
+       * objects that can later be retrieved after refinement, coarsening and
+       * repartitioning.
+       */
+      std::vector<char>
+      pack_callback(const typename parallel::distributed::
+                      Triangulation<dim, spacedim>::cell_iterator &cell,
+                    const typename parallel::distributed::
+                      Triangulation<dim, spacedim>::CellStatus status);
+
+      /**
+       * A callback function used to unpack the data on the current mesh that
+       * has been packed up previously on the mesh before refinement,
+       * coarsening and repartitioning.
+       */
+      void
+      unpack_callback(
+        const typename parallel::distributed::Triangulation<dim, spacedim>::
+          cell_iterator &cell,
+        const typename parallel::distributed::Triangulation<dim, spacedim>::
+          CellStatus status,
+        const boost::iterator_range<std::vector<char>::const_iterator>
+          &                        data_range,
+        std::vector<VectorType *> &all_out);
+    };
+  } // namespace distributed
+} // namespace parallel
+
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
diff --git a/include/deal.II/distributed/cell_data_transfer.templates.h b/include/deal.II/distributed/cell_data_transfer.templates.h
new file mode 100644 (file)
index 0000000..495b436
--- /dev/null
@@ -0,0 +1,341 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+#ifndef dealii_distributed_cell_data_transfer_templates_h
+#define dealii_distributed_cell_data_transfer_templates_h
+
+
+#include <deal.II/base/config.h>
+
+#include <deal.II/distributed/cell_data_transfer.h>
+
+#ifdef DEAL_II_WITH_P4EST
+
+#  include <deal.II/lac/block_vector.h>
+#  include <deal.II/lac/la_parallel_block_vector.h>
+#  include <deal.II/lac/la_parallel_vector.h>
+#  include <deal.II/lac/la_vector.h>
+#  include <deal.II/lac/petsc_block_vector.h>
+#  include <deal.II/lac/petsc_vector.h>
+#  include <deal.II/lac/trilinos_epetra_vector.h>
+#  include <deal.II/lac/trilinos_parallel_block_vector.h>
+#  include <deal.II/lac/trilinos_vector.h>
+#  include <deal.II/lac/vector.h>
+
+DEAL_II_NAMESPACE_OPEN
+
+
+namespace
+{
+  template <typename VectorType>
+  void
+  post_refinement_action(std::vector<VectorType *> &all_out)
+  {
+    for (auto &out : all_out)
+      out->compress(::dealii::VectorOperation::insert);
+  }
+
+  template <typename ValueType>
+  void
+  post_refinement_action(std::vector<std::vector<ValueType> *> &)
+  {
+    // Do nothing for std::vector as VectorType.
+  }
+} // namespace
+
+
+namespace parallel
+{
+  namespace distributed
+  {
+    template <int dim, int spacedim, typename VectorType>
+    CellDataTransfer<dim, spacedim, VectorType>::CellDataTransfer(
+      const parallel::distributed::Triangulation<dim, spacedim> &triangulation,
+      const bool                         transfer_variable_size_data,
+      const std::function<typename VectorType::value_type(
+        const typename parallel::distributed::Triangulation<dim, spacedim>::
+          cell_iterator & parent,
+        const VectorType &input_vector)> coarsening_strategy)
+      : triangulation(&triangulation, typeid(*this).name())
+      , transfer_variable_size_data(transfer_variable_size_data)
+      , coarsening_strategy(coarsening_strategy)
+      , handle(numbers::invalid_unsigned_int)
+    {}
+
+
+
+    // Interface for packing
+    // ---------------------
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::register_data_attach()
+    {
+      // TODO: casting away constness is bad
+      parallel::distributed::Triangulation<dim, spacedim> *tria =
+        const_cast<parallel::distributed::Triangulation<dim, spacedim> *>(
+          &(*triangulation));
+      Assert(tria != nullptr, ExcInternalError());
+
+      handle = tria->register_data_attach(
+        std::bind(&CellDataTransfer<dim, spacedim, VectorType>::pack_callback,
+                  this,
+                  std::placeholders::_1,
+                  std::placeholders::_2),
+        /*returns_variable_size_data=*/transfer_variable_size_data);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::
+      prepare_for_coarsening_and_refinement(
+        const std::vector<const VectorType *> &all_in)
+    {
+      input_vectors = all_in;
+      register_data_attach();
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::
+      prepare_for_coarsening_and_refinement(const VectorType &in)
+    {
+      std::vector<const VectorType *> all_in(1, &in);
+      prepare_for_coarsening_and_refinement(all_in);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::prepare_for_serialization(
+      const std::vector<const VectorType *> &all_in)
+    {
+      prepare_for_coarsening_and_refinement(all_in);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::prepare_for_serialization(
+      const VectorType &in)
+    {
+      std::vector<const VectorType *> all_in(1, &in);
+      prepare_for_serialization(all_in);
+    }
+
+
+
+    // Interface for unpacking
+    // -----------------------
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::unpack(
+      std::vector<VectorType *> &all_out)
+    {
+      Assert(input_vectors.size() == all_out.size(),
+             ExcDimensionMismatch(input_vectors.size(), all_out.size()));
+
+      // TODO: casting away constness is bad
+      parallel::distributed::Triangulation<dim, spacedim> *tria =
+        const_cast<parallel::distributed::Triangulation<dim, spacedim> *>(
+          &(*triangulation));
+      Assert(tria != nullptr, ExcInternalError());
+
+      tria->notify_ready_to_unpack(
+        handle,
+        std::bind(&CellDataTransfer<dim, spacedim, VectorType>::unpack_callback,
+                  this,
+                  std::placeholders::_1,
+                  std::placeholders::_2,
+                  std::placeholders::_3,
+                  std::ref(all_out)));
+
+      post_refinement_action(all_out);
+
+      input_vectors.clear();
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::unpack(VectorType &out)
+    {
+      std::vector<VectorType *> all_out(1, &out);
+      unpack(all_out);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::deserialize(
+      std::vector<VectorType *> &all_out)
+    {
+      // For deserialization, we need to register this object
+      // to the triangulation first to get a valid handle for
+      // data access.
+      register_data_attach();
+
+      // This makes unpack() happy.
+      input_vectors.resize(all_out.size());
+
+      unpack(all_out);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::deserialize(VectorType &out)
+    {
+      std::vector<VectorType *> all_out(1, &out);
+      deserialize(all_out);
+    }
+
+
+
+    // Callback functions
+    // ------------------
+
+    template <int dim, int spacedim, typename VectorType>
+    std::vector<char>
+    CellDataTransfer<dim, spacedim, VectorType>::pack_callback(
+      const typename parallel::distributed::Triangulation<dim, spacedim>::
+        cell_iterator &cell,
+      const typename parallel::distributed::Triangulation<dim,
+                                                          spacedim>::CellStatus
+        status)
+    {
+      std::vector<typename VectorType::value_type> cell_data(
+        input_vectors.size());
+
+      // Extract data from input_vectors for this particular cell.
+      auto it_input  = input_vectors.cbegin();
+      auto it_output = cell_data.begin();
+      for (; it_input != input_vectors.cend(); ++it_input, ++it_output)
+        {
+          switch (status)
+            {
+              case parallel::distributed::Triangulation<dim,
+                                                        spacedim>::CELL_PERSIST:
+              case parallel::distributed::Triangulation<dim,
+                                                        spacedim>::CELL_REFINE:
+                // Cell either persists, or will be refined, and its children do
+                // not exist yet in the latter case.
+                *it_output = (**it_input)[cell->active_cell_index()];
+                break;
+
+              case parallel::distributed::Triangulation<dim,
+                                                        spacedim>::CELL_COARSEN:
+                // Cell is parent whose children will get coarsened to.
+                // Decide data to store on parent by provided strategy.
+                *it_output = coarsening_strategy(cell, *(*it_input));
+                break;
+
+              default:
+                Assert(false, ExcInternalError());
+                break;
+            }
+        }
+
+      // We don't have to pack the whole container if there is just one entry.
+      if (input_vectors.size() == 1)
+        return Utilities::pack(
+          cell_data[0], /*allow_compression=*/transfer_variable_size_data);
+      else
+        return Utilities::pack(
+          cell_data, /*allow_compression=*/transfer_variable_size_data);
+    }
+
+
+
+    template <int dim, int spacedim, typename VectorType>
+    void
+    CellDataTransfer<dim, spacedim, VectorType>::unpack_callback(
+      const typename parallel::distributed::Triangulation<dim, spacedim>::
+        cell_iterator &cell,
+      const typename parallel::distributed::Triangulation<dim,
+                                                          spacedim>::CellStatus
+        status,
+      const boost::iterator_range<std::vector<char>::const_iterator>
+        &                        data_range,
+      std::vector<VectorType *> &all_out)
+    {
+      std::vector<typename VectorType::value_type> cell_data;
+
+      // We have to unpack the corresponding datatype that has been packed
+      // beforehand.
+      if (all_out.size() == 1)
+        cell_data.push_back(Utilities::unpack<typename VectorType::value_type>(
+          data_range.begin(),
+          data_range.end(),
+          /*allow_compression=*/transfer_variable_size_data));
+      else
+        cell_data =
+          Utilities::unpack<std::vector<typename VectorType::value_type>>(
+            data_range.begin(),
+            data_range.end(),
+            /*allow_compression=*/transfer_variable_size_data);
+
+      // Check if sizes match.
+      Assert(cell_data.size() == all_out.size(), ExcInternalError());
+
+      auto it_input  = cell_data.cbegin();
+      auto it_output = all_out.begin();
+      for (; it_input != cell_data.cend(); ++it_input, ++it_output)
+        switch (status)
+          {
+            case parallel::distributed::Triangulation<dim,
+                                                      spacedim>::CELL_PERSIST:
+            case parallel::distributed::Triangulation<dim,
+                                                      spacedim>::CELL_COARSEN:
+              // Cell either persists, or has been coarsened.
+              // Thus, cell has no (longer) children.
+              (**it_output)[cell->active_cell_index()] = std::move(*it_input);
+              break;
+
+            case parallel::distributed::Triangulation<dim,
+                                                      spacedim>::CELL_REFINE:
+              // Cell has been refined, and is now parent of its children.
+              // Thus, distribute parent's data on its children.
+              for (unsigned int child_index = 0;
+                   child_index < cell->n_children();
+                   ++child_index)
+                (**it_output)[cell->child(child_index)->active_cell_index()] =
+                  std::move(*it_input);
+              break;
+
+            default:
+              Assert(false, ExcInternalError());
+              break;
+          }
+    }
+  } // namespace distributed
+} // namespace parallel
+
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif /* DEAL_II_WITH_P4EST */
+
+#endif /* dealii_distributed_cell_data_transfer_templates_h */
index c2707d59871747fc5b8a2dfc03d459bd25eac3f4..ac47675cbe3acfd131eaec0cf550884c6667e70e 100644 (file)
@@ -19,6 +19,7 @@ SET(_unity_include_src
   grid_refinement.cc
   cell_weights.cc
   active_fe_indices_transfer.cc
+  cell_data_transfer.cc
   solution_transfer.cc
   tria.cc
   tria_base.cc
@@ -42,6 +43,7 @@ SET(_inst
   grid_refinement.inst.in
   cell_weights.inst.in
   active_fe_indices_transfer.inst.in
+  cell_data_transfer.inst.in
   solution_transfer.inst.in
   tria.inst.in
   shared_tria.inst.in
diff --git a/source/distributed/cell_data_transfer.cc b/source/distributed/cell_data_transfer.cc
new file mode 100644 (file)
index 0000000..56337b1
--- /dev/null
@@ -0,0 +1,27 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+#include <deal.II/distributed/cell_data_transfer.templates.h>
+
+#ifdef DEAL_II_WITH_P4EST
+
+DEAL_II_NAMESPACE_OPEN
+
+// explicit instantiations
+#  include "cell_data_transfer.inst"
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif /* DEAL_II_WITH_P4EST */
diff --git a/source/distributed/cell_data_transfer.inst.in b/source/distributed/cell_data_transfer.inst.in
new file mode 100644 (file)
index 0000000..8337c6f
--- /dev/null
@@ -0,0 +1,30 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
+  {
+#if deal_II_dimension <= deal_II_space_dimension
+    template class parallel::distributed::CellDataTransfer<
+      deal_II_dimension,
+      deal_II_space_dimension,
+      Vector<double>>;
+    template class parallel::distributed::CellDataTransfer<
+      deal_II_dimension,
+      deal_II_space_dimension,
+      Vector<float>>;
+#endif
+  }
diff --git a/tests/mpi/cell_data_transfer_01.cc b/tests/mpi/cell_data_transfer_01.cc
new file mode 100644 (file)
index 0000000..e676d32
--- /dev/null
@@ -0,0 +1,113 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// p::d::CellDataTransfer test by refinement
+
+
+#include <deal.II/distributed/cell_data_transfer.templates.h>
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <string>
+
+#include "../tests.h"
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  // ------ setup ------
+  parallel::distributed::Triangulation<dim, spacedim> tria(MPI_COMM_WORLD);
+
+  GridGenerator::subdivided_hyper_cube(tria, 2);
+  tria.refine_global(1);
+  deallog << "cells before: " << tria.n_global_active_cells() << std::endl;
+
+  // ----- prepare -----
+  // set refinement/coarsening flags
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        if (cell->id().to_string() == "0_1:0")
+          cell->set_refine_flag();
+        else if (cell->parent()->id().to_string() ==
+                 ((dim == 2) ? "3_0:" : "7_0:"))
+          cell->set_coarsen_flag();
+      }
+
+  // ----- gather -----
+  // store parent id of all cells
+  std::vector<unsigned int> cell_ids(tria.n_active_cells());
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        const std::string  parent_cellid = cell->parent()->id().to_string();
+        const unsigned int parent_coarse_cell_id =
+          (unsigned int)std::stoul(parent_cellid);
+        cell_ids[cell->active_cell_index()] = parent_coarse_cell_id;
+
+        deallog << "cellid=" << cell->id()
+                << " parentid=" << cell_ids[cell->active_cell_index()];
+        if (cell->coarsen_flag_set())
+          deallog << " coarsening";
+        else if (cell->refine_flag_set())
+          deallog << " refining";
+        deallog << std::endl;
+      }
+
+  // ----- transfer -----
+  parallel::distributed::
+    CellDataTransfer<dim, spacedim, std::vector<unsigned int>>
+      cell_data_transfer(tria);
+
+  cell_data_transfer.prepare_for_coarsening_and_refinement(cell_ids);
+  tria.execute_coarsening_and_refinement();
+  deallog << "cells after: " << tria.n_global_active_cells() << std::endl;
+
+  cell_ids.resize(tria.n_active_cells());
+  cell_data_transfer.unpack(cell_ids);
+
+  // ------ verify ------
+  // check if all children adopted the correct id
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      deallog << "cellid=" << cell->id()
+              << " parentid=" << cell_ids[(cell->active_cell_index())]
+              << std::endl;
+
+  // make sure no processor is hanging
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  deallog << "OK" << std::endl;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  MPILogInitAll                    log;
+
+  deallog.push("2d");
+  test<2, 2>();
+  deallog.pop();
+  deallog.push("3d");
+  test<3, 3>();
+  deallog.pop();
+}
diff --git a/tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=2.output b/tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=2.output
new file mode 100644 (file)
index 0000000..309405c
--- /dev/null
@@ -0,0 +1,175 @@
+
+DEAL:0:2d::cells before: 16
+DEAL:0:2d::cellid=0_1:0 parentid=0 refining
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::cellid=1_1:0 parentid=1
+DEAL:0:2d::cellid=1_1:1 parentid=1
+DEAL:0:2d::cellid=1_1:2 parentid=1
+DEAL:0:2d::cellid=1_1:3 parentid=1
+DEAL:0:2d::cells after: 16
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::cellid=0_2:00 parentid=0
+DEAL:0:2d::cellid=0_2:01 parentid=0
+DEAL:0:2d::cellid=0_2:02 parentid=0
+DEAL:0:2d::cellid=0_2:03 parentid=0
+DEAL:0:2d::OK
+DEAL:0:3d::cells before: 64
+DEAL:0:3d::cellid=0_1:0 parentid=0 refining
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::cellid=1_1:0 parentid=1
+DEAL:0:3d::cellid=1_1:1 parentid=1
+DEAL:0:3d::cellid=1_1:2 parentid=1
+DEAL:0:3d::cellid=1_1:3 parentid=1
+DEAL:0:3d::cellid=1_1:4 parentid=1
+DEAL:0:3d::cellid=1_1:5 parentid=1
+DEAL:0:3d::cellid=1_1:6 parentid=1
+DEAL:0:3d::cellid=1_1:7 parentid=1
+DEAL:0:3d::cellid=2_1:0 parentid=2
+DEAL:0:3d::cellid=2_1:1 parentid=2
+DEAL:0:3d::cellid=2_1:2 parentid=2
+DEAL:0:3d::cellid=2_1:3 parentid=2
+DEAL:0:3d::cellid=2_1:4 parentid=2
+DEAL:0:3d::cellid=2_1:5 parentid=2
+DEAL:0:3d::cellid=2_1:6 parentid=2
+DEAL:0:3d::cellid=2_1:7 parentid=2
+DEAL:0:3d::cellid=3_1:0 parentid=3
+DEAL:0:3d::cellid=3_1:1 parentid=3
+DEAL:0:3d::cellid=3_1:2 parentid=3
+DEAL:0:3d::cellid=3_1:3 parentid=3
+DEAL:0:3d::cellid=3_1:4 parentid=3
+DEAL:0:3d::cellid=3_1:5 parentid=3
+DEAL:0:3d::cellid=3_1:6 parentid=3
+DEAL:0:3d::cellid=3_1:7 parentid=3
+DEAL:0:3d::cells after: 64
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::cellid=1_1:0 parentid=1
+DEAL:0:3d::cellid=1_1:1 parentid=1
+DEAL:0:3d::cellid=1_1:2 parentid=1
+DEAL:0:3d::cellid=1_1:3 parentid=1
+DEAL:0:3d::cellid=1_1:4 parentid=1
+DEAL:0:3d::cellid=1_1:5 parentid=1
+DEAL:0:3d::cellid=1_1:6 parentid=1
+DEAL:0:3d::cellid=1_1:7 parentid=1
+DEAL:0:3d::cellid=2_1:0 parentid=2
+DEAL:0:3d::cellid=2_1:1 parentid=2
+DEAL:0:3d::cellid=2_1:2 parentid=2
+DEAL:0:3d::cellid=2_1:3 parentid=2
+DEAL:0:3d::cellid=2_1:4 parentid=2
+DEAL:0:3d::cellid=2_1:5 parentid=2
+DEAL:0:3d::cellid=2_1:6 parentid=2
+DEAL:0:3d::cellid=2_1:7 parentid=2
+DEAL:0:3d::cellid=0_2:00 parentid=0
+DEAL:0:3d::cellid=0_2:01 parentid=0
+DEAL:0:3d::cellid=0_2:02 parentid=0
+DEAL:0:3d::cellid=0_2:03 parentid=0
+DEAL:0:3d::cellid=0_2:04 parentid=0
+DEAL:0:3d::cellid=0_2:05 parentid=0
+DEAL:0:3d::cellid=0_2:06 parentid=0
+DEAL:0:3d::cellid=0_2:07 parentid=0
+DEAL:0:3d::OK 
+
+DEAL:1:2d::cells before: 16
+DEAL:1:2d::cellid=2_1:0 parentid=2
+DEAL:1:2d::cellid=2_1:1 parentid=2
+DEAL:1:2d::cellid=2_1:2 parentid=2
+DEAL:1:2d::cellid=2_1:3 parentid=2
+DEAL:1:2d::cellid=3_1:0 parentid=3 coarsening
+DEAL:1:2d::cellid=3_1:1 parentid=3 coarsening
+DEAL:1:2d::cellid=3_1:2 parentid=3 coarsening
+DEAL:1:2d::cellid=3_1:3 parentid=3 coarsening
+DEAL:1:2d::cells after: 16
+DEAL:1:2d::cellid=3_0: parentid=3
+DEAL:1:2d::cellid=1_1:0 parentid=1
+DEAL:1:2d::cellid=1_1:1 parentid=1
+DEAL:1:2d::cellid=1_1:2 parentid=1
+DEAL:1:2d::cellid=1_1:3 parentid=1
+DEAL:1:2d::cellid=2_1:0 parentid=2
+DEAL:1:2d::cellid=2_1:1 parentid=2
+DEAL:1:2d::cellid=2_1:2 parentid=2
+DEAL:1:2d::cellid=2_1:3 parentid=2
+DEAL:1:2d::OK
+DEAL:1:3d::cells before: 64
+DEAL:1:3d::cellid=4_1:0 parentid=4
+DEAL:1:3d::cellid=4_1:1 parentid=4
+DEAL:1:3d::cellid=4_1:2 parentid=4
+DEAL:1:3d::cellid=4_1:3 parentid=4
+DEAL:1:3d::cellid=4_1:4 parentid=4
+DEAL:1:3d::cellid=4_1:5 parentid=4
+DEAL:1:3d::cellid=4_1:6 parentid=4
+DEAL:1:3d::cellid=4_1:7 parentid=4
+DEAL:1:3d::cellid=5_1:0 parentid=5
+DEAL:1:3d::cellid=5_1:1 parentid=5
+DEAL:1:3d::cellid=5_1:2 parentid=5
+DEAL:1:3d::cellid=5_1:3 parentid=5
+DEAL:1:3d::cellid=5_1:4 parentid=5
+DEAL:1:3d::cellid=5_1:5 parentid=5
+DEAL:1:3d::cellid=5_1:6 parentid=5
+DEAL:1:3d::cellid=5_1:7 parentid=5
+DEAL:1:3d::cellid=6_1:0 parentid=6
+DEAL:1:3d::cellid=6_1:1 parentid=6
+DEAL:1:3d::cellid=6_1:2 parentid=6
+DEAL:1:3d::cellid=6_1:3 parentid=6
+DEAL:1:3d::cellid=6_1:4 parentid=6
+DEAL:1:3d::cellid=6_1:5 parentid=6
+DEAL:1:3d::cellid=6_1:6 parentid=6
+DEAL:1:3d::cellid=6_1:7 parentid=6
+DEAL:1:3d::cellid=7_1:0 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:1 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:2 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:3 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:4 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:5 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:6 parentid=7 coarsening
+DEAL:1:3d::cellid=7_1:7 parentid=7 coarsening
+DEAL:1:3d::cells after: 64
+DEAL:1:3d::cellid=7_0: parentid=7
+DEAL:1:3d::cellid=3_1:0 parentid=3
+DEAL:1:3d::cellid=3_1:1 parentid=3
+DEAL:1:3d::cellid=3_1:2 parentid=3
+DEAL:1:3d::cellid=3_1:3 parentid=3
+DEAL:1:3d::cellid=3_1:4 parentid=3
+DEAL:1:3d::cellid=3_1:5 parentid=3
+DEAL:1:3d::cellid=3_1:6 parentid=3
+DEAL:1:3d::cellid=3_1:7 parentid=3
+DEAL:1:3d::cellid=4_1:0 parentid=4
+DEAL:1:3d::cellid=4_1:1 parentid=4
+DEAL:1:3d::cellid=4_1:2 parentid=4
+DEAL:1:3d::cellid=4_1:3 parentid=4
+DEAL:1:3d::cellid=4_1:4 parentid=4
+DEAL:1:3d::cellid=4_1:5 parentid=4
+DEAL:1:3d::cellid=4_1:6 parentid=4
+DEAL:1:3d::cellid=4_1:7 parentid=4
+DEAL:1:3d::cellid=5_1:0 parentid=5
+DEAL:1:3d::cellid=5_1:1 parentid=5
+DEAL:1:3d::cellid=5_1:2 parentid=5
+DEAL:1:3d::cellid=5_1:3 parentid=5
+DEAL:1:3d::cellid=5_1:4 parentid=5
+DEAL:1:3d::cellid=5_1:5 parentid=5
+DEAL:1:3d::cellid=5_1:6 parentid=5
+DEAL:1:3d::cellid=5_1:7 parentid=5
+DEAL:1:3d::cellid=6_1:0 parentid=6
+DEAL:1:3d::cellid=6_1:1 parentid=6
+DEAL:1:3d::cellid=6_1:2 parentid=6
+DEAL:1:3d::cellid=6_1:3 parentid=6
+DEAL:1:3d::cellid=6_1:4 parentid=6
+DEAL:1:3d::cellid=6_1:5 parentid=6
+DEAL:1:3d::cellid=6_1:6 parentid=6
+DEAL:1:3d::cellid=6_1:7 parentid=6
+DEAL:1:3d::OK
+
diff --git a/tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=8.output b/tests/mpi/cell_data_transfer_01.with_p4est=true.mpirun=8.output
new file mode 100644 (file)
index 0000000..f3d2e23
--- /dev/null
@@ -0,0 +1,223 @@
+
+DEAL:0:2d::cells before: 16
+DEAL:0:2d::cellid=0_1:0 parentid=0 refining
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::cells after: 16
+DEAL:0:2d::cellid=0_2:00 parentid=0
+DEAL:0:2d::cellid=0_2:01 parentid=0
+DEAL:0:2d::cellid=0_2:02 parentid=0
+DEAL:0:2d::cellid=0_2:03 parentid=0
+DEAL:0:2d::OK
+DEAL:0:3d::cells before: 64
+DEAL:0:3d::cellid=0_1:0 parentid=0 refining
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::cells after: 64 
+DEAL:0:3d::cellid=0_2:00 parentid=0
+DEAL:0:3d::cellid=0_2:01 parentid=0
+DEAL:0:3d::cellid=0_2:02 parentid=0
+DEAL:0:3d::cellid=0_2:03 parentid=0
+DEAL:0:3d::cellid=0_2:04 parentid=0
+DEAL:0:3d::cellid=0_2:05 parentid=0
+DEAL:0:3d::cellid=0_2:06 parentid=0
+DEAL:0:3d::cellid=0_2:07 parentid=0
+DEAL:0:3d::OK
+
+DEAL:1:2d::cells before: 16
+DEAL:1:2d::cells after: 16
+DEAL:1:2d::OK
+DEAL:1:3d::cells before: 64
+DEAL:1:3d::cellid=1_1:0 parentid=1
+DEAL:1:3d::cellid=1_1:1 parentid=1
+DEAL:1:3d::cellid=1_1:2 parentid=1
+DEAL:1:3d::cellid=1_1:3 parentid=1
+DEAL:1:3d::cellid=1_1:4 parentid=1
+DEAL:1:3d::cellid=1_1:5 parentid=1
+DEAL:1:3d::cellid=1_1:6 parentid=1
+DEAL:1:3d::cellid=1_1:7 parentid=1
+DEAL:1:3d::cells after: 64
+DEAL:1:3d::cellid=0_1:1 parentid=0
+DEAL:1:3d::cellid=0_1:2 parentid=0
+DEAL:1:3d::cellid=0_1:3 parentid=0
+DEAL:1:3d::cellid=0_1:4 parentid=0
+DEAL:1:3d::cellid=0_1:5 parentid=0
+DEAL:1:3d::cellid=0_1:6 parentid=0
+DEAL:1:3d::cellid=0_1:7 parentid=0
+DEAL:1:3d::OK
+
+
+DEAL:2:2d::cells before: 16
+DEAL:2:2d::cellid=1_1:0 parentid=1
+DEAL:2:2d::cellid=1_1:1 parentid=1
+DEAL:2:2d::cellid=1_1:2 parentid=1
+DEAL:2:2d::cellid=1_1:3 parentid=1
+DEAL:2:2d::cells after: 16
+DEAL:2:2d::cellid=0_1:1 parentid=0
+DEAL:2:2d::cellid=0_1:2 parentid=0
+DEAL:2:2d::OK
+DEAL:2:3d::cells before: 64
+DEAL:2:3d::cellid=2_1:0 parentid=2
+DEAL:2:3d::cellid=2_1:1 parentid=2
+DEAL:2:3d::cellid=2_1:2 parentid=2
+DEAL:2:3d::cellid=2_1:3 parentid=2
+DEAL:2:3d::cellid=2_1:4 parentid=2
+DEAL:2:3d::cellid=2_1:5 parentid=2
+DEAL:2:3d::cellid=2_1:6 parentid=2
+DEAL:2:3d::cellid=2_1:7 parentid=2
+DEAL:2:3d::cells after: 64
+DEAL:2:3d::cellid=1_1:0 parentid=1
+DEAL:2:3d::cellid=1_1:1 parentid=1
+DEAL:2:3d::cellid=1_1:2 parentid=1
+DEAL:2:3d::cellid=1_1:3 parentid=1
+DEAL:2:3d::cellid=1_1:4 parentid=1
+DEAL:2:3d::cellid=1_1:5 parentid=1
+DEAL:2:3d::cellid=1_1:6 parentid=1
+DEAL:2:3d::cellid=1_1:7 parentid=1
+DEAL:2:3d::OK
+
+
+DEAL:3:2d::cells before: 16
+DEAL:3:2d::cells after: 16
+DEAL:3:2d::cellid=0_1:3 parentid=0
+DEAL:3:2d::OK
+DEAL:3:3d::cells before: 64
+DEAL:3:3d::cellid=3_1:0 parentid=3
+DEAL:3:3d::cellid=3_1:1 parentid=3
+DEAL:3:3d::cellid=3_1:2 parentid=3
+DEAL:3:3d::cellid=3_1:3 parentid=3
+DEAL:3:3d::cellid=3_1:4 parentid=3
+DEAL:3:3d::cellid=3_1:5 parentid=3
+DEAL:3:3d::cellid=3_1:6 parentid=3
+DEAL:3:3d::cellid=3_1:7 parentid=3
+DEAL:3:3d::cells after: 64
+DEAL:3:3d::cellid=2_1:0 parentid=2
+DEAL:3:3d::cellid=2_1:1 parentid=2
+DEAL:3:3d::cellid=2_1:2 parentid=2
+DEAL:3:3d::cellid=2_1:3 parentid=2
+DEAL:3:3d::cellid=2_1:4 parentid=2
+DEAL:3:3d::cellid=2_1:5 parentid=2
+DEAL:3:3d::cellid=2_1:6 parentid=2
+DEAL:3:3d::cellid=2_1:7 parentid=2
+DEAL:3:3d::OK
+
+
+DEAL:4:2d::cells before: 16
+DEAL:4:2d::cellid=2_1:0 parentid=2
+DEAL:4:2d::cellid=2_1:1 parentid=2
+DEAL:4:2d::cellid=2_1:2 parentid=2
+DEAL:4:2d::cellid=2_1:3 parentid=2
+DEAL:4:2d::cells after: 16
+DEAL:4:2d::cellid=1_1:0 parentid=1
+DEAL:4:2d::cellid=1_1:1 parentid=1
+DEAL:4:2d::cellid=1_1:2 parentid=1
+DEAL:4:2d::cellid=1_1:3 parentid=1
+DEAL:4:2d::OK
+DEAL:4:3d::cells before: 64
+DEAL:4:3d::cellid=4_1:0 parentid=4
+DEAL:4:3d::cellid=4_1:1 parentid=4
+DEAL:4:3d::cellid=4_1:2 parentid=4
+DEAL:4:3d::cellid=4_1:3 parentid=4
+DEAL:4:3d::cellid=4_1:4 parentid=4
+DEAL:4:3d::cellid=4_1:5 parentid=4
+DEAL:4:3d::cellid=4_1:6 parentid=4
+DEAL:4:3d::cellid=4_1:7 parentid=4
+DEAL:4:3d::cells after: 64
+DEAL:4:3d::cellid=3_1:0 parentid=3
+DEAL:4:3d::cellid=3_1:1 parentid=3
+DEAL:4:3d::cellid=3_1:2 parentid=3
+DEAL:4:3d::cellid=3_1:3 parentid=3
+DEAL:4:3d::cellid=3_1:4 parentid=3
+DEAL:4:3d::cellid=3_1:5 parentid=3
+DEAL:4:3d::cellid=3_1:6 parentid=3
+DEAL:4:3d::cellid=3_1:7 parentid=3
+DEAL:4:3d::OK
+
+
+DEAL:5:2d::cells before: 16
+DEAL:5:2d::cells after: 16
+DEAL:5:2d::OK
+DEAL:5:3d::cells before: 64
+DEAL:5:3d::cellid=5_1:0 parentid=5
+DEAL:5:3d::cellid=5_1:1 parentid=5
+DEAL:5:3d::cellid=5_1:2 parentid=5
+DEAL:5:3d::cellid=5_1:3 parentid=5
+DEAL:5:3d::cellid=5_1:4 parentid=5
+DEAL:5:3d::cellid=5_1:5 parentid=5
+DEAL:5:3d::cellid=5_1:6 parentid=5
+DEAL:5:3d::cellid=5_1:7 parentid=5
+DEAL:5:3d::cells after: 64
+DEAL:5:3d::cellid=4_1:0 parentid=4
+DEAL:5:3d::cellid=4_1:1 parentid=4
+DEAL:5:3d::cellid=4_1:2 parentid=4
+DEAL:5:3d::cellid=4_1:3 parentid=4
+DEAL:5:3d::cellid=4_1:4 parentid=4
+DEAL:5:3d::cellid=4_1:5 parentid=4
+DEAL:5:3d::cellid=4_1:6 parentid=4
+DEAL:5:3d::cellid=4_1:7 parentid=4
+DEAL:5:3d::OK
+
+
+DEAL:6:2d::cells before: 16
+DEAL:6:2d::cellid=3_1:0 parentid=3 coarsening
+DEAL:6:2d::cellid=3_1:1 parentid=3 coarsening
+DEAL:6:2d::cellid=3_1:2 parentid=3 coarsening
+DEAL:6:2d::cellid=3_1:3 parentid=3 coarsening
+DEAL:6:2d::cells after: 16
+DEAL:6:2d::cellid=2_1:0 parentid=2
+DEAL:6:2d::cellid=2_1:1 parentid=2
+DEAL:6:2d::cellid=2_1:2 parentid=2
+DEAL:6:2d::cellid=2_1:3 parentid=2
+DEAL:6:2d::OK
+DEAL:6:3d::cells before: 64
+DEAL:6:3d::cellid=6_1:0 parentid=6
+DEAL:6:3d::cellid=6_1:1 parentid=6
+DEAL:6:3d::cellid=6_1:2 parentid=6
+DEAL:6:3d::cellid=6_1:3 parentid=6
+DEAL:6:3d::cellid=6_1:4 parentid=6
+DEAL:6:3d::cellid=6_1:5 parentid=6
+DEAL:6:3d::cellid=6_1:6 parentid=6
+DEAL:6:3d::cellid=6_1:7 parentid=6
+DEAL:6:3d::cells after: 64
+DEAL:6:3d::cellid=5_1:0 parentid=5
+DEAL:6:3d::cellid=5_1:1 parentid=5
+DEAL:6:3d::cellid=5_1:2 parentid=5
+DEAL:6:3d::cellid=5_1:3 parentid=5
+DEAL:6:3d::cellid=5_1:4 parentid=5
+DEAL:6:3d::cellid=5_1:5 parentid=5
+DEAL:6:3d::cellid=5_1:6 parentid=5
+DEAL:6:3d::cellid=5_1:7 parentid=5
+DEAL:6:3d::OK
+
+
+DEAL:7:2d::cells before: 16
+DEAL:7:2d::cells after: 16
+DEAL:7:2d::cellid=3_0: parentid=3
+DEAL:7:2d::OK
+DEAL:7:3d::cells before: 64
+DEAL:7:3d::cellid=7_1:0 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:1 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:2 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:3 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:4 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:5 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:6 parentid=7 coarsening
+DEAL:7:3d::cellid=7_1:7 parentid=7 coarsening
+DEAL:7:3d::cells after: 64
+DEAL:7:3d::cellid=7_0: parentid=7
+DEAL:7:3d::cellid=6_1:0 parentid=6
+DEAL:7:3d::cellid=6_1:1 parentid=6
+DEAL:7:3d::cellid=6_1:2 parentid=6
+DEAL:7:3d::cellid=6_1:3 parentid=6
+DEAL:7:3d::cellid=6_1:4 parentid=6
+DEAL:7:3d::cellid=6_1:5 parentid=6
+DEAL:7:3d::cellid=6_1:6 parentid=6
+DEAL:7:3d::cellid=6_1:7 parentid=6
+DEAL:7:3d::OK
+
diff --git a/tests/mpi/cell_data_transfer_02.cc b/tests/mpi/cell_data_transfer_02.cc
new file mode 100644 (file)
index 0000000..5ce31a0
--- /dev/null
@@ -0,0 +1,117 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// p::d::CellDataTransfer test by serialization
+
+
+#include <deal.II/distributed/cell_data_transfer.templates.h>
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <string>
+
+#include "../tests.h"
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  {
+    deallog << "writing" << std::endl;
+
+    // ------ setup ------
+    parallel::distributed::Triangulation<dim, spacedim> tria(MPI_COMM_WORLD);
+    GridGenerator::subdivided_hyper_cube(tria, 2);
+    tria.refine_global(1);
+
+    // ----- gather -----
+    // store parent id of all cells
+    std::vector<unsigned int> cell_ids(tria.n_active_cells());
+    for (auto &cell : tria.active_cell_iterators())
+      if (cell->is_locally_owned())
+        {
+          const std::string  parent_cellid = cell->parent()->id().to_string();
+          const unsigned int parent_coarse_cell_id =
+            (unsigned int)std::stoul(parent_cellid);
+          cell_ids[cell->active_cell_index()] = parent_coarse_cell_id;
+
+          deallog << "cellid=" << cell->id()
+                  << " parentid=" << cell_ids[cell->active_cell_index()]
+                  << std::endl;
+        }
+
+    // ----- transfer -----
+    parallel::distributed::
+      CellDataTransfer<dim, spacedim, std::vector<unsigned int>>
+        cell_data_transfer(tria);
+
+    cell_data_transfer.prepare_for_coarsening_and_refinement(cell_ids);
+    tria.save("file");
+
+    // make sure no processor is hanging
+    MPI_Barrier(MPI_COMM_WORLD);
+  }
+
+  {
+    deallog << "reading" << std::endl;
+
+    // ------ setup ------
+    parallel::distributed::Triangulation<dim, spacedim> tria(MPI_COMM_WORLD);
+    GridGenerator::subdivided_hyper_cube(tria, 2);
+    // triangulation has to be initialized with correct coarse cells
+
+    // ----- transfer -----
+    tria.load("file");
+
+    parallel::distributed::
+      CellDataTransfer<dim, spacedim, std::vector<unsigned int>>
+        cell_data_transfer(tria);
+
+    std::vector<unsigned int> cell_ids(tria.n_active_cells());
+    cell_data_transfer.deserialize(cell_ids);
+
+    // ------ verify ------
+    // check if all children adopted the correct id
+    for (auto &cell : tria.active_cell_iterators())
+      if (cell->is_locally_owned())
+        deallog << "cellid=" << cell->id()
+                << " parentid=" << cell_ids[(cell->active_cell_index())]
+                << std::endl;
+
+    // make sure no processor is hanging
+    MPI_Barrier(MPI_COMM_WORLD);
+  }
+
+  deallog << "OK" << std::endl;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  MPILogInitAll                    log;
+
+  deallog.push("2d");
+  test<2, 2>();
+  deallog.pop();
+  deallog.push("3d");
+  test<3, 3>();
+  deallog.pop();
+}
diff --git a/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=2.output b/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=2.output
new file mode 100644 (file)
index 0000000..8b0881d
--- /dev/null
@@ -0,0 +1,175 @@
+
+DEAL:0:2d::writing
+DEAL:0:2d::cellid=0_1:0 parentid=0
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::cellid=1_1:0 parentid=1
+DEAL:0:2d::cellid=1_1:1 parentid=1
+DEAL:0:2d::cellid=1_1:2 parentid=1
+DEAL:0:2d::cellid=1_1:3 parentid=1
+DEAL:0:2d::reading
+DEAL:0:2d::cellid=0_1:0 parentid=0
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::cellid=1_1:0 parentid=1
+DEAL:0:2d::cellid=1_1:1 parentid=1
+DEAL:0:2d::cellid=1_1:2 parentid=1
+DEAL:0:2d::cellid=1_1:3 parentid=1
+DEAL:0:2d::OK
+DEAL:0:3d::writing
+DEAL:0:3d::cellid=0_1:0 parentid=0
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::cellid=1_1:0 parentid=1
+DEAL:0:3d::cellid=1_1:1 parentid=1
+DEAL:0:3d::cellid=1_1:2 parentid=1
+DEAL:0:3d::cellid=1_1:3 parentid=1
+DEAL:0:3d::cellid=1_1:4 parentid=1
+DEAL:0:3d::cellid=1_1:5 parentid=1
+DEAL:0:3d::cellid=1_1:6 parentid=1
+DEAL:0:3d::cellid=1_1:7 parentid=1
+DEAL:0:3d::cellid=2_1:0 parentid=2
+DEAL:0:3d::cellid=2_1:1 parentid=2
+DEAL:0:3d::cellid=2_1:2 parentid=2
+DEAL:0:3d::cellid=2_1:3 parentid=2
+DEAL:0:3d::cellid=2_1:4 parentid=2
+DEAL:0:3d::cellid=2_1:5 parentid=2
+DEAL:0:3d::cellid=2_1:6 parentid=2
+DEAL:0:3d::cellid=2_1:7 parentid=2
+DEAL:0:3d::cellid=3_1:0 parentid=3
+DEAL:0:3d::cellid=3_1:1 parentid=3
+DEAL:0:3d::cellid=3_1:2 parentid=3
+DEAL:0:3d::cellid=3_1:3 parentid=3
+DEAL:0:3d::cellid=3_1:4 parentid=3
+DEAL:0:3d::cellid=3_1:5 parentid=3
+DEAL:0:3d::cellid=3_1:6 parentid=3
+DEAL:0:3d::cellid=3_1:7 parentid=3
+DEAL:0:3d::reading
+DEAL:0:3d::cellid=0_1:0 parentid=0
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::cellid=1_1:0 parentid=1
+DEAL:0:3d::cellid=1_1:1 parentid=1
+DEAL:0:3d::cellid=1_1:2 parentid=1
+DEAL:0:3d::cellid=1_1:3 parentid=1
+DEAL:0:3d::cellid=1_1:4 parentid=1
+DEAL:0:3d::cellid=1_1:5 parentid=1
+DEAL:0:3d::cellid=1_1:6 parentid=1
+DEAL:0:3d::cellid=1_1:7 parentid=1
+DEAL:0:3d::cellid=2_1:0 parentid=2
+DEAL:0:3d::cellid=2_1:1 parentid=2
+DEAL:0:3d::cellid=2_1:2 parentid=2
+DEAL:0:3d::cellid=2_1:3 parentid=2
+DEAL:0:3d::cellid=2_1:4 parentid=2
+DEAL:0:3d::cellid=2_1:5 parentid=2
+DEAL:0:3d::cellid=2_1:6 parentid=2
+DEAL:0:3d::cellid=2_1:7 parentid=2
+DEAL:0:3d::cellid=3_1:0 parentid=3
+DEAL:0:3d::cellid=3_1:1 parentid=3
+DEAL:0:3d::cellid=3_1:2 parentid=3
+DEAL:0:3d::cellid=3_1:3 parentid=3
+DEAL:0:3d::cellid=3_1:4 parentid=3
+DEAL:0:3d::cellid=3_1:5 parentid=3
+DEAL:0:3d::cellid=3_1:6 parentid=3
+DEAL:0:3d::cellid=3_1:7 parentid=3
+DEAL:0:3d::OK
+
+DEAL:1:2d::writing
+DEAL:1:2d::cellid=2_1:0 parentid=2
+DEAL:1:2d::cellid=2_1:1 parentid=2
+DEAL:1:2d::cellid=2_1:2 parentid=2
+DEAL:1:2d::cellid=2_1:3 parentid=2
+DEAL:1:2d::cellid=3_1:0 parentid=3
+DEAL:1:2d::cellid=3_1:1 parentid=3
+DEAL:1:2d::cellid=3_1:2 parentid=3
+DEAL:1:2d::cellid=3_1:3 parentid=3
+DEAL:1:2d::reading
+DEAL:1:2d::cellid=2_1:0 parentid=2
+DEAL:1:2d::cellid=2_1:1 parentid=2
+DEAL:1:2d::cellid=2_1:2 parentid=2
+DEAL:1:2d::cellid=2_1:3 parentid=2
+DEAL:1:2d::cellid=3_1:0 parentid=3
+DEAL:1:2d::cellid=3_1:1 parentid=3
+DEAL:1:2d::cellid=3_1:2 parentid=3
+DEAL:1:2d::cellid=3_1:3 parentid=3
+DEAL:1:2d::OK
+DEAL:1:3d::writing
+DEAL:1:3d::cellid=4_1:0 parentid=4
+DEAL:1:3d::cellid=4_1:1 parentid=4
+DEAL:1:3d::cellid=4_1:2 parentid=4
+DEAL:1:3d::cellid=4_1:3 parentid=4
+DEAL:1:3d::cellid=4_1:4 parentid=4
+DEAL:1:3d::cellid=4_1:5 parentid=4
+DEAL:1:3d::cellid=4_1:6 parentid=4
+DEAL:1:3d::cellid=4_1:7 parentid=4
+DEAL:1:3d::cellid=5_1:0 parentid=5
+DEAL:1:3d::cellid=5_1:1 parentid=5
+DEAL:1:3d::cellid=5_1:2 parentid=5
+DEAL:1:3d::cellid=5_1:3 parentid=5
+DEAL:1:3d::cellid=5_1:4 parentid=5
+DEAL:1:3d::cellid=5_1:5 parentid=5
+DEAL:1:3d::cellid=5_1:6 parentid=5
+DEAL:1:3d::cellid=5_1:7 parentid=5
+DEAL:1:3d::cellid=6_1:0 parentid=6
+DEAL:1:3d::cellid=6_1:1 parentid=6
+DEAL:1:3d::cellid=6_1:2 parentid=6
+DEAL:1:3d::cellid=6_1:3 parentid=6
+DEAL:1:3d::cellid=6_1:4 parentid=6
+DEAL:1:3d::cellid=6_1:5 parentid=6
+DEAL:1:3d::cellid=6_1:6 parentid=6
+DEAL:1:3d::cellid=6_1:7 parentid=6
+DEAL:1:3d::cellid=7_1:0 parentid=7
+DEAL:1:3d::cellid=7_1:1 parentid=7
+DEAL:1:3d::cellid=7_1:2 parentid=7
+DEAL:1:3d::cellid=7_1:3 parentid=7
+DEAL:1:3d::cellid=7_1:4 parentid=7
+DEAL:1:3d::cellid=7_1:5 parentid=7
+DEAL:1:3d::cellid=7_1:6 parentid=7
+DEAL:1:3d::cellid=7_1:7 parentid=7
+DEAL:1:3d::reading
+DEAL:1:3d::cellid=4_1:0 parentid=4
+DEAL:1:3d::cellid=4_1:1 parentid=4
+DEAL:1:3d::cellid=4_1:2 parentid=4
+DEAL:1:3d::cellid=4_1:3 parentid=4
+DEAL:1:3d::cellid=4_1:4 parentid=4
+DEAL:1:3d::cellid=4_1:5 parentid=4
+DEAL:1:3d::cellid=4_1:6 parentid=4
+DEAL:1:3d::cellid=4_1:7 parentid=4
+DEAL:1:3d::cellid=5_1:0 parentid=5
+DEAL:1:3d::cellid=5_1:1 parentid=5
+DEAL:1:3d::cellid=5_1:2 parentid=5
+DEAL:1:3d::cellid=5_1:3 parentid=5
+DEAL:1:3d::cellid=5_1:4 parentid=5
+DEAL:1:3d::cellid=5_1:5 parentid=5
+DEAL:1:3d::cellid=5_1:6 parentid=5
+DEAL:1:3d::cellid=5_1:7 parentid=5
+DEAL:1:3d::cellid=6_1:0 parentid=6
+DEAL:1:3d::cellid=6_1:1 parentid=6
+DEAL:1:3d::cellid=6_1:2 parentid=6
+DEAL:1:3d::cellid=6_1:3 parentid=6
+DEAL:1:3d::cellid=6_1:4 parentid=6
+DEAL:1:3d::cellid=6_1:5 parentid=6
+DEAL:1:3d::cellid=6_1:6 parentid=6
+DEAL:1:3d::cellid=6_1:7 parentid=6
+DEAL:1:3d::cellid=7_1:0 parentid=7
+DEAL:1:3d::cellid=7_1:1 parentid=7
+DEAL:1:3d::cellid=7_1:2 parentid=7
+DEAL:1:3d::cellid=7_1:3 parentid=7
+DEAL:1:3d::cellid=7_1:4 parentid=7
+DEAL:1:3d::cellid=7_1:5 parentid=7
+DEAL:1:3d::cellid=7_1:6 parentid=7
+DEAL:1:3d::cellid=7_1:7 parentid=7
+DEAL:1:3d::OK
+
diff --git a/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output b/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output
new file mode 100644 (file)
index 0000000..2597c8c
--- /dev/null
@@ -0,0 +1,223 @@
+
+DEAL:0:2d::writing
+DEAL:0:2d::cellid=0_1:0 parentid=0
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::cellid=0_1:2 parentid=0
+DEAL:0:2d::cellid=0_1:3 parentid=0
+DEAL:0:2d::reading
+DEAL:0:2d::cellid=0_1:0 parentid=0
+DEAL:0:2d::cellid=0_1:1 parentid=0
+DEAL:0:2d::OK
+DEAL:0:3d::writing
+DEAL:0:3d::cellid=0_1:0 parentid=0
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::reading
+DEAL:0:3d::cellid=0_1:0 parentid=0
+DEAL:0:3d::cellid=0_1:1 parentid=0
+DEAL:0:3d::cellid=0_1:2 parentid=0
+DEAL:0:3d::cellid=0_1:3 parentid=0
+DEAL:0:3d::cellid=0_1:4 parentid=0
+DEAL:0:3d::cellid=0_1:5 parentid=0
+DEAL:0:3d::cellid=0_1:6 parentid=0
+DEAL:0:3d::cellid=0_1:7 parentid=0
+DEAL:0:3d::OK
+
+DEAL:1:2d::writing
+DEAL:1:2d::reading
+DEAL:1:2d::cellid=0_1:2 parentid=0
+DEAL:1:2d::cellid=0_1:3 parentid=0
+DEAL:1:2d::OK
+DEAL:1:3d::writing
+DEAL:1:3d::cellid=1_1:0 parentid=1
+DEAL:1:3d::cellid=1_1:1 parentid=1
+DEAL:1:3d::cellid=1_1:2 parentid=1
+DEAL:1:3d::cellid=1_1:3 parentid=1
+DEAL:1:3d::cellid=1_1:4 parentid=1
+DEAL:1:3d::cellid=1_1:5 parentid=1
+DEAL:1:3d::cellid=1_1:6 parentid=1
+DEAL:1:3d::cellid=1_1:7 parentid=1
+DEAL:1:3d::reading
+DEAL:1:3d::cellid=1_1:0 parentid=1
+DEAL:1:3d::cellid=1_1:1 parentid=1
+DEAL:1:3d::cellid=1_1:2 parentid=1
+DEAL:1:3d::cellid=1_1:3 parentid=1
+DEAL:1:3d::cellid=1_1:4 parentid=1
+DEAL:1:3d::cellid=1_1:5 parentid=1
+DEAL:1:3d::cellid=1_1:6 parentid=1
+DEAL:1:3d::cellid=1_1:7 parentid=1
+DEAL:1:3d::OK
+
+
+DEAL:2:2d::writing
+DEAL:2:2d::cellid=1_1:0 parentid=1
+DEAL:2:2d::cellid=1_1:1 parentid=1
+DEAL:2:2d::cellid=1_1:2 parentid=1
+DEAL:2:2d::cellid=1_1:3 parentid=1
+DEAL:2:2d::reading
+DEAL:2:2d::cellid=1_1:0 parentid=1
+DEAL:2:2d::cellid=1_1:1 parentid=1
+DEAL:2:2d::OK
+DEAL:2:3d::writing
+DEAL:2:3d::cellid=2_1:0 parentid=2
+DEAL:2:3d::cellid=2_1:1 parentid=2
+DEAL:2:3d::cellid=2_1:2 parentid=2
+DEAL:2:3d::cellid=2_1:3 parentid=2
+DEAL:2:3d::cellid=2_1:4 parentid=2
+DEAL:2:3d::cellid=2_1:5 parentid=2
+DEAL:2:3d::cellid=2_1:6 parentid=2
+DEAL:2:3d::cellid=2_1:7 parentid=2
+DEAL:2:3d::reading
+DEAL:2:3d::cellid=2_1:0 parentid=2
+DEAL:2:3d::cellid=2_1:1 parentid=2
+DEAL:2:3d::cellid=2_1:2 parentid=2
+DEAL:2:3d::cellid=2_1:3 parentid=2
+DEAL:2:3d::cellid=2_1:4 parentid=2
+DEAL:2:3d::cellid=2_1:5 parentid=2
+DEAL:2:3d::cellid=2_1:6 parentid=2
+DEAL:2:3d::cellid=2_1:7 parentid=2
+DEAL:2:3d::OK
+
+
+DEAL:3:2d::writing
+DEAL:3:2d::reading
+DEAL:3:2d::cellid=1_1:2 parentid=1
+DEAL:3:2d::cellid=1_1:3 parentid=1
+DEAL:3:2d::OK
+DEAL:3:3d::writing
+DEAL:3:3d::cellid=3_1:0 parentid=3
+DEAL:3:3d::cellid=3_1:1 parentid=3
+DEAL:3:3d::cellid=3_1:2 parentid=3
+DEAL:3:3d::cellid=3_1:3 parentid=3
+DEAL:3:3d::cellid=3_1:4 parentid=3
+DEAL:3:3d::cellid=3_1:5 parentid=3
+DEAL:3:3d::cellid=3_1:6 parentid=3
+DEAL:3:3d::cellid=3_1:7 parentid=3
+DEAL:3:3d::reading
+DEAL:3:3d::cellid=3_1:0 parentid=3
+DEAL:3:3d::cellid=3_1:1 parentid=3
+DEAL:3:3d::cellid=3_1:2 parentid=3
+DEAL:3:3d::cellid=3_1:3 parentid=3
+DEAL:3:3d::cellid=3_1:4 parentid=3
+DEAL:3:3d::cellid=3_1:5 parentid=3
+DEAL:3:3d::cellid=3_1:6 parentid=3
+DEAL:3:3d::cellid=3_1:7 parentid=3
+DEAL:3:3d::OK
+
+
+DEAL:4:2d::writing
+DEAL:4:2d::cellid=2_1:0 parentid=2
+DEAL:4:2d::cellid=2_1:1 parentid=2
+DEAL:4:2d::cellid=2_1:2 parentid=2
+DEAL:4:2d::cellid=2_1:3 parentid=2
+DEAL:4:2d::reading
+DEAL:4:2d::cellid=2_1:0 parentid=2
+DEAL:4:2d::cellid=2_1:1 parentid=2
+DEAL:4:2d::OK
+DEAL:4:3d::writing
+DEAL:4:3d::cellid=4_1:0 parentid=4
+DEAL:4:3d::cellid=4_1:1 parentid=4
+DEAL:4:3d::cellid=4_1:2 parentid=4
+DEAL:4:3d::cellid=4_1:3 parentid=4
+DEAL:4:3d::cellid=4_1:4 parentid=4
+DEAL:4:3d::cellid=4_1:5 parentid=4
+DEAL:4:3d::cellid=4_1:6 parentid=4
+DEAL:4:3d::cellid=4_1:7 parentid=4
+DEAL:4:3d::reading
+DEAL:4:3d::cellid=4_1:0 parentid=4
+DEAL:4:3d::cellid=4_1:1 parentid=4
+DEAL:4:3d::cellid=4_1:2 parentid=4
+DEAL:4:3d::cellid=4_1:3 parentid=4
+DEAL:4:3d::cellid=4_1:4 parentid=4
+DEAL:4:3d::cellid=4_1:5 parentid=4
+DEAL:4:3d::cellid=4_1:6 parentid=4
+DEAL:4:3d::cellid=4_1:7 parentid=4
+DEAL:4:3d::OK
+
+
+DEAL:5:2d::writing
+DEAL:5:2d::reading
+DEAL:5:2d::cellid=2_1:2 parentid=2
+DEAL:5:2d::cellid=2_1:3 parentid=2
+DEAL:5:2d::OK
+DEAL:5:3d::writing
+DEAL:5:3d::cellid=5_1:0 parentid=5
+DEAL:5:3d::cellid=5_1:1 parentid=5
+DEAL:5:3d::cellid=5_1:2 parentid=5
+DEAL:5:3d::cellid=5_1:3 parentid=5
+DEAL:5:3d::cellid=5_1:4 parentid=5
+DEAL:5:3d::cellid=5_1:5 parentid=5
+DEAL:5:3d::cellid=5_1:6 parentid=5
+DEAL:5:3d::cellid=5_1:7 parentid=5
+DEAL:5:3d::reading
+DEAL:5:3d::cellid=5_1:0 parentid=5
+DEAL:5:3d::cellid=5_1:1 parentid=5
+DEAL:5:3d::cellid=5_1:2 parentid=5
+DEAL:5:3d::cellid=5_1:3 parentid=5
+DEAL:5:3d::cellid=5_1:4 parentid=5
+DEAL:5:3d::cellid=5_1:5 parentid=5
+DEAL:5:3d::cellid=5_1:6 parentid=5
+DEAL:5:3d::cellid=5_1:7 parentid=5
+DEAL:5:3d::OK
+
+
+DEAL:6:2d::writing
+DEAL:6:2d::cellid=3_1:0 parentid=3
+DEAL:6:2d::cellid=3_1:1 parentid=3
+DEAL:6:2d::cellid=3_1:2 parentid=3
+DEAL:6:2d::cellid=3_1:3 parentid=3
+DEAL:6:2d::reading
+DEAL:6:2d::cellid=3_1:0 parentid=3
+DEAL:6:2d::cellid=3_1:1 parentid=3
+DEAL:6:2d::OK
+DEAL:6:3d::writing
+DEAL:6:3d::cellid=6_1:0 parentid=6
+DEAL:6:3d::cellid=6_1:1 parentid=6
+DEAL:6:3d::cellid=6_1:2 parentid=6
+DEAL:6:3d::cellid=6_1:3 parentid=6
+DEAL:6:3d::cellid=6_1:4 parentid=6
+DEAL:6:3d::cellid=6_1:5 parentid=6
+DEAL:6:3d::cellid=6_1:6 parentid=6
+DEAL:6:3d::cellid=6_1:7 parentid=6
+DEAL:6:3d::reading
+DEAL:6:3d::cellid=6_1:0 parentid=6
+DEAL:6:3d::cellid=6_1:1 parentid=6
+DEAL:6:3d::cellid=6_1:2 parentid=6
+DEAL:6:3d::cellid=6_1:3 parentid=6
+DEAL:6:3d::cellid=6_1:4 parentid=6
+DEAL:6:3d::cellid=6_1:5 parentid=6
+DEAL:6:3d::cellid=6_1:6 parentid=6
+DEAL:6:3d::cellid=6_1:7 parentid=6
+DEAL:6:3d::OK
+
+
+DEAL:7:2d::writing
+DEAL:7:2d::reading
+DEAL:7:2d::cellid=3_1:2 parentid=3
+DEAL:7:2d::cellid=3_1:3 parentid=3
+DEAL:7:2d::OK
+DEAL:7:3d::writing
+DEAL:7:3d::cellid=7_1:0 parentid=7
+DEAL:7:3d::cellid=7_1:1 parentid=7
+DEAL:7:3d::cellid=7_1:2 parentid=7
+DEAL:7:3d::cellid=7_1:3 parentid=7
+DEAL:7:3d::cellid=7_1:4 parentid=7
+DEAL:7:3d::cellid=7_1:5 parentid=7
+DEAL:7:3d::cellid=7_1:6 parentid=7
+DEAL:7:3d::cellid=7_1:7 parentid=7
+DEAL:7:3d::reading
+DEAL:7:3d::cellid=7_1:0 parentid=7
+DEAL:7:3d::cellid=7_1:1 parentid=7
+DEAL:7:3d::cellid=7_1:2 parentid=7
+DEAL:7:3d::cellid=7_1:3 parentid=7
+DEAL:7:3d::cellid=7_1:4 parentid=7
+DEAL:7:3d::cellid=7_1:5 parentid=7
+DEAL:7:3d::cellid=7_1:6 parentid=7
+DEAL:7:3d::cellid=7_1:7 parentid=7
+DEAL:7:3d::OK
+
diff --git a/tests/mpi/cell_data_transfer_03.cc b/tests/mpi/cell_data_transfer_03.cc
new file mode 100644 (file)
index 0000000..efcd11c
--- /dev/null
@@ -0,0 +1,139 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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.
+//
+// ---------------------------------------------------------------------
+
+
+
+// p::d::CellDataTransfer test for an arbitrary value type
+// and variable data sizes
+
+
+#include <deal.II/distributed/cell_data_transfer.templates.h>
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <numeric>
+
+#include "../tests.h"
+
+
+template <int dim, int spacedim>
+std::vector<int>
+get_data_of_first_child(const typename parallel::distributed::
+                          Triangulation<dim, spacedim>::cell_iterator &parent,
+                        const std::vector<std::vector<int>> &input_vector)
+{
+  return input_vector[parent->child(0)->active_cell_index()];
+}
+
+
+
+template <int dim, int spacedim>
+void
+test()
+{
+  // ------ setup ------
+  parallel::distributed::Triangulation<dim, spacedim> tria(MPI_COMM_WORLD);
+  GridGenerator::subdivided_hyper_cube(tria, 2);
+  tria.refine_global(1);
+  deallog << "cells before: " << tria.n_global_active_cells() << std::endl;
+
+  // ----- prepare -----
+  // set refinement/coarsening flags
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        if (cell->id().to_string() == "0_1:0")
+          cell->set_refine_flag();
+        else if (cell->parent()->id().to_string() ==
+                 ((dim == 2) ? "3_0:" : "7_0:"))
+          cell->set_coarsen_flag();
+      }
+
+  // ----- gather -----
+  // store increasing amount of integers on all cells
+  std::vector<std::vector<int>> cell_data(tria.n_active_cells());
+  int                           i = 0;
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        std::vector<int> this_cell_data(i++);
+        std::iota(this_cell_data.begin(), this_cell_data.end(), 0);
+
+        deallog << "cellid=" << cell->id()
+                << " vector_size=" << this_cell_data.size() << " vector_sum="
+                << std::accumulate(this_cell_data.begin(),
+                                   this_cell_data.end(),
+                                   0);
+        if (cell->coarsen_flag_set())
+          deallog << " coarsening";
+        else if (cell->refine_flag_set())
+          deallog << " refining";
+        deallog << std::endl;
+
+        cell_data[cell->active_cell_index()] = std::move(this_cell_data);
+      }
+
+  // ----- transfer -----
+  parallel::distributed::
+    CellDataTransfer<dim, spacedim, std::vector<std::vector<int>>>
+      cell_data_transfer(
+        tria,
+        /*transfer_variable_size_data=*/true,
+        /*coarsening_strategy=*/&get_data_of_first_child<dim, spacedim>);
+
+  cell_data_transfer.prepare_for_coarsening_and_refinement(cell_data);
+  tria.execute_coarsening_and_refinement();
+  deallog << "cells after: " << tria.n_global_active_cells() << std::endl;
+
+  cell_data.resize(tria.n_active_cells());
+  cell_data_transfer.unpack(cell_data);
+
+  // ------ verify ------
+  // check if all children adopted the correct data
+  for (auto &cell : tria.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        const std::vector<int> &this_cell_data =
+          cell_data[(cell->active_cell_index())];
+
+        deallog << "cellid=" << cell->id()
+                << " vector_size=" << this_cell_data.size() << " vector_sum="
+                << std::accumulate(this_cell_data.begin(),
+                                   this_cell_data.end(),
+                                   0)
+                << std::endl;
+      }
+
+  // make sure no processor is hanging
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  deallog << "OK" << std::endl;
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  MPILogInitAll                    log;
+
+  deallog.push("2d");
+  test<2, 2>();
+  deallog.pop();
+  deallog.push("3d");
+  test<3, 3>();
+  deallog.pop();
+}
diff --git a/tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=2.output b/tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=2.output
new file mode 100644 (file)
index 0000000..03dbf57
--- /dev/null
@@ -0,0 +1,175 @@
+
+DEAL:0:2d::cells before: 16
+DEAL:0:2d::cellid=0_1:0 vector_size=0 vector_sum=0 refining
+DEAL:0:2d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:2d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:2d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:2d::cellid=1_1:0 vector_size=4 vector_sum=6
+DEAL:0:2d::cellid=1_1:1 vector_size=5 vector_sum=10
+DEAL:0:2d::cellid=1_1:2 vector_size=6 vector_sum=15
+DEAL:0:2d::cellid=1_1:3 vector_size=7 vector_sum=21
+DEAL:0:2d::cells after: 16
+DEAL:0:2d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:2d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:2d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:2d::cellid=0_2:00 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:01 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:02 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:03 vector_size=0 vector_sum=0
+DEAL:0:2d::OK
+DEAL:0:3d::cells before: 64
+DEAL:0:3d::cellid=0_1:0 vector_size=0 vector_sum=0 refining
+DEAL:0:3d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:3d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:3d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:3d::cellid=0_1:4 vector_size=4 vector_sum=6
+DEAL:0:3d::cellid=0_1:5 vector_size=5 vector_sum=10
+DEAL:0:3d::cellid=0_1:6 vector_size=6 vector_sum=15
+DEAL:0:3d::cellid=0_1:7 vector_size=7 vector_sum=21
+DEAL:0:3d::cellid=1_1:0 vector_size=8 vector_sum=28
+DEAL:0:3d::cellid=1_1:1 vector_size=9 vector_sum=36
+DEAL:0:3d::cellid=1_1:2 vector_size=10 vector_sum=45
+DEAL:0:3d::cellid=1_1:3 vector_size=11 vector_sum=55
+DEAL:0:3d::cellid=1_1:4 vector_size=12 vector_sum=66
+DEAL:0:3d::cellid=1_1:5 vector_size=13 vector_sum=78
+DEAL:0:3d::cellid=1_1:6 vector_size=14 vector_sum=91
+DEAL:0:3d::cellid=1_1:7 vector_size=15 vector_sum=105
+DEAL:0:3d::cellid=2_1:0 vector_size=16 vector_sum=120
+DEAL:0:3d::cellid=2_1:1 vector_size=17 vector_sum=136
+DEAL:0:3d::cellid=2_1:2 vector_size=18 vector_sum=153
+DEAL:0:3d::cellid=2_1:3 vector_size=19 vector_sum=171
+DEAL:0:3d::cellid=2_1:4 vector_size=20 vector_sum=190
+DEAL:0:3d::cellid=2_1:5 vector_size=21 vector_sum=210
+DEAL:0:3d::cellid=2_1:6 vector_size=22 vector_sum=231
+DEAL:0:3d::cellid=2_1:7 vector_size=23 vector_sum=253
+DEAL:0:3d::cellid=3_1:0 vector_size=24 vector_sum=276
+DEAL:0:3d::cellid=3_1:1 vector_size=25 vector_sum=300
+DEAL:0:3d::cellid=3_1:2 vector_size=26 vector_sum=325
+DEAL:0:3d::cellid=3_1:3 vector_size=27 vector_sum=351
+DEAL:0:3d::cellid=3_1:4 vector_size=28 vector_sum=378
+DEAL:0:3d::cellid=3_1:5 vector_size=29 vector_sum=406
+DEAL:0:3d::cellid=3_1:6 vector_size=30 vector_sum=435
+DEAL:0:3d::cellid=3_1:7 vector_size=31 vector_sum=465
+DEAL:0:3d::cells after: 64
+DEAL:0:3d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:3d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:3d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:3d::cellid=0_1:4 vector_size=4 vector_sum=6
+DEAL:0:3d::cellid=0_1:5 vector_size=5 vector_sum=10
+DEAL:0:3d::cellid=0_1:6 vector_size=6 vector_sum=15
+DEAL:0:3d::cellid=0_1:7 vector_size=7 vector_sum=21
+DEAL:0:3d::cellid=1_1:0 vector_size=8 vector_sum=28
+DEAL:0:3d::cellid=1_1:1 vector_size=9 vector_sum=36
+DEAL:0:3d::cellid=1_1:2 vector_size=10 vector_sum=45
+DEAL:0:3d::cellid=1_1:3 vector_size=11 vector_sum=55
+DEAL:0:3d::cellid=1_1:4 vector_size=12 vector_sum=66
+DEAL:0:3d::cellid=1_1:5 vector_size=13 vector_sum=78
+DEAL:0:3d::cellid=1_1:6 vector_size=14 vector_sum=91
+DEAL:0:3d::cellid=1_1:7 vector_size=15 vector_sum=105
+DEAL:0:3d::cellid=2_1:0 vector_size=16 vector_sum=120
+DEAL:0:3d::cellid=2_1:1 vector_size=17 vector_sum=136
+DEAL:0:3d::cellid=2_1:2 vector_size=18 vector_sum=153
+DEAL:0:3d::cellid=2_1:3 vector_size=19 vector_sum=171
+DEAL:0:3d::cellid=2_1:4 vector_size=20 vector_sum=190
+DEAL:0:3d::cellid=2_1:5 vector_size=21 vector_sum=210
+DEAL:0:3d::cellid=2_1:6 vector_size=22 vector_sum=231
+DEAL:0:3d::cellid=2_1:7 vector_size=23 vector_sum=253
+DEAL:0:3d::cellid=0_2:00 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:01 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:02 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:03 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:04 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:05 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:06 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:07 vector_size=0 vector_sum=0
+DEAL:0:3d::OK
+
+DEAL:1:2d::cells before: 16
+DEAL:1:2d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:1:2d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:1:2d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:1:2d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:1:2d::cellid=3_1:0 vector_size=4 vector_sum=6 coarsening
+DEAL:1:2d::cellid=3_1:1 vector_size=5 vector_sum=10 coarsening
+DEAL:1:2d::cellid=3_1:2 vector_size=6 vector_sum=15 coarsening
+DEAL:1:2d::cellid=3_1:3 vector_size=7 vector_sum=21 coarsening
+DEAL:1:2d::cells after: 16
+DEAL:1:2d::cellid=3_0: vector_size=4 vector_sum=6
+DEAL:1:2d::cellid=1_1:0 vector_size=4 vector_sum=6
+DEAL:1:2d::cellid=1_1:1 vector_size=5 vector_sum=10
+DEAL:1:2d::cellid=1_1:2 vector_size=6 vector_sum=15
+DEAL:1:2d::cellid=1_1:3 vector_size=7 vector_sum=21
+DEAL:1:2d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:1:2d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:1:2d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:1:2d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:1:2d::OK
+DEAL:1:3d::cells before: 64
+DEAL:1:3d::cellid=4_1:0 vector_size=0 vector_sum=0
+DEAL:1:3d::cellid=4_1:1 vector_size=1 vector_sum=0
+DEAL:1:3d::cellid=4_1:2 vector_size=2 vector_sum=1
+DEAL:1:3d::cellid=4_1:3 vector_size=3 vector_sum=3
+DEAL:1:3d::cellid=4_1:4 vector_size=4 vector_sum=6
+DEAL:1:3d::cellid=4_1:5 vector_size=5 vector_sum=10
+DEAL:1:3d::cellid=4_1:6 vector_size=6 vector_sum=15
+DEAL:1:3d::cellid=4_1:7 vector_size=7 vector_sum=21
+DEAL:1:3d::cellid=5_1:0 vector_size=8 vector_sum=28
+DEAL:1:3d::cellid=5_1:1 vector_size=9 vector_sum=36
+DEAL:1:3d::cellid=5_1:2 vector_size=10 vector_sum=45
+DEAL:1:3d::cellid=5_1:3 vector_size=11 vector_sum=55
+DEAL:1:3d::cellid=5_1:4 vector_size=12 vector_sum=66
+DEAL:1:3d::cellid=5_1:5 vector_size=13 vector_sum=78
+DEAL:1:3d::cellid=5_1:6 vector_size=14 vector_sum=91
+DEAL:1:3d::cellid=5_1:7 vector_size=15 vector_sum=105
+DEAL:1:3d::cellid=6_1:0 vector_size=16 vector_sum=120
+DEAL:1:3d::cellid=6_1:1 vector_size=17 vector_sum=136
+DEAL:1:3d::cellid=6_1:2 vector_size=18 vector_sum=153
+DEAL:1:3d::cellid=6_1:3 vector_size=19 vector_sum=171
+DEAL:1:3d::cellid=6_1:4 vector_size=20 vector_sum=190
+DEAL:1:3d::cellid=6_1:5 vector_size=21 vector_sum=210
+DEAL:1:3d::cellid=6_1:6 vector_size=22 vector_sum=231
+DEAL:1:3d::cellid=6_1:7 vector_size=23 vector_sum=253
+DEAL:1:3d::cellid=7_1:0 vector_size=24 vector_sum=276 coarsening
+DEAL:1:3d::cellid=7_1:1 vector_size=25 vector_sum=300 coarsening
+DEAL:1:3d::cellid=7_1:2 vector_size=26 vector_sum=325 coarsening
+DEAL:1:3d::cellid=7_1:3 vector_size=27 vector_sum=351 coarsening
+DEAL:1:3d::cellid=7_1:4 vector_size=28 vector_sum=378 coarsening
+DEAL:1:3d::cellid=7_1:5 vector_size=29 vector_sum=406 coarsening
+DEAL:1:3d::cellid=7_1:6 vector_size=30 vector_sum=435 coarsening
+DEAL:1:3d::cellid=7_1:7 vector_size=31 vector_sum=465 coarsening
+DEAL:1:3d::cells after: 64
+DEAL:1:3d::cellid=7_0: vector_size=24 vector_sum=276
+DEAL:1:3d::cellid=3_1:0 vector_size=24 vector_sum=276
+DEAL:1:3d::cellid=3_1:1 vector_size=25 vector_sum=300
+DEAL:1:3d::cellid=3_1:2 vector_size=26 vector_sum=325
+DEAL:1:3d::cellid=3_1:3 vector_size=27 vector_sum=351
+DEAL:1:3d::cellid=3_1:4 vector_size=28 vector_sum=378
+DEAL:1:3d::cellid=3_1:5 vector_size=29 vector_sum=406
+DEAL:1:3d::cellid=3_1:6 vector_size=30 vector_sum=435
+DEAL:1:3d::cellid=3_1:7 vector_size=31 vector_sum=465
+DEAL:1:3d::cellid=4_1:0 vector_size=0 vector_sum=0
+DEAL:1:3d::cellid=4_1:1 vector_size=1 vector_sum=0
+DEAL:1:3d::cellid=4_1:2 vector_size=2 vector_sum=1
+DEAL:1:3d::cellid=4_1:3 vector_size=3 vector_sum=3
+DEAL:1:3d::cellid=4_1:4 vector_size=4 vector_sum=6
+DEAL:1:3d::cellid=4_1:5 vector_size=5 vector_sum=10
+DEAL:1:3d::cellid=4_1:6 vector_size=6 vector_sum=15
+DEAL:1:3d::cellid=4_1:7 vector_size=7 vector_sum=21
+DEAL:1:3d::cellid=5_1:0 vector_size=8 vector_sum=28
+DEAL:1:3d::cellid=5_1:1 vector_size=9 vector_sum=36
+DEAL:1:3d::cellid=5_1:2 vector_size=10 vector_sum=45
+DEAL:1:3d::cellid=5_1:3 vector_size=11 vector_sum=55
+DEAL:1:3d::cellid=5_1:4 vector_size=12 vector_sum=66
+DEAL:1:3d::cellid=5_1:5 vector_size=13 vector_sum=78
+DEAL:1:3d::cellid=5_1:6 vector_size=14 vector_sum=91
+DEAL:1:3d::cellid=5_1:7 vector_size=15 vector_sum=105
+DEAL:1:3d::cellid=6_1:0 vector_size=16 vector_sum=120
+DEAL:1:3d::cellid=6_1:1 vector_size=17 vector_sum=136
+DEAL:1:3d::cellid=6_1:2 vector_size=18 vector_sum=153
+DEAL:1:3d::cellid=6_1:3 vector_size=19 vector_sum=171
+DEAL:1:3d::cellid=6_1:4 vector_size=20 vector_sum=190
+DEAL:1:3d::cellid=6_1:5 vector_size=21 vector_sum=210
+DEAL:1:3d::cellid=6_1:6 vector_size=22 vector_sum=231
+DEAL:1:3d::cellid=6_1:7 vector_size=23 vector_sum=253
+DEAL:1:3d::OK
+
diff --git a/tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=8.output b/tests/mpi/cell_data_transfer_03.with_p4est=true.mpirun=8.output
new file mode 100644 (file)
index 0000000..011fe72
--- /dev/null
@@ -0,0 +1,223 @@
+
+DEAL:0:2d::cells before: 16
+DEAL:0:2d::cellid=0_1:0 vector_size=0 vector_sum=0 refining
+DEAL:0:2d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:2d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:2d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:2d::cells after: 16
+DEAL:0:2d::cellid=0_2:00 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:01 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:02 vector_size=0 vector_sum=0
+DEAL:0:2d::cellid=0_2:03 vector_size=0 vector_sum=0
+DEAL:0:2d::OK
+DEAL:0:3d::cells before: 64
+DEAL:0:3d::cellid=0_1:0 vector_size=0 vector_sum=0 refining
+DEAL:0:3d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:0:3d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:0:3d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:0:3d::cellid=0_1:4 vector_size=4 vector_sum=6
+DEAL:0:3d::cellid=0_1:5 vector_size=5 vector_sum=10
+DEAL:0:3d::cellid=0_1:6 vector_size=6 vector_sum=15
+DEAL:0:3d::cellid=0_1:7 vector_size=7 vector_sum=21
+DEAL:0:3d::cells after: 64
+DEAL:0:3d::cellid=0_2:00 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:01 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:02 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:03 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:04 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:05 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:06 vector_size=0 vector_sum=0
+DEAL:0:3d::cellid=0_2:07 vector_size=0 vector_sum=0
+DEAL:0:3d::OK
+
+DEAL:1:2d::cells before: 16
+DEAL:1:2d::cells after: 16
+DEAL:1:2d::OK
+DEAL:1:3d::cells before: 64
+DEAL:1:3d::cellid=1_1:0 vector_size=0 vector_sum=0
+DEAL:1:3d::cellid=1_1:1 vector_size=1 vector_sum=0
+DEAL:1:3d::cellid=1_1:2 vector_size=2 vector_sum=1
+DEAL:1:3d::cellid=1_1:3 vector_size=3 vector_sum=3
+DEAL:1:3d::cellid=1_1:4 vector_size=4 vector_sum=6
+DEAL:1:3d::cellid=1_1:5 vector_size=5 vector_sum=10
+DEAL:1:3d::cellid=1_1:6 vector_size=6 vector_sum=15
+DEAL:1:3d::cellid=1_1:7 vector_size=7 vector_sum=21
+DEAL:1:3d::cells after: 64
+DEAL:1:3d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:1:3d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:1:3d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:1:3d::cellid=0_1:4 vector_size=4 vector_sum=6
+DEAL:1:3d::cellid=0_1:5 vector_size=5 vector_sum=10
+DEAL:1:3d::cellid=0_1:6 vector_size=6 vector_sum=15
+DEAL:1:3d::cellid=0_1:7 vector_size=7 vector_sum=21
+DEAL:1:3d::OK
+
+
+DEAL:2:2d::cells before: 16
+DEAL:2:2d::cellid=1_1:0 vector_size=0 vector_sum=0
+DEAL:2:2d::cellid=1_1:1 vector_size=1 vector_sum=0
+DEAL:2:2d::cellid=1_1:2 vector_size=2 vector_sum=1
+DEAL:2:2d::cellid=1_1:3 vector_size=3 vector_sum=3
+DEAL:2:2d::cells after: 16
+DEAL:2:2d::cellid=0_1:1 vector_size=1 vector_sum=0
+DEAL:2:2d::cellid=0_1:2 vector_size=2 vector_sum=1
+DEAL:2:2d::OK
+DEAL:2:3d::cells before: 64
+DEAL:2:3d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:2:3d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:2:3d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:2:3d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:2:3d::cellid=2_1:4 vector_size=4 vector_sum=6
+DEAL:2:3d::cellid=2_1:5 vector_size=5 vector_sum=10
+DEAL:2:3d::cellid=2_1:6 vector_size=6 vector_sum=15
+DEAL:2:3d::cellid=2_1:7 vector_size=7 vector_sum=21
+DEAL:2:3d::cells after: 64
+DEAL:2:3d::cellid=1_1:0 vector_size=0 vector_sum=0
+DEAL:2:3d::cellid=1_1:1 vector_size=1 vector_sum=0
+DEAL:2:3d::cellid=1_1:2 vector_size=2 vector_sum=1
+DEAL:2:3d::cellid=1_1:3 vector_size=3 vector_sum=3
+DEAL:2:3d::cellid=1_1:4 vector_size=4 vector_sum=6
+DEAL:2:3d::cellid=1_1:5 vector_size=5 vector_sum=10
+DEAL:2:3d::cellid=1_1:6 vector_size=6 vector_sum=15
+DEAL:2:3d::cellid=1_1:7 vector_size=7 vector_sum=21
+DEAL:2:3d::OK
+
+
+DEAL:3:2d::cells before: 16
+DEAL:3:2d::cells after: 16
+DEAL:3:2d::cellid=0_1:3 vector_size=3 vector_sum=3
+DEAL:3:2d::OK
+DEAL:3:3d::cells before: 64
+DEAL:3:3d::cellid=3_1:0 vector_size=0 vector_sum=0
+DEAL:3:3d::cellid=3_1:1 vector_size=1 vector_sum=0
+DEAL:3:3d::cellid=3_1:2 vector_size=2 vector_sum=1
+DEAL:3:3d::cellid=3_1:3 vector_size=3 vector_sum=3
+DEAL:3:3d::cellid=3_1:4 vector_size=4 vector_sum=6
+DEAL:3:3d::cellid=3_1:5 vector_size=5 vector_sum=10
+DEAL:3:3d::cellid=3_1:6 vector_size=6 vector_sum=15
+DEAL:3:3d::cellid=3_1:7 vector_size=7 vector_sum=21
+DEAL:3:3d::cells after: 64
+DEAL:3:3d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:3:3d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:3:3d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:3:3d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:3:3d::cellid=2_1:4 vector_size=4 vector_sum=6
+DEAL:3:3d::cellid=2_1:5 vector_size=5 vector_sum=10
+DEAL:3:3d::cellid=2_1:6 vector_size=6 vector_sum=15
+DEAL:3:3d::cellid=2_1:7 vector_size=7 vector_sum=21
+DEAL:3:3d::OK
+
+
+DEAL:4:2d::cells before: 16
+DEAL:4:2d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:4:2d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:4:2d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:4:2d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:4:2d::cells after: 16
+DEAL:4:2d::cellid=1_1:0 vector_size=0 vector_sum=0
+DEAL:4:2d::cellid=1_1:1 vector_size=1 vector_sum=0
+DEAL:4:2d::cellid=1_1:2 vector_size=2 vector_sum=1
+DEAL:4:2d::cellid=1_1:3 vector_size=3 vector_sum=3
+DEAL:4:2d::OK
+DEAL:4:3d::cells before: 64
+DEAL:4:3d::cellid=4_1:0 vector_size=0 vector_sum=0
+DEAL:4:3d::cellid=4_1:1 vector_size=1 vector_sum=0
+DEAL:4:3d::cellid=4_1:2 vector_size=2 vector_sum=1
+DEAL:4:3d::cellid=4_1:3 vector_size=3 vector_sum=3
+DEAL:4:3d::cellid=4_1:4 vector_size=4 vector_sum=6
+DEAL:4:3d::cellid=4_1:5 vector_size=5 vector_sum=10
+DEAL:4:3d::cellid=4_1:6 vector_size=6 vector_sum=15
+DEAL:4:3d::cellid=4_1:7 vector_size=7 vector_sum=21
+DEAL:4:3d::cells after: 64
+DEAL:4:3d::cellid=3_1:0 vector_size=0 vector_sum=0
+DEAL:4:3d::cellid=3_1:1 vector_size=1 vector_sum=0
+DEAL:4:3d::cellid=3_1:2 vector_size=2 vector_sum=1
+DEAL:4:3d::cellid=3_1:3 vector_size=3 vector_sum=3
+DEAL:4:3d::cellid=3_1:4 vector_size=4 vector_sum=6
+DEAL:4:3d::cellid=3_1:5 vector_size=5 vector_sum=10
+DEAL:4:3d::cellid=3_1:6 vector_size=6 vector_sum=15
+DEAL:4:3d::cellid=3_1:7 vector_size=7 vector_sum=21
+DEAL:4:3d::OK
+
+
+DEAL:5:2d::cells before: 16
+DEAL:5:2d::cells after: 16
+DEAL:5:2d::OK
+DEAL:5:3d::cells before: 64
+DEAL:5:3d::cellid=5_1:0 vector_size=0 vector_sum=0
+DEAL:5:3d::cellid=5_1:1 vector_size=1 vector_sum=0
+DEAL:5:3d::cellid=5_1:2 vector_size=2 vector_sum=1
+DEAL:5:3d::cellid=5_1:3 vector_size=3 vector_sum=3
+DEAL:5:3d::cellid=5_1:4 vector_size=4 vector_sum=6
+DEAL:5:3d::cellid=5_1:5 vector_size=5 vector_sum=10
+DEAL:5:3d::cellid=5_1:6 vector_size=6 vector_sum=15
+DEAL:5:3d::cellid=5_1:7 vector_size=7 vector_sum=21
+DEAL:5:3d::cells after: 64
+DEAL:5:3d::cellid=4_1:0 vector_size=0 vector_sum=0
+DEAL:5:3d::cellid=4_1:1 vector_size=1 vector_sum=0
+DEAL:5:3d::cellid=4_1:2 vector_size=2 vector_sum=1
+DEAL:5:3d::cellid=4_1:3 vector_size=3 vector_sum=3
+DEAL:5:3d::cellid=4_1:4 vector_size=4 vector_sum=6
+DEAL:5:3d::cellid=4_1:5 vector_size=5 vector_sum=10
+DEAL:5:3d::cellid=4_1:6 vector_size=6 vector_sum=15
+DEAL:5:3d::cellid=4_1:7 vector_size=7 vector_sum=21
+DEAL:5:3d::OK
+
+
+DEAL:6:2d::cells before: 16
+DEAL:6:2d::cellid=3_1:0 vector_size=0 vector_sum=0 coarsening
+DEAL:6:2d::cellid=3_1:1 vector_size=1 vector_sum=0 coarsening
+DEAL:6:2d::cellid=3_1:2 vector_size=2 vector_sum=1 coarsening
+DEAL:6:2d::cellid=3_1:3 vector_size=3 vector_sum=3 coarsening
+DEAL:6:2d::cells after: 16
+DEAL:6:2d::cellid=2_1:0 vector_size=0 vector_sum=0
+DEAL:6:2d::cellid=2_1:1 vector_size=1 vector_sum=0
+DEAL:6:2d::cellid=2_1:2 vector_size=2 vector_sum=1
+DEAL:6:2d::cellid=2_1:3 vector_size=3 vector_sum=3
+DEAL:6:2d::OK
+DEAL:6:3d::cells before: 64
+DEAL:6:3d::cellid=6_1:0 vector_size=0 vector_sum=0
+DEAL:6:3d::cellid=6_1:1 vector_size=1 vector_sum=0
+DEAL:6:3d::cellid=6_1:2 vector_size=2 vector_sum=1
+DEAL:6:3d::cellid=6_1:3 vector_size=3 vector_sum=3
+DEAL:6:3d::cellid=6_1:4 vector_size=4 vector_sum=6
+DEAL:6:3d::cellid=6_1:5 vector_size=5 vector_sum=10
+DEAL:6:3d::cellid=6_1:6 vector_size=6 vector_sum=15
+DEAL:6:3d::cellid=6_1:7 vector_size=7 vector_sum=21
+DEAL:6:3d::cells after: 64
+DEAL:6:3d::cellid=5_1:0 vector_size=0 vector_sum=0
+DEAL:6:3d::cellid=5_1:1 vector_size=1 vector_sum=0
+DEAL:6:3d::cellid=5_1:2 vector_size=2 vector_sum=1
+DEAL:6:3d::cellid=5_1:3 vector_size=3 vector_sum=3
+DEAL:6:3d::cellid=5_1:4 vector_size=4 vector_sum=6
+DEAL:6:3d::cellid=5_1:5 vector_size=5 vector_sum=10
+DEAL:6:3d::cellid=5_1:6 vector_size=6 vector_sum=15
+DEAL:6:3d::cellid=5_1:7 vector_size=7 vector_sum=21
+DEAL:6:3d::OK
+
+
+DEAL:7:2d::cells before: 16
+DEAL:7:2d::cells after: 16
+DEAL:7:2d::cellid=3_0: vector_size=0 vector_sum=0
+DEAL:7:2d::OK
+DEAL:7:3d::cells before: 64
+DEAL:7:3d::cellid=7_1:0 vector_size=0 vector_sum=0 coarsening
+DEAL:7:3d::cellid=7_1:1 vector_size=1 vector_sum=0 coarsening
+DEAL:7:3d::cellid=7_1:2 vector_size=2 vector_sum=1 coarsening
+DEAL:7:3d::cellid=7_1:3 vector_size=3 vector_sum=3 coarsening
+DEAL:7:3d::cellid=7_1:4 vector_size=4 vector_sum=6 coarsening
+DEAL:7:3d::cellid=7_1:5 vector_size=5 vector_sum=10 coarsening
+DEAL:7:3d::cellid=7_1:6 vector_size=6 vector_sum=15 coarsening
+DEAL:7:3d::cellid=7_1:7 vector_size=7 vector_sum=21 coarsening
+DEAL:7:3d::cells after: 64
+DEAL:7:3d::cellid=7_0: vector_size=0 vector_sum=0
+DEAL:7:3d::cellid=6_1:0 vector_size=0 vector_sum=0
+DEAL:7:3d::cellid=6_1:1 vector_size=1 vector_sum=0
+DEAL:7:3d::cellid=6_1:2 vector_size=2 vector_sum=1
+DEAL:7:3d::cellid=6_1:3 vector_size=3 vector_sum=3
+DEAL:7:3d::cellid=6_1:4 vector_size=4 vector_sum=6
+DEAL:7:3d::cellid=6_1:5 vector_size=5 vector_sum=10
+DEAL:7:3d::cellid=6_1:6 vector_size=6 vector_sum=15
+DEAL:7:3d::cellid=6_1:7 vector_size=7 vector_sum=21
+DEAL:7:3d::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.