]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Deprecate Triangulation<dim, spacedim>::CellStatus
authorPasquale Africa <pafrica@sissa.it>
Mon, 3 Jul 2023 19:51:46 +0000 (19:51 +0000)
committerPasquale Africa <pafrica@sissa.it>
Fri, 7 Jul 2023 23:17:06 +0000 (23:17 +0000)
30 files changed:
doc/news/changes/minor/20230703PasqualeClaudioAfrica [new file with mode: 0644]
examples/step-68/step-68.cc
include/deal.II/base/quadrature_point_data.h
include/deal.II/distributed/cell_data_transfer.templates.h
include/deal.II/distributed/fully_distributed_tria.h
include/deal.II/grid/cell_status.h
include/deal.II/grid/data_serializer.h [moved from include/deal.II/grid/data_transfer.h with 71% similarity]
include/deal.II/grid/tria.h
source/distributed/cell_weights.cc
source/distributed/fully_distributed_tria.cc
source/distributed/repartitioning_policy_tools.cc
source/distributed/solution_transfer.cc
source/distributed/tria.cc
source/grid/CMakeLists.txt
source/grid/data_serializer.cc [moved from source/grid/data_transfer.cc with 94% similarity]
source/grid/data_serializer.inst.in [moved from source/grid/data_transfer.inst.in with 85% similarity]
source/grid/grid_tools.cc
source/grid/tria.cc
source/particles/particle_handler.cc
tests/mpi/attach_data_01.cc
tests/mpi/attach_data_02.cc
tests/mpi/cell_weights_03.cc
tests/mpi/cell_weights_04.cc
tests/mpi/cell_weights_05.cc
tests/mpi/cell_weights_06.cc
tests/mpi/p4est_save_05.cc
tests/mpi/p4est_save_07.cc
tests/mpi/repartition_02.cc
tests/particles/particle_weights_01.cc
tests/particles/step-68.cc

diff --git a/doc/news/changes/minor/20230703PasqualeClaudioAfrica b/doc/news/changes/minor/20230703PasqualeClaudioAfrica
new file mode 100644 (file)
index 0000000..05f34b8
--- /dev/null
@@ -0,0 +1,3 @@
+Deprecated: The CellStatus enumeration has been deprecated in the Triangulation<dim, spacedim> class and moved to the global deal.II namespace. As a consequence, all references to Triangulation<dim, spacedim>, parallel::distributed::Triangulation<dim, spacedim>::CellStatus, and similar should be updated to use CellStatus directly. Also, the enumeration values have been renamed: CELL_PERSIST -> cell_will_persist, CELL_REFINE -> cell_will_be_refined, CELL_COARSEN -> children_will_be_coarsened, CELL_INVALID -> cell_invalid).
+<br>
+(Pasquale Claudio Africa, 2023/07/03)
index 5622a782ddd668e27c41a296a624559da5503c48..38bd36561bb040bc0a5d7a8e66cd08eb05c3c745 100644 (file)
@@ -345,21 +345,21 @@ namespace Step68
     const unsigned int particle_weight = 10;
 
     // This example does not use adaptive refinement, therefore every cell
