]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move DoFhandler::prepare_c_and_r() to hp::Refinement::limit_p_level_difference(). 11937/head
authorMarc Fehling <mafehling.git@gmail.com>
Thu, 18 Mar 2021 01:59:12 +0000 (19:59 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Thu, 18 Mar 2021 18:43:40 +0000 (12:43 -0600)
12 files changed:
doc/news/changes/minor/20210223Fehling
include/deal.II/dofs/dof_handler.h
include/deal.II/hp/refinement.h
source/dofs/dof_handler.cc
source/hp/refinement.cc
source/hp/refinement.inst.in
tests/hp/prepare_coarsening_and_refinement_01.cc
tests/hp/prepare_coarsening_and_refinement_02.cc
tests/hp/prepare_coarsening_and_refinement_03.cc
tests/mpi/prepare_coarsening_and_refinement_01.cc
tests/mpi/prepare_coarsening_and_refinement_02.cc
tests/mpi/prepare_coarsening_and_refinement_03.cc

index 5b57fa6d39ce88c55d652d5cce272d54f4da7e5b..79d740b4eabab90eafdf41fe7345233d33183f89 100644 (file)
@@ -1,4 +1,4 @@
-New: Member function DoFHandler::prepare_coarsening_and_refinement()
+New: Function hp::Refinement::limit_p_level_difference()
 restricts the maximal level difference of neighboring cells with respect
 to the finite element hierarchy of the registered hp::FECollection.
 <br>
index 256ba91808aa4f9e09c69777bc72de329077a496..c4c15ab2e8c9be9958bbdcd9c1ea055a246ac55b 100644 (file)
@@ -701,36 +701,6 @@ public:
   void
   distribute_mg_dofs();
 
-  /**
-   * Prepare all cells for p-adaptation in hp-mode. Does nothing in non-hp-mode.
-   *
-   * Essentially does to future FE indices what
-   * Triangulation::prepare_coarsening_and_refinement() does to refinement
-   * flags.
-   *
-   * In detail, this function limits the level difference of neighboring cells
-   * and thus smoothes the overall function space. Future FE indices will be
-   * raised (and never lowered) so that the level difference to neighboring
-   * cells is never larger than @p max_difference.
-   *
-   * Multiple FE hierarchies might have been registered via
-   * hp::FECollection::set_hierarchy(). This function operates on only one
-   * hierarchy, namely the one that contains the FE index @p contains_fe_index.
-   * Cells with future FE indices that are not part of the corresponding
-   * hierarchy will be ignored.
-   *
-   * The function can optionally be called before performing adaptation with
-   * Triangulation::execute_coarsening_and_refinement(). It is not necessary to
-   * call this function, nor will it be automatically invoked in any part of the
-   * library (contrary to its Triangulation counterpart).
-   *
-   * Returns whether any future FE indices have been changed by this function.
-   */
-  bool
-  prepare_coarsening_and_refinement(
-    const unsigned int max_difference    = 1,
-    const unsigned int contains_fe_index = 0) const;
-
   /**
    * Returns whether this DoFHandler has hp-capabilities.
    */
index 5f763b888a683c7aaf0b4962a0c3f38e02cf5549..b674183cd0810a898c645684116b48bd860cb440 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2019 - 2020 by the deal.II authors
+// Copyright (C) 2019 - 2021 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -361,6 +361,7 @@ namespace hp
       const ComparisonFunction<typename identity<Number>::type> &compare_refine,
       const ComparisonFunction<typename identity<Number>::type>
         &compare_coarsen);
+
     /**
      * @}
      */
@@ -647,6 +648,47 @@ namespace hp
     /**
      * @}
      */
