]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make instantiation of functions more uniform. 1959/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 7 Dec 2015 21:49:50 +0000 (15:49 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 7 Dec 2015 21:49:50 +0000 (15:49 -0600)
Specifically, allow the script to also instantiate for parallel distributed
and shared Triangulation classes. This also allows to significantly
simplify the list of explicit instantiations for GridTools.

cmake/config/template-arguments.in
doc/news/changes.h
source/grid/grid_generator.cc
source/grid/grid_tools.inst.in
source/grid/intergrid_map.cc

index a28f358e9203963d63d9b5c34b762a1f1fc29adf..15e46dc7b7fd823e3d1ecaab1aad0f5bf915b1f0 100644 (file)
@@ -70,10 +70,18 @@ DOFHANDLER_TEMPLATES := { DoFHandler;
                           hp::DoFHandler }
 
 TRIANGULATION_AND_DOFHANDLER_TEMPLATES := { Triangulation;
+                                            parallel::shared::Triangulation;
+                                            parallel::distributed::Triangulation;
                                             DoFHandler;
                                             hp::DoFHandler }
 
+SEQUENTIAL_TRIANGULATION_AND_DOFHANDLERS := { Triangulation<deal_II_dimension, deal_II_space_dimension>;
+                                              DoFHandler<deal_II_dimension, deal_II_space_dimension>;
+                                              hp::DoFHandler<deal_II_dimension, deal_II_space_dimension> }
+
 TRIANGULATION_AND_DOFHANDLERS := { Triangulation<deal_II_dimension, deal_II_space_dimension>;
+                                   parallel::shared::Triangulation<deal_II_dimension, deal_II_space_dimension>;
+                                   parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension>;
                                    DoFHandler<deal_II_dimension, deal_II_space_dimension>;
                                    hp::DoFHandler<deal_II_dimension, deal_II_space_dimension> }
 
index adc6b2400bb49be6b715ed3383dc1d09d776ec20..fc61369fc351d281d0b2bf80f12566793905c7ce 100644 (file)
@@ -482,7 +482,15 @@ inconvenience this causes.
 
 
 <ol>
-  <li> Improved: both versions of distribute_sparsity_pattern are now plain, not
+  <li> Improved: Many more functions in namespace GridTools and class
+  InterGridMap are now consistely instantiated also for types
+  parallel::distributed::Triangulation and parallel::shared::Triangulation.
+  <br>
+  (Wolfgang Bangerth, 2015/12/07)
+  </li>
+
+  <li> Improved: Both versions of SparsityTools::distribute_sparsity_pattern()
+  are now plain, not
   template, functions. This is not a breaking change because each function was
   instantiated for exactly one template argument.
   <br>
index d6d7768b919a66b7bd2d3b2d882df7facbfb075a..5dacc7aed3a682c599086cb0e93d85959c48a923 100644 (file)
@@ -23,6 +23,7 @@
 #include <deal.II/grid/intergrid_map.h>
 
 #include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/shared_tria.h>
 
 #include <iostream>
 #include <cmath>
@@ -4147,6 +4148,13 @@ namespace GridGenerator
       return tria;
     }
 
+    template<int dim, int spacedim>
+    const Triangulation<dim, spacedim> &
+    get_tria(const parallel::shared::Triangulation<dim, spacedim> &tria)
+    {
+      return tria;
+    }
+
     template<int dim, template<int, int> class Container, int spacedim>
     const Triangulation<dim,spacedim> &
     get_tria(const Container<dim,spacedim> &container)
@@ -4169,6 +4177,13 @@ namespace GridGenerator
       return tria;
     }
 
+    template<int dim, int spacedim>
+    Triangulation<dim, spacedim> &
+    get_tria(parallel::shared::Triangulation<dim, spacedim> &tria)
+    {
+      return tria;
+    }
+
     template<int dim, template<int, int> class Container, int spacedim>
     const Triangulation<dim,spacedim> &
     get_tria(Container<dim,spacedim> &container)
index 895ec9c46f848158e41e886e2f1ad64756026a11..dbb8abb26ebaa808b076365c26f4411fe97d6753 100644 (file)
@@ -52,7 +52,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II
   template
     std::list<std::pair<X::cell_iterator, X::cell_iterator> >
     get_finest_common_cells (const X &mesh_1,
-                               const X &mesh_2);
+                             const X &mesh_2);
 
 
   template