-    // should have the status `CELL_PERSIST`. However this function can also
-    // be used to distribute load during refinement, therefore we consider
-    // refined or coarsened cells as well.
+    // should have the status `CellStatus::cell_will_persist`. However this
+    // function can also be used to distribute load during refinement, therefore
+    // we consider refined or coarsened cells as well.
     unsigned int n_particles_in_cell = 0;
     switch (status)
       {
-        case CELL_PERSIST:
-        case CELL_REFINE:
+        case CellStatus::cell_will_persist:
+        case CellStatus::cell_will_be_refined:
           n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
           break;
 
-        case CELL_INVALID:
+        case CellStatus::cell_invalid:
           break;
 
-        case CELL_COARSEN:
+        case CellStatus::children_will_be_coarsened:
           for (const auto &child : cell->child_iterators())
             n_particles_in_cell += particle_handler.n_particles_in_cell(child);
           break;
index 0aad2b2eb7ac83109bfd81f924f1f653dd002e41..5dabd69336401b7664f697667bbe019db1380812 100644 (file)
@@ -993,7 +993,8 @@ namespace parallel
       const boost::iterator_range<std::vector<char>::const_iterator>
         &data_range)
     {
-      Assert((status != CELL_COARSEN), ExcNotImplemented());
+      Assert((status != CellStatus::children_will_be_coarsened),
+             ExcNotImplemented());
       (void)status;
 
       matrix_dofs =
index 26fd05b13ab91864d0ca350c171f1eb62b9dbf4a..cd81b30ddbb82c3c371b94862e2ca90a3b3601d8 100644 (file)
@@ -256,14 +256,14 @@ namespace parallel
         {
           switch (status)
             {
-              case CELL_PERSIST:
-              case CELL_REFINE:
+              case CellStatus::cell_will_persist:
+              case CellStatus::cell_will_be_refined:
                 // 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 CELL_COARSEN:
+              case CellStatus::children_will_be_coarsened:
                 {
                   // Cell is parent whose children will get coarsened to.
                   // Decide data to store on parent by provided strategy.
@@ -335,14 +335,14 @@ namespace parallel
       for (; it_input != cell_data.cend(); ++it_input, ++it_output)
         switch (status)
           {
-            case CELL_PERSIST:
-            case CELL_COARSEN:
+            case CellStatus::cell_will_persist:
+            case CellStatus::children_will_be_coarsened:
               // Cell either persists, or has been coarsened.
               // Thus, cell has no (longer) children.
               (**it_output)[cell->active_cell_index()] = *it_input;
               break;
 
-            case CELL_REFINE:
+            case CellStatus::cell_will_be_refined:
               {
                 // Cell has been refined, and is now parent of its children.
                 // Thus, distribute parent's data on its children.
index 4e4319ae25efb2fd3fe63468c799727c91e97f90..084ff11056dbd2fd52f2c5fdbcd2de94e721070b 100644 (file)
@@ -282,7 +282,7 @@ namespace parallel
        * will change in the private member vector local_cell_relations.
        *
        * As no adaptive mesh refinement is supported at the moment for this
-       * class, all cells will be flagged with the CellStatus CELL_PERSIST.
+       * class, all cells will be flagged with CellStatus::cell_will_persist.
        * These relations will currently only be used for serialization.
        *
        * The stored vector will have a size equal to the number of locally owned
index b10b3fc9c24e963f260089d5a9f3751c618361c2..071dc69e1a1de609c4c9e3028afdcf81860f9ba7 100644 (file)
 DEAL_II_NAMESPACE_OPEN
 
 /**
- * Used to inform functions in derived classes how the cell with the given
- * cell_iterator is going to change. Note that this may me different than
- * the refine_flag() and coarsen_flag() in the cell_iterator in parallel
- * calculations because of refinement constraints that this machine does not
- * see.
+ * The elements of this `enum` are used to inform functions how a specific cell
+ * is going to change. This is used in the course of transferring data from one
+ * mesh to a refined or coarsened version of the mesh, for example. Note that
+ * this may me different than the refine_flag() and coarsen_flag() set on a
+ * cell, for example in parallel calculations, because of refinement constraints
+ * that an individual machine does not see.
  */
-enum CellStatus
+enum class CellStatus : unsigned int
 {
   /**
    * The cell will not be refined or coarsened and might or might not move
    * to a different processor.
    */
-  CELL_PERSIST,
+  cell_will_persist,
   /**
    * The cell will be or was refined.
    */
-  CELL_REFINE,
+  cell_will_be_refined,
   /**
    * The children of this cell will be or were coarsened into this cell.
    */
-  CELL_COARSEN,
+  children_will_be_coarsened,
   /**
    * Invalid status. Will not occur for the user.
    */
-  CELL_INVALID
+  cell_invalid
 };
 
 DEAL_II_NAMESPACE_CLOSE
similarity index 71%
rename from include/deal.II/grid/data_transfer.h
rename to include/deal.II/grid/data_serializer.h
index 5eac21a8d495acae3d98b4ab1ae3d2ac78dcd36f..9291d0b2415d15b4704bc1569ec8437efaeed98d 100644 (file)
@@ -13,8 +13,8 @@
 //
 // ---------------------------------------------------------------------
 
-#ifndef dealii_tria_data_transfer_h
-#define dealii_tria_data_transfer_h
+#ifndef dealii_tria_data_serializer_h
+#define dealii_tria_data_serializer_h
 
 #include <deal.II/base/config.h>
 
 
 DEAL_II_NAMESPACE_OPEN
 
-template <int dim, int spacedim = dim>
-DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-struct CellAttachedData
+namespace internal
 {
-  using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
-
-  /**
-   * Number of functions that get attached to the Triangulation through
-   * register_data_attach() for example SolutionTransfer.
-   */
-  unsigned int n_attached_data_sets;
-
   /**
-   * Number of functions that need to unpack their data after a call from
-   * load().
+   * A structure that binds information about data attached to cells.
    */
-  unsigned int n_attached_deserialize;
-
-  using pack_callback_t =
-    std::function<std::vector<char>(cell_iterator, CellStatus)>;
-
-  /**
-   * These callback functions will be stored in the order in which they
-   * have been registered with the register_data_attach() function.
-   */
-  std::vector<pack_callback_t> pack_callbacks_fixed;
-  std::vector<pack_callback_t> pack_callbacks_variable;
-};
+  template <int dim, int spacedim = dim>
+  DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
+  struct CellAttachedData
+  {
+    using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
+
+    /**
+     * Number of functions that get attached to the Triangulation through
+     * register_data_attach() for example SolutionTransfer.
+     */
+    unsigned int n_attached_data_sets;
+
+    /**
+     * Number of functions that need to unpack their data after a call from
+     * load().
+     */
+    unsigned int n_attached_deserialize;
+
+    using pack_callback_t =
+      std::function<std::vector<char>(cell_iterator, CellStatus)>;
+
+    /**
+     * These callback functions will be stored in the order in which they
+     * have been registered with the register_data_attach() function.
+     */
+    std::vector<pack_callback_t> pack_callbacks_fixed;
+    std::vector<pack_callback_t> pack_callbacks_variable;
+  };
+} // namespace internal
 
 /**
  * A structure that stores information about the data that has been, or
  * will be, attached to cells via the register_data_attach() function
  * and later retrieved via notify_ready_to_unpack().
  *
- * This class in the private scope of parallel::DistributedTriangulationBase
- * is dedicated to the data transfer across repartitioned meshes
- * and to/from the file system.
+ * This internalclass is dedicated to the data serialization and transfer across
+ * repartitioned meshes and to/from the file system.
  *
- * It is designed to store all data buffers intended for transfer.
+ * It is designed to store all data buffers intended for serialization.
  */
 template <int dim, int spacedim = dim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-class DataTransfer
+class CellAttachedDataSerializer
 {
 public:
   using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
@@ -89,10 +94,10 @@ public:
    */
   using cell_relation_t = typename std::pair<cell_iterator, CellStatus>;
 
-  DataTransfer(const MPI_Comm &mpi_communicator);
+  CellAttachedDataSerializer();
 
   /**
-   * Prepare data transfer by calling the pack callback functions on each
+   * Prepare data serialization by calling the pack callback functions on each
    * cell in @p cell_relations.
    *
    * All registered callback functions in @p pack_callbacks_fixed will write
@@ -102,23 +107,26 @@ public:
   void
   pack_data(
     const std::vector<cell_relation_t> &cell_relations,
-    const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
+    const std::vector<
+      typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
       &pack_callbacks_fixed,
-    const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
-      &pack_callbacks_variable);
+    const std::vector<
+      typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
+      &             pack_callbacks_variable,
+    const MPI_Comm &mpi_communicator);
 
   /**
    * Unpack the CellStatus information on each entry of
    * @p cell_relations.
    *
    * Data has to be previously transferred with execute_transfer()
-   * or read from the file system via load().
+   * or deserialized from the file system via load().
    */
   void
   unpack_cell_status(std::vector<cell_relation_t> &cell_relations) const;
 
   /**
-   * Unpack previously transferred data on each cell registered in
+   * Unpack previously serialized data on each cell registered in
    * @p cell_relations with the provided @p unpack_callback function.
    *
    * The parameter @p handle corresponds to the position where the
@@ -127,7 +135,7 @@ public:
    * function that has been registered previously.
    *
    * Data has to be previously transferred with execute_transfer()
-   * or read from the file system via load().
+   * or deserialized from the file system via load().
    */
   void
   unpack_data(
@@ -140,7 +148,7 @@ public:
       &unpack_callback) const;
 
   /**
-   * Transfer data to file system.
+   * Serialize data to file system.
    *
    * The data will be written in a separate file, whose name
    * consists of the stem @p filename and an attached identifier
@@ -156,10 +164,11 @@ public:
   void
   save(const unsigned int global_first_cell,
        const unsigned int global_num_cells,
-       const std::string &filename) const;
+       const std::string &filename,
+       const MPI_Comm &   mpi_communicator) const;
 
   /**
-   * Transfer data from file system.
+   * Deserialize data from file system.
    *
    * The data will be read from separate file, whose name
    * consists of the stem @p filename and an attached identifier
@@ -182,7 +191,8 @@ public:
        const unsigned int local_num_cells,
        const std::string &filename,
        const unsigned int n_attached_deserialize_fixed,
-       const unsigned int n_attached_deserialize_variable);
+       const unsigned int n_attached_deserialize_variable,
+       const MPI_Comm &   mpi_communicator);
 
   /**
    * Clears all containers and associated data, and resets member
@@ -211,23 +221,20 @@ public:
   std::vector<unsigned int> sizes_fixed_cumulative;
 
   /**
-   * Consecutive buffers designed for the fixed size transfer
+   * Consecutive buffers designed for the fixed size serialization
    * functions.
    */
   std::vector<char> src_data_fixed;
   std::vector<char> dest_data_fixed;
 
   /**
-   * Consecutive buffers designed for the variable size transfer
+   * Consecutive buffers designed for the variable size serialization
    * functions.
    */
   std::vector<int>  src_sizes_variable;
   std::vector<int>  dest_sizes_variable;
   std::vector<char> src_data_variable;
   std::vector<char> dest_data_variable;
-
-private:
-  const MPI_Comm &mpi_communicator;
 };
 
 DEAL_II_NAMESPACE_CLOSE
index a828d99bb01ef223fa7a712031b1f2c9e05c6d4d..79be01f4d734658dff5ef76f6ba366f67b40f414 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <deal.II/grid/cell_id.h>
 #include <deal.II/grid/cell_status.h>
-#include <deal.II/grid/data_transfer.h>
+#include <deal.II/grid/data_serializer.h>
 #include <deal.II/grid/tria_description.h>
 #include <deal.II/grid/tria_iterator_selector.h>
 #include <deal.II/grid/tria_levels.h>
@@ -2033,7 +2033,27 @@ public:
    * @{
    */
 
-  using CellStatus = ::dealii::CellStatus;
+  /**
+   * Alias for backward compatibility.
+   *
+   * @deprecated This enumeration has been moved to the global namespace.
+   * Use ::dealii::CellStatus instead. Also, its values have been renamed
+   * (CELL_PERSIST -> cell_will_persist,
+   * CELL_REFINE -> cell_will_be_refined,
+   * CELL_COARSEN -> children_will_be_coarsened,
+   * CELL_INVALID -> cell_invalid).
+   */
+  enum CellStatus
+  {
+    CELL_PERSIST DEAL_II_DEPRECATED =
+      static_cast<unsigned int>(::dealii::CellStatus::cell_will_persist),
+    CELL_REFINE DEAL_II_DEPRECATED =
+      static_cast<unsigned int>(::dealii::CellStatus::cell_will_be_refined),
+    CELL_COARSEN DEAL_II_DEPRECATED = static_cast<unsigned int>(
+      ::dealii::CellStatus::children_will_be_coarsened),
+    CELL_INVALID DEAL_II_DEPRECATED =
+      static_cast<unsigned int>(::dealii::CellStatus::cell_invalid)
+  };
 
   /**
    * A structure used to accumulate the results of the `weight` signal slot
@@ -2176,7 +2196,8 @@ public:
      * load of this cell.
      *
      * In serial and parallel shared applications, partitioning happens after
-     * refinement. So all cells will have the `CELL_PERSIST` status.
+     * refinement. So all cells will have the `CellStatus::cell_will_persist`
+     * status.
      *
      * In parallel distributed applications, partitioning happens during
      * refinement. If this cell is going to be coarsened, the signal is called
@@ -2199,7 +2220,7 @@ public:
      * parallel::CellWeights class.
      */
     boost::signals2::signal<unsigned int(const cell_iterator &,
-                                         const CellStatus),
+                                         const ::dealii::CellStatus),
                             CellWeightSum<unsigned int>>
       weight;
 
@@ -3515,32 +3536,31 @@ public:
    *
    * Specifically, the values for this argument mean the following:
    *
-   * - `CELL_PERSIST`: The cell won't be refined/coarsened, but might be
-   * moved to a different processor. If this is the case, the callback
+   * - `CellStatus::cell_will_persist`: The cell won't be refined/coarsened, but
+   * might be moved to a different processor. If this is the case, the callback
    * will want to pack up the data on this cell into an array and store
    * it at the provided address for later unpacking wherever this cell
    * may land.
-   * - `CELL_REFINE`: This cell will be refined into 4 or 8 cells (in 2d
-   * and 3d, respectively). However, because these children don't exist
-   * yet, you cannot access them at the time when the callback is
-   * called. Thus, in local_cell_relations, the corresponding
-   * p4est quadrants of the children cells are linked to the deal.II
-   * cell which is going to be refined. To be specific, only the very
-   * first child is marked with `CELL_REFINE`, whereas the others will be
-   * marked with `CELL_INVALID`, which indicates that these cells will be
+   * - `CellStatus::cell_will_be_refined`: This cell will be refined into 4 or 8
+   * cells (in 2d and 3d, respectively). However, because these children don't
+   * exist yet, you cannot access them at the time when the callback is called.
+   * Thus, in local_cell_relations, the corresponding p4est quadrants of the
+   * children cells are linked to the deal.II cell which is going to be refined.
+   * To be specific, only the very first child is marked with
+   * `CellStatus::cell_will_be_refined`, whereas the others will be marked with
+   * `CellStatus::cell_invalid`, which indicates that these cells will be
    * ignored by default during the packing or unpacking process. This
    * ensures that data is only transferred once onto or from the parent
-   * cell. If the callback is called with `CELL_REFINE`, the callback
-   * will want to pack up the data on this cell into an array and store
-   * it at the provided address for later unpacking in a way so that
-   * it can then be transferred to the children of the cell that will
-   * then be available. In other words, if the data the callback
-   * will want to pack up corresponds to a finite element field, then
-   * the prolongation from parent to (new) children will have to happen
-   * during unpacking.
-   * - `CELL_COARSEN`: The children of this cell will be coarsened into the
-   * given cell. These children still exist, so if this is the value
-   * given to the callback as second argument, the callback will want
+   * cell. If the callback is called with `CellStatus::cell_will_be_refined`,
+   * the callback will want to pack up the data on this cell into an array and
+   * store it at the provided address for later unpacking in a way so that it
+   * can then be transferred to the children of the cell that will then be
+   * available. In other words, if the data the callback will want to pack up
+   * corresponds to a finite element field, then the prolongation from parent to
+   * (new) children will have to happen during unpacking.
+   * - `CellStatus::children_will_be_coarsened`: The children of this cell will
+   * be coarsened into the given cell. These children still exist, so if this is
+   * the value given to the callback as second argument, the callback will want
    * to transfer data from the children to the current parent cell and
    * pack it up so that it can later be unpacked again on a cell that
    * then no longer has any children (and may also be located on a
@@ -3548,11 +3568,11 @@ public:
    * will want to pack up corresponds to a finite element field, then
    * it will need to do the restriction from children to parent at
    * this point.
-   * - `CELL_INVALID`: See `CELL_REFINE`.
+   * - `CellStatus::cell_invalid`: See `CellStatus::cell_will_be_refined`.
    *
    * @note If this function is used for serialization of data
    *   using save() and load(), then the cell status argument with which
-   *   the callback is called will always be `CELL_PERSIST`.
+   *   the callback is called will always be `CellStatus::cell_will_persist`.
    *
    * The callback function is expected to return a memory chunk of the
    * format `std::vector<char>`, representing the packed data on a
@@ -3575,7 +3595,8 @@ public:
   unsigned int
   register_data_attach(
     const std::function<std::vector<char>(const cell_iterator &,
-                                          const CellStatus)> &pack_callback,
+                                          const ::dealii::CellStatus)>
+      &        pack_callback,
     const bool returns_variable_size_data);
 
   /**
@@ -3615,8 +3636,9 @@ public:
    * locally owned cell (if the cell was not refined), or the immediate
    * parent if it was refined during execute_coarsening_and_refinement().
    * Therefore, contrary to during register_data_attach(), you can now
-   * access the children if the status is `CELL_REFINE` but no longer for
-   * callbacks with status `CELL_COARSEN`.
+   * access the children if the status is `CellStatus::cell_will_be_refined` but
+   * no longer for callbacks with status
+   * `CellStatus::children_will_be_coarsened`.
    *
    * The first argument to this function, `handle`, corresponds to
    * the return value of register_data_attach(). (The precise
@@ -3631,11 +3653,11 @@ public:
     const unsigned int handle,
     const std::function<
       void(const cell_iterator &,
-           const CellStatus,
+           const ::dealii::CellStatus,
            const boost::iterator_range<std::vector<char>::const_iterator> &)>
       &unpack_callback);
 
-  CellAttachedData<dim, spacedim> cell_attached_data;
+  internal::CellAttachedData<dim, spacedim> cell_attached_data;
 
 protected:
   /**
@@ -3683,10 +3705,11 @@ protected:
    * respective CellStatus. To update its contents, use the
    * update_cell_relations() member function.
    */
-  std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+  std::vector<
+    typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
     local_cell_relations;
 
-  DataTransfer<dim, spacedim> data_transfer;
+  CellAttachedDataSerializer<dim, spacedim> data_serializer;
   /**
    * @}
    */
index e54a17c4f57fe267cd9f7b9e6613c1e2d0159523..1fa00597a6eae57f08777b9ea8e676f0679e7e60 100644 (file)
@@ -189,13 +189,13 @@ namespace parallel
     unsigned int fe_index = numbers::invalid_unsigned_int;
     switch (status)
       {
-        case CELL_PERSIST:
-        case CELL_REFINE:
-        case CELL_INVALID:
+        case CellStatus::cell_will_persist:
+        case CellStatus::cell_will_be_refined:
+        case CellStatus::cell_invalid:
           fe_index = cell->future_fe_index();
           break;
 
-        case CELL_COARSEN:
+        case CellStatus::children_will_be_coarsened:
 #ifdef DEBUG
           for (const auto &child : cell->child_iterators())
             Assert(child->is_active() && child->coarsen_flag_set(),
index ee1ad3f81602e3fc6a03cbe0079e6deeed5ec11a..175f2214e1775c46b8841e3370e1a47d7e321a74 100644 (file)
@@ -445,7 +445,8 @@ namespace parallel
 
       for (const auto &cell : this->active_cell_iterators())
         if (cell->is_locally_owned())
-          this->local_cell_relations.emplace_back(cell, CELL_PERSIST);
+          this->local_cell_relations.emplace_back(
+            cell, ::dealii::CellStatus::cell_will_persist);
     }
 
 
index 73fdb4f0b2cc153309573b9bdf13d97379af63c5..c5e5f074ff915d49635f38965e1b9aeeb240327f 100644 (file)
@@ -296,7 +296,7 @@ namespace RepartitioningPolicyTools
     for (const auto &cell :
          tria->active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
       weights[partitioner->global_to_local(cell->global_active_cell_index())] =
-        weighting_function(cell, CELL_PERSIST);
+        weighting_function(cell, CellStatus::cell_will_persist);
 
     // determine weight of all the cells locally owned by this process
     std::uint64_t process_local_weight = 0;
index 107ce34ff7a0ab209bfbd770b27296cbbf98f755..6018dcd97da3537a791a4153e82e7f2e8c2501e0 100644 (file)
@@ -324,14 +324,14 @@ namespace parallel
         {
           switch (status)
             {
-              case CELL_PERSIST:
-              case CELL_REFINE:
+              case CellStatus::cell_will_persist:
+              case CellStatus::cell_will_be_refined:
                 {
                   fe_index = cell->future_fe_index();
                   break;
                 }
 
-              case CELL_COARSEN:
+              case CellStatus::children_will_be_coarsened:
                 {
                   // In case of coarsening, we need to find a suitable FE index
                   // for the parent cell. We choose the 'least dominant fe'
@@ -392,14 +392,14 @@ namespace parallel
         {
           switch (status)
             {
-              case CELL_PERSIST:
-              case CELL_COARSEN:
+              case CellStatus::cell_will_persist:
+              case CellStatus::children_will_be_coarsened:
                 {
                   fe_index = cell->active_fe_index();
                   break;
                 }
 
-              case CELL_REFINE:
+              case CellStatus::cell_will_be_refined:
                 {
                   // After refinement, this particular cell is no longer active,
                   // and its children have inherited its FE index. However, to
index 0d36591536f2a62c0b7b0bf439a3376c7625942a..b0fb1e1ec905fbdcefc7c98de7d3888c01ea5ff3 100644 (file)
@@ -1620,7 +1620,7 @@ namespace
         // this active cell didn't change
         // save pair into corresponding position
         add_single_cell_relation<dim, spacedim>(
-          cell_rel, tree, idx, dealii_cell, CELL_PERSIST);
+          cell_rel, tree, idx, dealii_cell, CellStatus::cell_will_persist);
       }
     else if (p4est_has_children) // based on the conditions above, we know that
                                  // dealii_cell has no children
@@ -1649,9 +1649,10 @@ namespace
         dealii::internal::p4est::functions<dim>::quadrant_childrenv(
           &p4est_cell, p4est_child);
 
-        // mark first child with CELL_REFINE and the remaining children with
-        // CELL_INVALID, but associate them all with the parent cell unpack
-        // algorithm will be called only on CELL_REFINE flagged quadrant
+        // mark first child with CellStatus::cell_will_be_refined and the
+        // remaining children with CellStatus::cell_invalid, but associate them
+        // all with the parent cell unpack algorithm will be called only on
+        // CellStatus::cell_will_be_refined flagged quadrant
         int        child_idx;
         CellStatus cell_status;
         for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_cell;
@@ -1662,7 +1663,8 @@ namespace
               &p4est_child[i],
               dealii::internal::p4est::functions<dim>::quadrant_compare);
 
-            cell_status = (i == 0) ? CELL_REFINE : CELL_INVALID;
+            cell_status = (i == 0) ? CellStatus::cell_will_be_refined :
+                                     CellStatus::cell_invalid;
 
             add_single_cell_relation<dim, spacedim>(
               cell_rel, tree, child_idx, dealii_cell, cell_status);
@@ -1674,7 +1676,11 @@ namespace
         // its children got coarsened into this cell in p4est,
         // but the dealii_cell still has its children
         add_single_cell_relation<dim, spacedim>(
-          cell_rel, tree, idx, dealii_cell, CELL_COARSEN);
+          cell_rel,
+          tree,
+          idx,
+          dealii_cell,
+          CellStatus::children_will_be_coarsened);
       }
   }
 } // namespace
@@ -1868,13 +1874,13 @@ namespace parallel
       const typename dealii::internal::p4est::types<dim>::gloidx
         *previous_global_first_quadrant)
     {
-      Assert(this->data_transfer.sizes_fixed_cumulative.size() > 0,
+      Assert(this->data_serializer.sizes_fixed_cumulative.size() > 0,
              ExcMessage("No data has been packed!"));
 
       // Resize memory according to the data that we will receive.
-      this->data_transfer.dest_data_fixed.resize(
+      this->data_serializer.dest_data_fixed.resize(
         parallel_forest->local_num_quadrants *
-        this->data_transfer.sizes_fixed_cumulative.back());
+        this->data_serializer.sizes_fixed_cumulative.back());
 
       // Execute non-blocking fixed size transfer.
       typename dealii::internal::p4est::types<dim>::transfer_context
@@ -1885,14 +1891,14 @@ namespace parallel
           previous_global_first_quadrant,
           parallel_forest->mpicomm,
           0,
-          this->data_transfer.dest_data_fixed.data(),
-          this->data_transfer.src_data_fixed.data(),
-          this->data_transfer.sizes_fixed_cumulative.back());
+          this->data_serializer.dest_data_fixed.data(),
+          this->data_serializer.src_data_fixed.data(),
+          this->data_serializer.sizes_fixed_cumulative.back());
 
-      if (this->data_transfer.variable_size_data_stored)
+      if (this->data_serializer.variable_size_data_stored)
         {
           // Resize memory according to the data that we will receive.
-          this->data_transfer.dest_sizes_variable.resize(
+          this->data_serializer.dest_sizes_variable.resize(
             parallel_forest->local_num_quadrants);
 
           // Execute fixed size transfer of data sizes for variable size
@@ -1902,23 +1908,23 @@ namespace parallel
             previous_global_first_quadrant,
             parallel_forest->mpicomm,
             1,
-            this->data_transfer.dest_sizes_variable.data(),
-            this->data_transfer.src_sizes_variable.data(),
+            this->data_serializer.dest_sizes_variable.data(),
+            this->data_serializer.src_sizes_variable.data(),
             sizeof(unsigned int));
         }
 
       dealii::internal::p4est::functions<dim>::transfer_fixed_end(tf_context);
 
       // Release memory of previously packed data.
-      this->data_transfer.src_data_fixed.clear();
-      this->data_transfer.src_data_fixed.shrink_to_fit();
+      this->data_serializer.src_data_fixed.clear();
+      this->data_serializer.src_data_fixed.shrink_to_fit();
 
-      if (this->data_transfer.variable_size_data_stored)
+      if (this->data_serializer.variable_size_data_stored)
         {
           // Resize memory according to the data that we will receive.
-          this->data_transfer.dest_data_variable.resize(
-            std::accumulate(this->data_transfer.dest_sizes_variable.begin(),
-                            this->data_transfer.dest_sizes_variable.end(),
+          this->data_serializer.dest_data_variable.resize(
+            std::accumulate(this->data_serializer.dest_sizes_variable.begin(),
+                            this->data_serializer.dest_sizes_variable.end(),
                             std::vector<int>::size_type(0)));
 
 #  if DEAL_II_P4EST_VERSION_GTE(2, 0, 65, 0)
@@ -1928,10 +1934,10 @@ namespace parallel
           // at all, which is mandatory if one of our processes does not own
           // any quadrant. This bypasses the assertion from being triggered.
           //   - see: https://github.com/cburstedde/p4est/issues/48
-          if (this->data_transfer.src_sizes_variable.size() == 0)
-            this->data_transfer.src_sizes_variable.resize(1);
-          if (this->data_transfer.dest_sizes_variable.size() == 0)
-            this->data_transfer.dest_sizes_variable.resize(1);
+          if (this->data_serializer.src_sizes_variable.size() == 0)
+            this->data_serializer.src_sizes_variable.resize(1);
+          if (this->data_serializer.dest_sizes_variable.size() == 0)
+            this->data_serializer.dest_sizes_variable.resize(1);
 #  endif
 
           // Execute variable size transfer.
@@ -1940,16 +1946,16 @@ namespace parallel
             previous_global_first_quadrant,
             parallel_forest->mpicomm,
             1,
-            this->data_transfer.dest_data_variable.data(),
-            this->data_transfer.dest_sizes_variable.data(),
-            this->data_transfer.src_data_variable.data(),
-            this->data_transfer.src_sizes_variable.data());
+            this->data_serializer.dest_data_variable.data(),
+            this->data_serializer.dest_sizes_variable.data(),
+            this->data_serializer.src_data_variable.data(),
+            this->data_serializer.src_sizes_variable.data());
 
           // Release memory of previously packed data.
-          this->data_transfer.src_sizes_variable.clear();
-          this->data_transfer.src_sizes_variable.shrink_to_fit();
-          this->data_transfer.src_data_variable.clear();
-          this->data_transfer.src_data_variable.shrink_to_fit();
+          this->data_serializer.src_sizes_variable.clear();
+          this->data_serializer.src_sizes_variable.shrink_to_fit();
+          this->data_serializer.src_data_variable.clear();
+          this->data_serializer.src_data_variable.shrink_to_fit();
         }
     }
 
@@ -2022,12 +2028,12 @@ namespace parallel
             << this->n_cells(0) << std::endl;
         }
 
-      // each cell should have been flagged `CELL_PERSIST`
+      // each cell should have been flagged `CellStatus::cell_will_persist`
       for (const auto &cell_rel : this->local_cell_relations)
         {
           (void)cell_rel;
           Assert((cell_rel.second == // cell_status
-                  CELL_PERSIST),
+                  CellStatus::cell_will_persist),
                  ExcInternalError());
         }
 
@@ -3385,10 +3391,11 @@ namespace parallel
       // pack data before triangulation gets updated
       if (this->cell_attached_data.n_attached_data_sets > 0)
         {
-          this->data_transfer.pack_data(
+          this->data_serializer.pack_data(
             this->local_cell_relations,
             this->cell_attached_data.pack_callbacks_fixed,
-            this->cell_attached_data.pack_callbacks_variable);
+            this->cell_attached_data.pack_callbacks_variable,
+            this->get_communicator());
         }
 
       // finally copy back from local part of tree to deal.II
@@ -3418,7 +3425,7 @@ namespace parallel
                                  previous_global_first_quadrant.data());
 
           // also update the CellStatus information on the new mesh
-          this->data_transfer.unpack_cell_status(this->local_cell_relations);
+          this->data_serializer.unpack_cell_status(this->local_cell_relations);
         }
 
 #  ifdef DEBUG