+
+    /**
+     * @name Optimiize p-level distribution
+     * @{
+     */
+
+    /**
+     * Limit p-level differences between neighboring cells.
+     *
+     * Essentially does to future FE indices what
+     * Triangulation::prepare_coarsening_and_refinement() does to refinement
+     * flags.
+     *
+     * In detail, this function limits the level difference of neighboring cells
+     * and thus smoothes the overall function space. Future FE indices will be
+     * raised (and never lowered) so that the level difference to neighboring
+     * cells is never larger than @p max_difference.
+     *
+     * Multiple FE hierarchies might have been registered via
+     * hp::FECollection::set_hierarchy(). This function operates on only one
+     * hierarchy, namely the one that contains the FE index @p contains_fe_index.
+     * Cells with future FE indices that are not part of the corresponding
+     * hierarchy will be ignored.
+     *
+     * The function can optionally be called before performing adaptation with
+     * Triangulation::execute_coarsening_and_refinement(). It is not necessary
+     * to call this function, nor will it be automatically invoked in any part
+     * of the library (contrary to its Triangulation counterpart).
+     *
+     * Returns whether any future FE indices have been changed by this function.
+     */
+    template <int dim, int spacedim>
+    bool
+    limit_p_level_difference(
+      const dealii::DoFHandler<dim, spacedim> &dof_handler,
+      const unsigned int                       max_difference    = 1,
+      const unsigned int                       contains_fe_index = 0);
+
+    /**
+     * @}
+     */
   } // namespace Refinement
 } // namespace hp
 
index e7ba6ba8a24a8603ab1c5939870e7e0be222eef9..a2f32baae512930f4e1d1c7ab150c2a817d3945a 100644 (file)
@@ -32,8 +32,6 @@
 #include <deal.II/grid/tria_iterator.h>
 #include <deal.II/grid/tria_levels.h>
 
-#include <deal.II/lac/la_parallel_vector.templates.h>
-
 #include <algorithm>
 #include <memory>
 #include <set>
@@ -2657,208 +2655,6 @@ DoFHandler<dim, spacedim>::distribute_mg_dofs()
 
 
 
