]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Instantiate a GridTools function for dim = 1. 12486/head
authorDavid Wells <drwells@email.unc.edu>
Tue, 22 Jun 2021 14:41:10 +0000 (10:41 -0400)
committerDavid Wells <drwells@email.unc.edu>
Thu, 24 Jun 2021 12:29:43 +0000 (08:29 -0400)
This requires special-casing p::d::T since the internal functions aren't defined
for 1D.

source/grid/grid_tools.cc
source/grid/grid_tools.inst.in

index 7b973c2f3688c1dd27035e6179483288de8e5549..8860abe4e7c3a7a5d758d70e74600750cdaf65fd 100644 (file)
@@ -4128,28 +4128,24 @@ namespace GridTools
       }
   }
 
-
-
-  template <int dim, int spacedim>
-  std::vector<types::subdomain_id>
-  get_subdomain_association(const Triangulation<dim, spacedim> &triangulation,
-                            const std::vector<CellId> &         cell_ids)
+  namespace internal
   {
-    std::vector<types::subdomain_id> subdomain_ids;
-    subdomain_ids.reserve(cell_ids.size());
-
-    if (dynamic_cast<
-          const parallel::fullydistributed::Triangulation<dim, spacedim> *>(
-          &triangulation) != nullptr)
-      {
-        Assert(false, ExcNotImplemented());
-      }
-    else if (const parallel::distributed::Triangulation<dim, spacedim>
-               *parallel_tria = dynamic_cast<
-                 const parallel::distributed::Triangulation<dim, spacedim> *>(
-                 &triangulation))
+    namespace
+    {
+      // Split get_subdomain_association() for p::d::T since we want to compile
+      // it in 1D but none of the p4est stuff is available in 1D.
+      template <int dim, int spacedim>
+      void
+      get_subdomain_association(
+        const parallel::distributed::Triangulation<dim, spacedim>
+          &                               triangulation,
+        const std::vector<CellId> &       cell_ids,
+        std::vector<types::subdomain_id> &subdomain_ids)
       {
 #ifndef DEAL_II_WITH_P4EST
+        (void)triangulation;
+        (void)cell_ids;
+        (void)subdomain_ids;
         Assert(
           false,
           ExcMessage(
@@ -4179,11 +4175,11 @@ namespace GridTools
             const int owner =
               dealii::internal::p4est::functions<dim>::comm_find_owner(
                 const_cast<typename dealii::internal::p4est::types<dim>::forest
-                             *>(parallel_tria->get_p4est()),
+                             *>(triangulation.get_p4est()),
                 cell_id.get_coarse_cell_id(),
                 &p4est_cell,
                 Utilities::MPI::this_mpi_process(
-                  parallel_tria->get_communicator()));
+                  triangulation.get_communicator()));
 
             Assert(owner >= 0, ExcMessage("p4est should know the owner."));
 
@@ -4191,6 +4187,46 @@ namespace GridTools
           }
 #endif
       }
+
+
+
+      template <int spacedim>
+      void
+      get_subdomain_association(
+        const parallel::distributed::Triangulation<1, spacedim> &,
+        const std::vector<CellId> &,
+        std::vector<types::subdomain_id> &)
+      {
+        Assert(false, ExcNotImplemented());
+      }
+    } // anonymous namespace
+  }   // namespace internal
+
+
+
+  template <int dim, int spacedim>
+  std::vector<types::subdomain_id>
+  get_subdomain_association(const Triangulation<dim, spacedim> &triangulation,
+                            const std::vector<CellId> &         cell_ids)
+  {
+    std::vector<types::subdomain_id> subdomain_ids;
+    subdomain_ids.reserve(cell_ids.size());
+
+    if (dynamic_cast<
+          const parallel::fullydistributed::Triangulation<dim, spacedim> *>(
+          &triangulation) != nullptr)
+      {
+        Assert(false, ExcNotImplemented());
+      }
+    else if (const parallel::distributed::Triangulation<dim, spacedim>
+               *parallel_tria = dynamic_cast<
+                 const parallel::distributed::Triangulation<dim, spacedim> *>(
+                 &triangulation))
+      {
+        internal::get_subdomain_association(*parallel_tria,
+                                            cell_ids,
+                                            subdomain_ids);
+      }
     else if (const parallel::shared::Triangulation<dim, spacedim> *shared_tria =
                dynamic_cast<const parallel::shared::Triangulation<dim, spacedim>
                               *>(&triangulation))
index 57d21677f4e113ed19a38f5d2c78a3e74b0b58da..74725e781a413e2f8924e13a4f15b85e25131d3f 100644 (file)
@@ -342,12 +342,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
       partition_multigrid_levels(
         Triangulation<deal_II_dimension, deal_II_space_dimension> &);
 
-#  if deal_II_dimension >= 2
       template std::vector<types::subdomain_id>
       get_subdomain_association(
         const Triangulation<deal_II_dimension, deal_II_space_dimension> &,
         const std::vector<CellId> &);
-#  endif
 
       template void
       get_subdomain_association(

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.