@@ -3558,10 +3565,11 @@ namespace parallel
       // pack data before triangulation gets updated
       if (this->cell_attached_data.n_attached_data_sets > 0)
         {
-          this->data_transfer.pack_data(
+          this->data_serializer.pack_data(
             this->local_cell_relations,
             this->cell_attached_data.pack_callbacks_fixed,
-            this->cell_attached_data.pack_callbacks_variable);
+            this->cell_attached_data.pack_callbacks_variable,
+            this->get_communicator());
         }
 
       try
@@ -4234,19 +4242,19 @@ namespace parallel
 
               switch (status)
                 {
-                  case CELL_PERSIST:
+                  case CellStatus::cell_will_persist:
                     // cell remains unchanged
                     cell->clear_refine_flag();
                     cell->clear_coarsen_flag();
                     break;
 
-                  case CELL_REFINE:
+                  case CellStatus::cell_will_be_refined:
                     // cell will be refined
                     cell->clear_coarsen_flag();
                     cell->set_refine_flag();
                     break;
 
-                  case CELL_COARSEN:
+                  case CellStatus::children_will_be_coarsened:
                     // children of this cell will be coarsened
                     for (const auto &child : cell->child_iterators())
                       {
@@ -4255,7 +4263,7 @@ namespace parallel
                       }
                     break;
 
-                  case CELL_INVALID:
+                  case CellStatus::cell_invalid:
                     // do nothing as cell does not exist yet
                     break;
 
index fb2c6554b6fb3f2f19f29c6747ead0374f2c0bf6..ef3e81893f3ead86b0fdee81dd0607f5314347f5 100644 (file)
@@ -32,7 +32,7 @@ endif()
 
 set(_unity_include_src
   cell_id.cc
-  data_transfer.cc
+  data_serializer.cc
   grid_refinement.cc
   intergrid_map.cc
   manifold.cc
@@ -71,7 +71,7 @@ setup_source_list("${_unity_include_src}"
 
 set(_inst
   cell_id.inst.in
-  data_transfer.inst.in
+  data_serializer.inst.in
   grid_generator_cgal.inst.in
   grid_generator_from_name.inst.in
   grid_generator.inst.in
similarity index 94%
rename from source/grid/data_transfer.cc
rename to source/grid/data_serializer.cc
index 0f9c6c8a18308a1fe81bcfe1768c62aa826e8836..ad6f61c3f82d1d4236845ee24a1eec3d985adabe 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <deal.II/base/geometry_info.h>
 
-#include <deal.II/grid/data_transfer.h>
+#include <deal.II/grid/data_serializer.h>
 #include <deal.II/grid/tria_accessor.h>
 
 #include <utility>
@@ -27,20 +27,22 @@ DEAL_II_NAMESPACE_OPEN
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-DataTransfer<dim, spacedim>::DataTransfer(const MPI_Comm &mpi_communicator)
+CellAttachedDataSerializer<dim, spacedim>::CellAttachedDataSerializer()
   : variable_size_data_stored(false)
-  , mpi_communicator(mpi_communicator)
 {}
 
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::pack_data(
+void CellAttachedDataSerializer<dim, spacedim>::pack_data(
   const std::vector<cell_relation_t> &cell_relations,
-  const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
+  const std::vector<
+    typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
     &pack_callbacks_fixed,
-  const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
-    &pack_callbacks_variable)
+  const std::vector<
+    typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
+    &             pack_callbacks_variable,
+  const MPI_Comm &mpi_communicator)
 {
   Assert(src_data_fixed.size() == 0,
          ExcMessage("Previously packed data has not been released yet!"));
@@ -94,14 +96,14 @@ void DataTransfer<dim, spacedim>::pack_data(
         // Assertions about the tree structure.
         switch (cell_status)
           {
-            case CELL_PERSIST:
-            case CELL_REFINE:
+            case CellStatus::cell_will_persist:
+            case CellStatus::cell_will_be_refined:
               // double check the condition that we will only ever attach
               // data to active cells when we get here
               Assert(dealii_cell->is_active(), ExcInternalError());
               break;
 
-            case CELL_COARSEN:
+            case CellStatus::children_will_be_coarsened:
               // double check the condition that we will only ever attach
               // data to cells with children when we get here. however, we
               // can only tolerate one level of coarsening at a time, so
@@ -113,7 +115,7 @@ void DataTransfer<dim, spacedim>::pack_data(
                 Assert(dealii_cell->child(c)->is_active(), ExcInternalError());
               break;
 
-            case CELL_INVALID:
+            case CellStatus::cell_invalid:
               // do nothing on invalid cells
               break;
 
@@ -128,10 +130,10 @@ void DataTransfer<dim, spacedim>::pack_data(
         // room for an array that holds information about how many
         // bytes each of the variable size callback functions will
         // write.
-        // On cells flagged with CELL_INVALID, only its CellStatus
+        // On cells flagged with CellStatus::cell_invalid, only its CellStatus
         // will be stored.
         const unsigned int n_fixed_size_data_sets_on_cell =
-          1 + ((cell_status == CELL_INVALID) ?
+          1 + ((cell_status == CellStatus::cell_invalid) ?
                  0 :
                  ((variable_size_data_stored ? 1 : 0) + n_callbacks_fixed));
         data_cell_fixed_it->resize(n_fixed_size_data_sets_on_cell);
@@ -147,8 +149,8 @@ void DataTransfer<dim, spacedim>::pack_data(
         ++data_fixed_it;
 
         // Proceed with all registered callback functions.
-        // Skip cells with the CELL_INVALID flag.
-        if (cell_status != CELL_INVALID)
+        // Skip cells with the CellStatus::cell_invalid flag.
+        if (cell_status != CellStatus::cell_invalid)
           {
             // Pack fixed size data.
             for (auto callback_it = pack_callbacks_fixed.cbegin();
@@ -165,7 +167,9 @@ void DataTransfer<dim, spacedim>::pack_data(
             if (variable_size_data_stored)
               {
                 const unsigned int n_variable_size_data_sets_on_cell =
-                  ((cell_status == CELL_INVALID) ? 0 : n_callbacks_variable);
+                  ((cell_status == CellStatus::cell_invalid) ?
+                     0 :
+                     n_callbacks_variable);
                 data_cell_variable_it->resize(
                   n_variable_size_data_sets_on_cell);
 
@@ -225,7 +229,7 @@ void DataTransfer<dim, spacedim>::pack_data(
   // Generate a vector which stores the sizes of each callback function,
   // including the packed CellStatus transfer.
   // Find the very first cell that we wrote to with all callback
-  // functions (i.e. a cell that was not flagged with CELL_INVALID)
+  // functions (i.e. a cell that was not flagged with CellStatus::cell_invalid)
   // and store the sizes of each buffer.
   //
   // To deal with the case that at least one of the processors does not
@@ -264,9 +268,7 @@ void DataTransfer<dim, spacedim>::pack_data(
   // of all callback functions across all processors, in case one
   // of them does not own any cells at all.
   std::vector<unsigned int> global_sizes_fixed(local_sizes_fixed.size());
-  Utilities::MPI::max(local_sizes_fixed,
-                      this->mpi_communicator,
-                      global_sizes_fixed);
+  Utilities::MPI::max(local_sizes_fixed, mpi_communicator, global_sizes_fixed);
 
   // Construct cumulative sizes, since this is the only information
   // we need from now on.
@@ -315,7 +317,7 @@ void DataTransfer<dim, spacedim>::pack_data(
                   std::back_inserter(src_data_fixed));
 
       // If we only packed the CellStatus information
-      // (i.e. encountered a cell flagged CELL_INVALID),
+      // (i.e. encountered a cell flagged CellStatus::cell_invalid),
       // fill the remaining space with invalid entries.
       // We can skip this if there is nothing else to pack.
       if ((data_cell_fixed.size() == 1) && (sizes_fixed_cumulative.size() > 1))
@@ -355,8 +357,9 @@ void DataTransfer<dim, spacedim>::pack_data(
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::unpack_cell_status(
-  std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+void CellAttachedDataSerializer<dim, spacedim>::unpack_cell_status(
+  std::vector<
+    typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
     &cell_relations) const
 {
   Assert(sizes_fixed_cumulative.size() > 0,
@@ -390,8 +393,9 @@ void DataTransfer<dim, spacedim>::unpack_cell_status(
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::unpack_data(
-  const std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+void CellAttachedDataSerializer<dim, spacedim>::unpack_data(
+  const std::vector<
+    typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
     &                cell_relations,
   const unsigned int handle,
   const std::function<
@@ -489,7 +493,7 @@ void DataTransfer<dim, spacedim>::unpack_data(
           // of the current cell.
           data_increment = *dest_sizes_it;
 
-          if (cell_status != CELL_INVALID)
+          if (cell_status != CellStatus::cell_invalid)
             {
               // Extract the corresponding values for offset and size from
               // the cumulative sizes array stored in the fixed size
@@ -521,22 +525,22 @@ void DataTransfer<dim, spacedim>::unpack_data(
 
       switch (cell_status)
         {
-          case CELL_PERSIST:
-          case CELL_COARSEN:
+          case CellStatus::cell_will_persist:
+          case CellStatus::children_will_be_coarsened:
             unpack_callback(dealii_cell,
                             cell_status,
                             boost::make_iterator_range(dest_data_it,
                                                        dest_data_it + size));
             break;
 
-          case CELL_REFINE:
+          case CellStatus::cell_will_be_refined:
             unpack_callback(dealii_cell->parent(),
                             cell_status,
                             boost::make_iterator_range(dest_data_it,
                                                        dest_data_it + size));
             break;
 
-          case CELL_INVALID:
+          case CellStatus::cell_invalid:
             // Skip this cell.
             break;
 
@@ -554,9 +558,11 @@ void DataTransfer<dim, spacedim>::unpack_data(
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::save(const unsigned int global_first_cell,
-                                       const unsigned int global_num_cells,
-                                       const std::string &filename) const
+void CellAttachedDataSerializer<dim, spacedim>::save(
+  const unsigned int global_first_cell,
+  const unsigned int global_num_cells,
+  const std::string &filename,
+  const MPI_Comm &   mpi_communicator) const
 {
   Assert(sizes_fixed_cumulative.size() > 0,
          ExcMessage("No data has been packed!"));
@@ -778,13 +784,14 @@ void DataTransfer<dim, spacedim>::save(const unsigned int global_first_cell,
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::load(
+void CellAttachedDataSerializer<dim, spacedim>::load(
   const unsigned int global_first_cell,
   const unsigned int global_num_cells,
   const unsigned int local_num_cells,
   const std::string &filename,
   const unsigned int n_attached_deserialize_fixed,
-  const unsigned int n_attached_deserialize_variable)
+  const unsigned int n_attached_deserialize_variable,
+  const MPI_Comm &   mpi_communicator)
 {
   Assert(dest_data_fixed.size() == 0,
          ExcMessage("Previously loaded data has not been released yet!"));
@@ -994,7 +1001,7 @@ void DataTransfer<dim, spacedim>::load(
 
 template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::clear()
+void CellAttachedDataSerializer<dim, spacedim>::clear()
 {
   variable_size_data_stored = false;
 
@@ -1024,6 +1031,6 @@ void DataTransfer<dim, spacedim>::clear()
 }
 
 // explicit instantiations
-#include "data_transfer.inst"
+#include "data_serializer.inst"
 
 DEAL_II_NAMESPACE_CLOSE
similarity index 85%
rename from source/grid/data_transfer.inst.in
rename to source/grid/data_serializer.inst.in
index d4eb339a87168ad2e2f53ded556e6cd229288ddd..d99a5d4775301c995f848f2e90d13f205a97dab2 100644 (file)
@@ -18,6 +18,7 @@
 for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
   {
 #if deal_II_dimension <= deal_II_space_dimension
-    template class DataTransfer<deal_II_dimension, deal_II_space_dimension>;
+    template class CellAttachedDataSerializer<deal_II_dimension,
+                                              deal_II_space_dimension>;
 #endif
   }
index 79cc106903dee050388b873ab89104d968fe9c6d..e2920086f736c2d80aa9eb7b21da05adb48cb53c 100644 (file)
@@ -3914,7 +3914,7 @@ namespace GridTools
         for (const auto &cell : triangulation.active_cell_iterators())
           if (cell->is_locally_owned())
             cell_weights[cell->active_cell_index()] =
-              triangulation.signals.weight(cell, CELL_PERSIST);
+              triangulation.signals.weight(cell, CellStatus::cell_will_persist);
 
         // If this is a parallel triangulation, we then need to also
         // get the weights for all other cells. We have asserted above
@@ -4014,7 +4014,7 @@ namespace GridTools
         for (const auto &cell : triangulation.active_cell_iterators() |
                                   IteratorFilters::LocallyOwnedCell())
           cell_weights[cell->active_cell_index()] =
-            triangulation.signals.weight(cell, CELL_PERSIST);
+            triangulation.signals.weight(cell, CellStatus::cell_will_persist);
 
         // If this is a parallel triangulation, we then need to also
         // get the weights for all other cells. We have asserted above
index 21fcd7fa437ce420b1d816759d9515551a82ca68..b46325717932fedd5377c0f856b67180d93a54da 100644 (file)
@@ -11065,7 +11065,6 @@ Triangulation<dim, spacedim>::Triangulation(
   const MeshSmoothing smooth_grid,
   const bool          check_for_distorted_cells)
   : cell_attached_data({0, 0, {}, {}})
-  , data_transfer(get_communicator())
   , smooth_grid(smooth_grid)
   , anisotropic_refinement(false)
   , check_for_distorted_cells(check_for_distorted_cells)
@@ -11092,7 +11091,6 @@ DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
 Triangulation<dim, spacedim>::Triangulation(
   Triangulation<dim, spacedim> &&tria) noexcept
   : Subscriptor(std::move(tria))
-  , data_transfer(get_communicator())
   , smooth_grid(tria.smooth_grid)
   , reference_cells(std::move(tria.reference_cells))
   , periodic_face_pairs_level_0(std::move(tria.periodic_face_pairs_level_0))
@@ -11189,7 +11187,7 @@ void Triangulation<dim, spacedim>::clear()
   reference_cells.clear();
 
   cell_attached_data = {0, 0, {}, {}};
-  data_transfer.clear();
+  data_serializer.clear();
 }
 
 
@@ -14826,7 +14824,8 @@ template <int dim, int spacedim>
 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
 unsigned int Triangulation<dim, spacedim>::register_data_attach(
   const std::function<std::vector<char>(const cell_iterator &,
-                                        const CellStatus)> &pack_callback,
+                                        const ::dealii::CellStatus)>
+    &        pack_callback,
   const bool returns_variable_size_data)
 {
   unsigned int handle = numbers::invalid_unsigned_int;
@@ -14858,14 +14857,14 @@ void Triangulation<dim, spacedim>::notify_ready_to_unpack(
   const unsigned int handle,
   const std::function<
     void(const cell_iterator &,
-         const CellStatus,
+         const ::dealii::CellStatus,
          const boost::iterator_range<std::vector<char>::const_iterator> &)>
     &unpack_callback)
 {
   // perform unpacking
-  this->data_transfer.unpack_data(this->local_cell_relations,
-                                  handle,
-                                  unpack_callback);
+  this->data_serializer.unpack_data(this->local_cell_relations,
+                                    handle,
+                                    unpack_callback);
 
   // decrease counters
   --this->cell_attached_data.n_attached_data_sets;
@@ -14885,11 +14884,11 @@ void Triangulation<dim, spacedim>::notify_ready_to_unpack(
       // everybody got their data, time for cleanup!
       this->cell_attached_data.pack_callbacks_fixed.clear();
       this->cell_attached_data.pack_callbacks_variable.clear();
-      this->data_transfer.clear();
+      this->data_serializer.clear();
 
       // reset all cell_status entries after coarsening/refinement
       for (auto &cell_rel : this->local_cell_relations)
-        cell_rel.second = CELL_PERSIST;
+        cell_rel.second = ::dealii::CellStatus::cell_will_persist;
     }
 }
 
@@ -14908,16 +14907,20 @@ void Triangulation<dim, spacedim>::save_attached_data(
   if (this->cell_attached_data.n_attached_data_sets > 0)
     {
       // pack attached data first
-      tria->data_transfer.pack_data(
+      tria->data_serializer.pack_data(
         tria->local_cell_relations,
         tria->cell_attached_data.pack_callbacks_fixed,
-        tria->cell_attached_data.pack_callbacks_variable);
+        tria->cell_attached_data.pack_callbacks_variable,
+        this->get_communicator());
 
       // then store buffers in file
-      tria->data_transfer.save(global_first_cell, global_num_cells, filename);
+      tria->data_serializer.save(global_first_cell,
+                                 global_num_cells,
+                                 filename,
+                                 this->get_communicator());
 
       // and release the memory afterwards
-      tria->data_transfer.clear();
+      tria->data_serializer.clear();
     }
 
   // clear all of the callback data, as explained in the documentation of
@@ -14943,21 +14946,23 @@ void Triangulation<dim, spacedim>::load_attached_data(
   // load saved data, if any was stored
   if (this->cell_attached_data.n_attached_deserialize > 0)
     {
-      this->data_transfer.load(global_first_cell,
-                               global_num_cells,
-                               local_num_cells,
-                               filename,
-                               n_attached_deserialize_fixed,
-                               n_attached_deserialize_variable);
-
-      this->data_transfer.unpack_cell_status(this->local_cell_relations);
-
-      // the CellStatus of all stored cells should always be CELL_PERSIST.
+      this->data_serializer.load(global_first_cell,
+                                 global_num_cells,
+                                 local_num_cells,
+                                 filename,
+                                 n_attached_deserialize_fixed,
+                                 n_attached_deserialize_variable,
+                                 this->get_communicator());
+
+      this->data_serializer.unpack_cell_status(this->local_cell_relations);
+
+      // the CellStatus of all stored cells should always be
+      // CellStatus::cell_will_persist.
       for (const auto &cell_rel : this->local_cell_relations)
         {
           (void)cell_rel;
           Assert((cell_rel.second == // cell_status
-                  CELL_PERSIST),
+                  ::dealii::CellStatus::cell_will_persist),
                  ExcInternalError());
         }
     }
index 5bad34b83276c11018f6d9cdb0e2e3514fc896f2..e6c489be0bd9ba3be11bc641164a7eb157bab63a 100644 (file)
@@ -2299,8 +2299,8 @@ namespace Particles
 
     switch (status)
       {
-        case CELL_PERSIST:
-        case CELL_REFINE:
+        case CellStatus::cell_will_persist:
+        case CellStatus::cell_will_be_refined:
           // If the cell persist or is refined store all particles of the
           // current cell.
           {
@@ -2315,7 +2315,7 @@ namespace Particles
           }
           break;
 
-        case CELL_COARSEN:
+        case CellStatus::children_will_be_coarsened:
           // If this cell is the parent of children that will be coarsened,
           // collect the particles of all children.
           {
@@ -2356,7 +2356,7 @@ namespace Particles
       return;
 
     const auto cell_to_store_particles =
-      (status != CELL_REFINE) ? cell : cell->child(0);
+      (status != CellStatus::cell_will_be_refined) ? cell : cell->child(0);
 
     // deserialize particles and insert into local storage
     if (data_range.begin() != data_range.end())
@@ -2380,13 +2380,13 @@ namespace Particles
     // now update particle storage location and properties if necessary
     switch (status)
       {
-        case CELL_PERSIST:
+        case CellStatus::cell_will_persist:
           {
             // all particles are correctly inserted
           }
           break;
 
-        case CELL_COARSEN:
+        case CellStatus::children_will_be_coarsened:
           {
             // all particles are in correct cell, but their reference location
             // has changed
@@ -2400,7 +2400,7 @@ namespace Particles
           }
           break;
 
-        case CELL_REFINE:
+        case CellStatus::cell_will_be_refined:
           {
             // we need to find the correct child to store the particles and
             // their reference location has changed
index a844f2c2692ff91cfb30b062a14b8c1e5f9f201a..38e9ddf6b9d121b6b663ee6249ed92d6608aec1c 100644 (file)
@@ -42,15 +42,15 @@ pack_function(
   static int some_number = 0;
   deallog << "packing cell " << cell->id() << " with data=" << some_number
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_COARSEN)
+  if (status == CellStatus::children_will_be_coarsened)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
@@ -76,15 +76,15 @@ unpack_function(
 
   deallog << "unpacking cell " << cell->id() << " with data=" << intdata
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_REFINE)
+  if (status == CellStatus::cell_will_be_refined)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
index ff1c2895e27a1318640e95527f10733d58bbce21..55ca370c3e5518417b93884c7b191fc3efd2320c 100644 (file)
@@ -57,15 +57,15 @@ pack_function(
           << " with data size =" << buffer.size() << " accumulated data="
           << std::accumulate(some_vector.begin(), some_vector.end(), 0)
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_COARSEN)
+  if (status == CellStatus::children_will_be_coarsened)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
@@ -107,15 +107,15 @@ unpack_function(
           << " accumulated data="
           << std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_REFINE)
+  if (status == CellStatus::cell_will_be_refined)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
index ad2b8ae2c15c9904d7c995aa0f6ef13e96b20bb0..d0353f93bc724c14b91933ae0bed8dc1942a0e3a 100644 (file)
@@ -80,7 +80,8 @@ test()
   std::vector<unsigned int> integrated_weights(numproc, 0);
   for (const auto &cell :
        tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
-    integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+    integrated_weights[myid] +=
+      cell_weight<dim>(cell, CellStatus::cell_will_persist);
 
   Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
   if (myid == 0)
index 2c46ce8ba368ecc445a015d479f998532b936467..819c339b56897d9765a117a121667f4b477f3267 100644 (file)
@@ -74,7 +74,8 @@ test()
   std::vector<unsigned int> integrated_weights(numproc, 0);
   for (const auto &cell :
        tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
-    integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+    integrated_weights[myid] +=
+      cell_weight<dim>(cell, CellStatus::cell_will_persist);
 
   Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
   if (myid == 0)
index 0a942ed7c23f1a036bb0f67ed8b59bfb0864fb76..c49902d7c09a8ecb21935fdec91c6b4ed57a3c67 100644 (file)
@@ -94,7 +94,8 @@ test()
   std::vector<unsigned int> integrated_weights(numproc, 0);
   for (const auto &cell :
        tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
-    integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+    integrated_weights[myid] +=
+      cell_weight<dim>(cell, CellStatus::cell_will_persist);
 
   Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
   if (myid == 0)
index aa3f76458952ab2ce1db679dd0d10c12ffab1996..9295b0395756f025e8432ba8d730d62beed7fd57 100644 (file)
@@ -93,7 +93,8 @@ test()
   std::vector<unsigned int> integrated_weights(numproc, 0);
   for (const auto &cell :
        tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
-    integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+    integrated_weights[myid] +=
+      cell_weight<dim>(cell, CellStatus::cell_will_persist);
 
   Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
   if (myid == 0)
index 7a7352407accd2acb55a304e93d132f0a02901b9..a51d22214f00f7369fd37532780d77c6cca5cdfb 100644 (file)
@@ -59,7 +59,7 @@ pack_function(
           << std::accumulate(some_vector.begin(), some_vector.end(), 0)
           << std::endl;
 
-  Assert((status == CELL_PERSIST), ExcInternalError());
+  Assert((status == CellStatus::cell_will_persist), ExcInternalError());
 
   ++some_number;
   return buffer;
@@ -97,7 +97,7 @@ unpack_function(
           << std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
           << std::endl;
 
-  Assert((status == CELL_PERSIST), ExcInternalError());
+  Assert((status == CellStatus::cell_will_persist), ExcInternalError());
 }
 
 
index 972a1b51581dd67d7fa1ad2bd2c70f17265e9975..292ae1f4cbb49d351285671cfec6cd8f323307c4 100644 (file)
@@ -62,7 +62,7 @@ pack_function(
           << std::accumulate(some_vector.begin(), some_vector.end(), 0)
           << std::endl;
 
-  Assert((status == CELL_PERSIST), ExcInternalError());
+  Assert((status == CellStatus::cell_will_persist), ExcInternalError());
 
   ++some_number;
   return buffer;
@@ -100,7 +100,7 @@ unpack_function(
           << std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
           << std::endl;
 
-  Assert((status == CELL_PERSIST), ExcInternalError());
+  Assert((status == CellStatus::cell_will_persist), ExcInternalError());
 }
 
 
index 953d09ad87388d13a36e951f98b54451da395193..6ba53adb83769d7bce42d410dbfc332b6eea8daa 100644 (file)
@@ -42,15 +42,15 @@ pack_function(
   static int some_number = cell->index();
   deallog << "packing cell " << cell->id() << " with data=" << some_number
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_COARSEN)
+  if (status == CellStatus::children_will_be_coarsened)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
@@ -76,15 +76,15 @@ unpack_function(
 
   deallog << "unpacking cell " << cell->id() << " with data=" << number
           << " status=";
-  if (status == CELL_PERSIST)
+  if (status == CellStatus::cell_will_persist)
     deallog << "PERSIST";
-  else if (status == CELL_REFINE)
+  else if (status == CellStatus::cell_will_be_refined)
     deallog << "REFINE";
-  else if (status == CELL_COARSEN)
+  else if (status == CellStatus::children_will_be_coarsened)
     deallog << "COARSEN";
   deallog << std::endl;
 
-  if (status == CELL_REFINE)
+  if (status == CellStatus::cell_will_be_refined)
     {
       Assert(cell->has_children(), ExcInternalError());
     }
index 884408207daed05c5f519b1a51ac943f56fc0d06..d459c3ffecac45f3b75c73828596ab293f200f9c 100644 (file)
@@ -78,15 +78,15 @@ test()
       unsigned int n_particles_in_cell = 0;
       switch (status)
         {
-          case CELL_PERSIST:
-          case CELL_REFINE:
+          case CellStatus::cell_will_persist:
+          case CellStatus::cell_will_be_refined:
             n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
             break;
 
-          case CELL_INVALID:
+          case CellStatus::cell_invalid:
             break;
 
-          case CELL_COARSEN:
+          case CellStatus::children_will_be_coarsened:
             for (const auto &child : cell->child_iterators())
               n_particles_in_cell +=
                 particle_handler.n_particles_in_cell(child);
index 69210d0f990871052026cb52b048d6cb97c9748f..16701af07805c7e018d89625b486abf970f45981 100644 (file)
@@ -273,21 +273,21 @@ namespace Step68
     const unsigned int particle_weight = 10;
 
     // This example does not use adaptive refinement, therefore every cell
-    // should have the status `CELL_PERSIST`. However this function can also
-    // be used to distribute load during refinement, therefore we consider
-    // refined or coarsened cells as well.
+    // should have the status `CellStatus::cell_will_persist`. However this
+    // function can also be used to distribute load during refinement, therefore
+    // we consider refined or coarsened cells as well.
     unsigned int n_particles_in_cell = 0;
     switch (status)
       {
-        case CELL_PERSIST:
-        case CELL_REFINE:
+        case CellStatus::cell_will_persist:
+        case CellStatus::cell_will_be_refined:
           n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
           break;
 
-        case CELL_INVALID:
+        case CellStatus::cell_invalid:
           break;
 
-        case CELL_COARSEN:
+        case CellStatus::children_will_be_coarsened:
           for (const auto &child : cell->child_iterators())
             n_particles_in_cell += particle_handler.n_particles_in_cell(child);
           break;

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.