-template <int dim, int spacedim>
-bool
-DoFHandler<dim, spacedim>::prepare_coarsening_and_refinement(
-  const unsigned int max_difference,
-  const unsigned int contains_fe_index) const
-{
-  Assert(max_difference > 0,
-         ExcMessage(
-           "This function does not serve any purpose for max_difference = 0."));
-  AssertIndexRange(contains_fe_index, fe_collection.size());
-
-  if (!hp_capability_enabled)
-    // nothing to do
-    return false;
-
-
-  //
-  // establish hierarchy
-  //
-  // - create bimap between hierarchy levels and FE indices
-
-  // there can be as many levels in the hierarchy as active FE indices are
-  // possible
-  using level_type                      = active_fe_index_type;
-  static const level_type invalid_level = invalid_active_fe_index;
-
-  // map from FE index to level in hierarchy
-  // FE indices that are not covered in the hierarchy are not in the map
-  const std::vector<unsigned int> fe_index_for_hierarchy_level =
-    fe_collection.get_hierarchy_sequence(contains_fe_index);
-
-  // map from level in hierarchy to FE index
-  // FE indices that are not covered in the hierarchy will be mapped to
-  // invalid_level
-  std::vector<unsigned int> hierarchy_level_for_fe_index(fe_collection.size(),
-                                                         invalid_level);
-  for (unsigned int l = 0; l < fe_index_for_hierarchy_level.size(); ++l)
-    hierarchy_level_for_fe_index[fe_index_for_hierarchy_level[l]] = l;
-
-
-  //
-  // parallelization
-  //
-  // - create distributed vector of level indices
-  // - update ghost values in each iteration (see later)
-  // - no need to compress, since the owning processor will have the correct
-  //   level index
-
-  // HOTFIX: dealii::Vector does not accept integral types
-  LinearAlgebra::distributed::Vector<float> future_levels;
-  if (const auto parallel_tria =
-        dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
-          &(*tria)))
-    {
-      future_levels.reinit(
-        parallel_tria->global_active_cell_index_partitioner().lock());
-    }
-  else
-    {
-      future_levels.reinit(tria->n_active_cells());
-    }
-
-  for (const auto &cell : active_cell_iterators())
-    if (cell->is_locally_owned())
-      future_levels[cell->global_active_cell_index()] =
-        hierarchy_level_for_fe_index[cell->future_fe_index()];
-
-
-  //
-  // limit level difference of neighboring cells
-  //
-  // - go over all locally relevant cells, and adjust the level indices of
-  //   locally owned neighbors to match the level difference (as a consequence,
-  //   indices on ghost cells will be updated only on the owning processor)
-  // - always raise levels to match criterion, never lower them
-  // - exchange level indices on ghost cells
-
-  bool levels_changed = false;
-  bool levels_changed_in_cycle;
-  do
-    {
-      levels_changed_in_cycle = false;
-
-      future_levels.update_ghost_values();
-
-      for (const auto &cell : active_cell_iterators())
-        if (!cell->is_artificial())
-          {
-            const level_type cell_level = static_cast<level_type>(
-              future_levels[cell->global_active_cell_index()]);
-
-            // ignore cells that are not part of the hierarchy
-            if (cell_level == invalid_level)
-              continue;
-
-            // ignore lowest levels of the hierarchy that always fulfill the
-            // max_difference criterion
-            if (cell_level <= max_difference)
-              continue;
-
-            for (unsigned int f = 0; f < cell->n_faces(); ++f)
-              if (cell->face(f)->at_boundary() == false)
-                {
-                  if (cell->face(f)->has_children())
-                    {
-                      for (unsigned int sf = 0;
-                           sf < cell->face(f)->n_children();
-                           ++sf)
-                        {
-                          const auto neighbor =
-                            cell->neighbor_child_on_subface(f, sf);
-
-                          // We only care about locally owned neighbors. If
-                          // neighbor is a ghost cell, its future FE index will
-                          // be updated on the owning process and communicated
-                          // at the next loop iteration.
-                          if (neighbor->is_locally_owned())
-                            {
-                              const level_type neighbor_level =
-                                static_cast<level_type>(
-                                  future_levels
-                                    [neighbor->global_active_cell_index()]);
-
-                              // ignore neighbors that are not part of the
-                              // hierarchy
-                              if (neighbor_level == invalid_level)
-                                continue;
-
-                              if ((cell_level - max_difference) >
-                                  neighbor_level)
-                                {
-                                  future_levels
-                                    [neighbor->global_active_cell_index()] =
-                                      cell_level - max_difference;
-
-                                  levels_changed_in_cycle = true;
-                                }
-                            }
-                        }
-                    }
-                  else
-                    {
-                      const auto neighbor = cell->neighbor(f);
-
-                      // We only care about locally owned neighbors. If neighbor
-                      // is a ghost cell, its future FE index will be updated on
-                      // the owning process and communicated at the next loop
-                      // iteration.
-                      if (neighbor->is_locally_owned())
-                        {
-                          const level_type neighbor_level =
-                            static_cast<level_type>(
-                              future_levels[neighbor
-                                              ->global_active_cell_index()]);
-
-                          // ignore neighbors that are not part of the hierarchy
-                          if (neighbor_level == invalid_level)
-                            continue;
-
-                          if ((cell_level - max_difference) > neighbor_level)
-                            {
-                              future_levels[neighbor
-                                              ->global_active_cell_index()] =
-                                cell_level - max_difference;
-
-                              levels_changed_in_cycle = true;
-                            }
-                        }
-                    }
-                }
-          }
-
-      levels_changed_in_cycle =
-        Utilities::MPI::logical_or(levels_changed_in_cycle,
-                                   tria->get_communicator());
-      levels_changed |= levels_changed_in_cycle;
-    }
-  while (levels_changed_in_cycle);
-
-  // update future FE indices on locally owned cells
-  for (const auto &cell : active_cell_iterators())
-    if (cell->is_locally_owned())
-      {
-        const level_type cell_level = static_cast<level_type>(
-          future_levels[cell->global_active_cell_index()]);
-
-        if (cell_level != invalid_level)
-          {
-            const active_fe_index_type fe_index =
-              fe_index_for_hierarchy_level[cell_level];
-
-            // only update if necessary
-            if (fe_index != cell->active_fe_index())
-              cell->set_future_fe_index(fe_index);
-          }
-      }
-
-  return levels_changed;
-}
-
-
-
 template <int dim, int spacedim>
 void
 DoFHandler<dim, spacedim>::initialize_local_block_info()
index ac0549bd48252262bf9b76d07708a91df132f3af..edc5cb179488e0f9276e716633688aadc75caf43 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2019 - 2020 by the deal.II authors
+// Copyright (C) 2019 - 2021 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
 #include <deal.II/distributed/shared_tria.h>
 #include <deal.II/distributed/tria_base.h>
 
+#include <deal.II/dofs/dof_handler.h>
+
 #include <deal.II/grid/grid_refinement.h>
 #include <deal.II/grid/grid_tools.h>
 