@@ -65,76 +65,16 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II
   #endif
 }
 
-// now also instantiate these functions for parallel::shared::Triangulation
+// now also instantiate a few additional functions for parallel::distributed::Triangulation
 for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS)
 {
 
 #if deal_II_dimension <= deal_II_space_dimension
   namespace GridTools \{
 
-  template
-    std::vector<dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::shared::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type>
-    compute_active_cell_halo_layer (const parallel::shared::Triangulation<deal_II_dimension, deal_II_space_dimension> &,
-                                    const std_cxx11::function<bool (const dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension,
-                                                                                                               parallel::shared::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type&)> &);
-  \}
-
-#endif
-}
-
-
-// now also instantiate these functions for parallel::distributed::Triangulation
-for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS)
-{
-
-#if deal_II_dimension <= deal_II_space_dimension
-  namespace GridTools \{
-
-  template
-    unsigned int
-    find_closest_vertex (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
-                         const Point<deal_II_space_dimension> &);
-
-  template
-    std::vector<dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type>
-    find_cells_adjacent_to_vertex(const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
-                                  const unsigned int);
-  template
-    dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type
-    find_active_cell_around_point (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
-                                   const Point<deal_II_space_dimension> &p);
-
-  template
-    std::pair<dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type, Point<deal_II_dimension> >
-    find_active_cell_around_point (const Mapping<deal_II_dimension, deal_II_space_dimension> &,
-                                   const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &,
-                                   const Point<deal_II_space_dimension> &);
-
-  template
-    std::vector<dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type>
-    compute_active_cell_halo_layer (const parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> &,
-                                    const std_cxx11::function<bool (const dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension,
-                                                                                                               parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type&)> &);
-
-  template
-    std::vector<dealii::internal::ActiveCellIterator<deal_II_dimension, deal_II_space_dimension, parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> >::type>
-    compute_ghost_cell_halo_layer (const parallel::distributed::Triangulation<deal_II_dimension, deal_II_space_dimension> &);
-
   template
   std::map<unsigned int,types::global_vertex_index>
   compute_local_to_global_vertex_index_map(const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &triangulation);
-
-  template
-    std::list<std::pair<parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::cell_iterator, parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension>::cell_iterator> >
-    get_finest_common_cells (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_1,
-                               const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_2);
-
-
-  template
-    bool
-    have_same_coarse_mesh (const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_1,
-                           const parallel::distributed::Triangulation<deal_II_dimension,deal_II_space_dimension> &mesh_2);
-
   \}
 
   #endif
@@ -301,7 +241,13 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
   }
 
 
-for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS)
+// instantiate the following functions only for the "sequential" containers. this
+// is a misnomer here, however: the point is simply that we only instantiate
+// these functions for certain *iterator* types, and the iterator types are
+// the same for sequential and parallel containers; consequently, we get duplicate
+// instantiation errors if we instantiate for *all* container types, rather than
+// only the sequential ones
+for (X : SEQUENTIAL_TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS)
 {
 #if deal_II_dimension <= deal_II_space_dimension
   namespace GridTools \{
index 8b10811c7ac9afd3d7326c0e627045dd3ff7ea38..d85bfab590210ca36a1855f431a91c00924681d2 100644 (file)
@@ -22,6 +22,8 @@
 #include <deal.II/dofs/dof_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
 #include <deal.II/grid/intergrid_map.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/distributed/shared_tria.h>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -45,7 +47,7 @@ namespace
   }
 
 
-// specialization for grid==tria
+// specialization for triangulation classes
   template <int dim, int spacedim>
   unsigned int
   get_n_levels (const Triangulation<dim, spacedim> &grid)
@@ -54,6 +56,24 @@ namespace
     // we can ask directly.
     return grid.n_levels();
   }
+
+  template <int dim, int spacedim>
+  unsigned int
+  get_n_levels (const parallel::distributed::Triangulation<dim, spacedim> &grid)
+  {
+    // if GridClass==Triangulation, then
+    // we can ask directly.
+    return grid.n_levels();
+  }
+
+  template <int dim, int spacedim>
+  unsigned int
+  get_n_levels (const parallel::shared::Triangulation<dim, spacedim> &grid)
+  {
+    // if GridClass==Triangulation, then
+    // we can ask directly.
+    return grid.n_levels();
+  }
 }
 
 

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.