-#include <deal.II/hp/dof_handler.h>
 #include <deal.II/hp/refinement.h>
 
+#include <deal.II/lac/la_parallel_vector.h>
 #include <deal.II/lac/vector.h>
 
 DEAL_II_NAMESPACE_OPEN
@@ -752,6 +754,219 @@ namespace hp
               }
           }
     }
+
+
+
+    /**
+     * Optimize p-level distribution
+     */
+    template <int dim, int spacedim>
+    bool
+    limit_p_level_difference(
+      const dealii::DoFHandler<dim, spacedim> &dof_handler,
+      const unsigned int                       max_difference,
+      const unsigned int                       contains_fe_index)
+    {
+      Assert(
+        dof_handler.has_hp_capabilities(),
+        (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
+      Assert(
+        max_difference > 0,
+        ExcMessage(
+          "This function does not serve any purpose for max_difference = 0."));
+      AssertIndexRange(contains_fe_index,
+                       dof_handler.get_fe_collection().size());
+
+      //
+      // establish hierarchy
+      //
+      // - create bimap between hierarchy levels and FE indices
+
+      // there can be as many levels in the hierarchy as active FE indices are
+      // possible
+      using level_type =
+        typename dealii::DoFHandler<dim, spacedim>::active_fe_index_type;
+      static const level_type invalid_level =
+        dealii::DoFHandler<dim, spacedim>::invalid_active_fe_index;
+
+      // map from FE index to level in hierarchy
+      // FE indices that are not covered in the hierarchy are not in the map
+      const std::vector<unsigned int> fe_index_for_hierarchy_level =
+        dof_handler.get_fe_collection().get_hierarchy_sequence(
+          contains_fe_index);
+
+      // map from level in hierarchy to FE index
+      // FE indices that are not covered in the hierarchy will be mapped to
+      // invalid_level
+      std::vector<unsigned int> hierarchy_level_for_fe_index(
+        dof_handler.get_fe_collection().size(), invalid_level);
+      for (unsigned int l = 0; l < fe_index_for_hierarchy_level.size(); ++l)
+        hierarchy_level_for_fe_index[fe_index_for_hierarchy_level[l]] = l;
+
+
+      //
+      // parallelization
+      //
+      // - create distributed vector of level indices
+      // - update ghost values in each iteration (see later)
+      // - no need to compress, since the owning processor will have the correct
+      //   level index
+
+      // HOTFIX: dealii::Vector does not accept integral types
+      LinearAlgebra::distributed::Vector<float> future_levels;
+      if (const auto parallel_tria =
+            dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
+              &(dof_handler.get_triangulation())))
+        {
+          future_levels.reinit(
+            parallel_tria->global_active_cell_index_partitioner().lock());
+        }
+      else
+        {
+          future_levels.reinit(
+            dof_handler.get_triangulation().n_active_cells());
+        }
+
+      for (const auto &cell : dof_handler.active_cell_iterators())
+        if (cell->is_locally_owned())
+          future_levels[cell->global_active_cell_index()] =
+            hierarchy_level_for_fe_index[cell->future_fe_index()];
+
+
+      //
+      // limit level difference of neighboring cells
+      //
+      // - go over all locally relevant cells, and adjust the level indices of
+      //   locally owned neighbors to match the level difference (as a
+      //   consequence, indices on ghost cells will be updated only on the
+      //   owning processor)
+      // - always raise levels to match criterion, never lower them
+      // - exchange level indices on ghost cells
+
+      bool levels_changed = false;
+      bool levels_changed_in_cycle;
+      do
+        {
+          levels_changed_in_cycle = false;
+
+          future_levels.update_ghost_values();
+
+          for (const auto &cell : dof_handler.active_cell_iterators())
+            if (!cell->is_artificial())
+              {
+                const level_type cell_level = static_cast<level_type>(
+                  future_levels[cell->global_active_cell_index()]);
+
+                // ignore cells that are not part of the hierarchy
+                if (cell_level == invalid_level)
+                  continue;
+
+                // ignore lowest levels of the hierarchy that always fulfill the
+                // max_difference criterion
+                if (cell_level <= max_difference)
+                  continue;
+
+                for (unsigned int f = 0; f < cell->n_faces(); ++f)
+                  if (cell->face(f)->at_boundary() == false)
+                    {
+                      if (cell->face(f)->has_children())
+                        {
+                          for (unsigned int sf = 0;
+                               sf < cell->face(f)->n_children();
+                               ++sf)
+                            {
+                              const auto neighbor =
+                                cell->neighbor_child_on_subface(f, sf);
+
+                              // We only care about locally owned neighbors. If
+                              // neighbor is a ghost cell, its future FE index
+                              // will be updated on the owning process and
+                              // communicated at the next loop iteration.
+                              if (neighbor->is_locally_owned())
+                                {
+                                  const level_type neighbor_level =
+                                    static_cast<level_type>(
+                                      future_levels
+                                        [neighbor->global_active_cell_index()]);
+
+                                  // ignore neighbors that are not part of the
+                                  // hierarchy
+                                  if (neighbor_level == invalid_level)
+                                    continue;
+
+                                  if ((cell_level - max_difference) >
+                                      neighbor_level)
+                                    {
+                                      future_levels
+                                        [neighbor->global_active_cell_index()] =
+                                          cell_level - max_difference;
+
+                                      levels_changed_in_cycle = true;
+                                    }
+                                }
+                            }
+                        }
+                      else
+                        {
+                          const auto neighbor = cell->neighbor(f);
+
+                          // We only care about locally owned neighbors. If
+                          // neighbor is a ghost cell, its future FE index will
+                          // be updated on the owning process and communicated
+                          // at the next loop iteration.
+                          if (neighbor->is_locally_owned())
+                            {
+                              const level_type neighbor_level =
+                                static_cast<level_type>(
+                                  future_levels
+                                    [neighbor->global_active_cell_index()]);
+
+                              // ignore neighbors that are not part of the
+                              // hierarchy
+                              if (neighbor_level == invalid_level)
+                                continue;
+
+                              if ((cell_level - max_difference) >
+                                  neighbor_level)
+                                {
+                                  future_levels
+                                    [neighbor->global_active_cell_index()] =
+                                      cell_level - max_difference;
+
+                                  levels_changed_in_cycle = true;
+                                }
+                            }
+                        }
+                    }
+              }
+
+          levels_changed_in_cycle =
+            Utilities::MPI::logical_or(levels_changed_in_cycle,
+                                       dof_handler.get_communicator());
+          levels_changed |= levels_changed_in_cycle;
+        }
+      while (levels_changed_in_cycle);
+
+      // update future FE indices on locally owned cells
+      for (const auto &cell : dof_handler.active_cell_iterators())
+        if (cell->is_locally_owned())
+          {
+            const level_type cell_level = static_cast<level_type>(
+              future_levels[cell->global_active_cell_index()]);
+
+            if (cell_level != invalid_level)
+              {
+                const unsigned int fe_index =
+                  fe_index_for_hierarchy_level[cell_level];
+
+                // only update if necessary
+                if (fe_index != cell->active_fe_index())
+                  cell->set_future_fe_index(fe_index);
+              }
+          }
+
+      return levels_changed;
+    }
   } // namespace Refinement
 } // namespace hp
 
index a9042f0c591c365020edb4b72e1adb8499733751..b2ec253d4efcee07962a08ff0daabcfae6dd470a 100644 (file)
@@ -42,6 +42,13 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
         choose_p_over_h<deal_II_dimension, deal_II_space_dimension>(
           const dealii::DoFHandler<deal_II_dimension, deal_II_space_dimension>
             &);
+
+        template bool
+        limit_p_level_difference<deal_II_dimension, deal_II_space_dimension>(
+          const dealii::DoFHandler<deal_II_dimension, deal_II_space_dimension>
+            &,
+          const unsigned int,
+          const unsigned int);
       \}
     \}
 #endif
index 10d685e8ad598ca6a4599f7633dd847e3e5c85e8..e0494dff5ab1da1f89f55b84b686996903f8d849 100644 (file)
@@ -32,6 +32,7 @@
 #include <deal.II/grid/tria.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include <vector>
 
@@ -74,7 +75,9 @@ test(const unsigned int fes_size, const unsigned int max_difference)
 
   center_cell->set_active_fe_index(sequence.back());
   const bool fe_indices_changed =
-    dofh.prepare_coarsening_and_refinement(max_difference, contains_fe_index);
+    hp::Refinement::limit_p_level_difference(dofh,
+                                             max_difference,
+                                             contains_fe_index);
   tria.execute_coarsening_and_refinement();
 
   (void)fe_indices_changed;
index f46d847f009f11796ca1522608ee8a139eb8a8ee..7038552e2c988b2b24cb81f0cae778b256f64cd4 100644 (file)
@@ -32,6 +32,7 @@
 #include <deal.II/grid/tria.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include <vector>
 
@@ -78,8 +79,9 @@ test(const unsigned int fes_size, const unsigned int max_difference)
         fes.next_in_hierarchy(center_cell->active_fe_index()));
 
       const bool fe_indices_changed =
-        dofh.prepare_coarsening_and_refinement(max_difference,
-                                               contains_fe_index);
+        hp::Refinement::limit_p_level_difference(dofh,
+                                                 max_difference,
+                                                 contains_fe_index);
       tria.execute_coarsening_and_refinement();
 
       (void)fe_indices_changed;
index 806e6563078127d21f7c9f62a3b646f92d4e0a41..3d34890e66d16fe8fb56a459a16b17bad0881918 100644 (file)
@@ -28,6 +28,7 @@
 #include <deal.II/grid/tria.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include "../tests.h"
 
@@ -90,7 +91,9 @@ test(const unsigned int fes_size, const unsigned int max_difference)
   dofh.distribute_dofs(fes);
 
   const bool fe_indices_changed =
-    dofh.prepare_coarsening_and_refinement(max_difference, contains_fe_index);
+    hp::Refinement::limit_p_level_difference(dofh,
+                                             max_difference,
+                                             contains_fe_index);
   tria.execute_coarsening_and_refinement();
 
   (void)fe_indices_changed;
index 26851fc26381061e03b93567bf7cc1b26e330f28..f9e36450ee64b95d0aa0bbe95431e4e1eb9a1a42 100644 (file)
@@ -35,6 +35,7 @@
 #include <deal.II/grid/grid_generator.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include <vector>
 
@@ -79,7 +80,9 @@ test(parallel::TriangulationBase<dim> &tria,
       cell->set_active_fe_index(sequence.back());
 
   const bool fe_indices_changed =
-    dofh.prepare_coarsening_and_refinement(max_difference, contains_fe_index);
+    hp::Refinement::limit_p_level_difference(dofh,
+                                             max_difference,
+                                             contains_fe_index);
   tria.execute_coarsening_and_refinement();
 
   (void)fe_indices_changed;
index e324e09652f81c728e9b990a7ba6dda0b7a01e2b..e660e42fe85cf96834a81ab3872826cc4cecdaec 100644 (file)
@@ -35,6 +35,7 @@
 #include <deal.II/grid/grid_generator.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include <vector>
 
@@ -83,8 +84,9 @@ test(parallel::TriangulationBase<dim> &tria,
             fes.next_in_hierarchy(cell->active_fe_index()));
 
       const bool fe_indices_changed =
-        dofh.prepare_coarsening_and_refinement(max_difference,
-                                               contains_fe_index);
+        hp::Refinement::limit_p_level_difference(dofh,
+                                                 max_difference,
+                                                 contains_fe_index);
       tria.execute_coarsening_and_refinement();
 
       (void)fe_indices_changed;
index 0ab5d6f59f6963e93bf7e7228537c21807067552..ece1b8681db91d93d9d5ca9c0a7f4e0221345d7d 100644 (file)
@@ -30,6 +30,7 @@
 #include <deal.II/fe/fe_q.h>
 
 #include <deal.II/hp/fe_collection.h>
+#include <deal.II/hp/refinement.h>
 
 #include "../tests.h"
 
@@ -94,7 +95,9 @@ test(parallel::TriangulationBase<dim> &tria,
   dofh.distribute_dofs(fes);
 
   const bool fe_indices_changed =
-    dofh.prepare_coarsening_and_refinement(max_difference, contains_fe_index);
+    hp::Refinement::limit_p_level_difference(dofh,
+                                             max_difference,
+                                             contains_fe_index);
   tria.execute_coarsening_and_refinement();
 
   (void)fe_indices_changed;

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.