From 3b50dd0b3f5bf3d8f14c52ad0f26dbdb37aed786 Mon Sep 17 00:00:00 2001
From: Wolfgang Bangerth <bangerth@colostate.edu>
Date: Wed, 16 Nov 2016 20:58:15 -0700
Subject: [PATCH] Repeat the previous patch for the hp::DoFHandler.

---
 include/deal.II/hp/dof_handler.h | 19 ++++++++++++++++
 source/hp/dof_handler.cc         | 37 --------------------------------
 source/hp/dof_handler.inst.in    | 32 ---------------------------
 3 files changed, 19 insertions(+), 69 deletions(-)

diff --git a/include/deal.II/hp/dof_handler.h b/include/deal.II/hp/dof_handler.h
index c4ffd504bf..4b1b1fffd9 100644
--- a/include/deal.II/hp/dof_handler.h
+++ b/include/deal.II/hp/dof_handler.h
@@ -906,6 +906,25 @@ namespace hp
 
   /* ----------------------- Inline functions ---------------------------------- */
 
+
+  template <int dim, int spacedim>
+  template <typename number>
+  types::global_dof_index
+  DoFHandler<dim,spacedim>::n_boundary_dofs (const std::map<types::boundary_id, const Function<spacedim,number>*> &boundary_ids) const
+  {
+    // extract the set of boundary ids and forget about the function object pointers
+    std::set<types::boundary_id> boundary_ids_only;
+    for (typename std::map<types::boundary_id, const Function<spacedim,number>*>::const_iterator
+         p = boundary_ids.begin();
+         p != boundary_ids.end(); ++p)
+      boundary_ids_only.insert (p->first);
+
+    // then just hand everything over to the other function that does the work
+    return n_boundary_dofs(boundary_ids_only);
+  }
+
+
+
   template <int dim, int spacedim>
   template <class Archive>
   void DoFHandler<dim, spacedim>::save(Archive &ar, unsigned int) const
diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc
index 097e0ec4bb..c0bcf19470 100644
--- a/source/hp/dof_handler.cc
+++ b/source/hp/dof_handler.cc
@@ -1994,43 +1994,6 @@ namespace hp
 
 
 
-  template<int dim, int spacedim>
-  template<typename number>
-  types::global_dof_index
-  DoFHandler<dim,spacedim>::n_boundary_dofs (const std::map<types::boundary_id, const Function<spacedim,number>*> &boundary_ids) const
-  {
-    Assert (finite_elements != 0, ExcNoFESelected());
-    Assert (boundary_ids.find(numbers::internal_face_boundary_id) == boundary_ids.end(),
-            ExcInvalidBoundaryIndicator());
-
-    // same as above, but with
-    // additional checks for set of
-    // boundary indicators
-    std::set<types::global_dof_index> boundary_dofs;
-    std::vector<types::global_dof_index> dofs_on_face;
-    dofs_on_face.reserve (this->get_fe ().max_dofs_per_face());
-
-    typename HpDoFHandler<dim,spacedim>::active_cell_iterator cell = this->begin_active (),
-                                                              endc = this->end();
-    for (; cell!=endc; ++cell)
-      for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
-        if (cell->at_boundary(f) &&
-            (boundary_ids.find(cell->face(f)->boundary_id()) !=
-             boundary_ids.end()))
-          {
-            const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
-            dofs_on_face.resize (dofs_per_face);
-
-            cell->face(f)->get_dof_indices (dofs_on_face,
-                                            cell->active_fe_index());
-            for (unsigned int i=0; i<dofs_per_face; ++i)
-              boundary_dofs.insert(dofs_on_face[i]);
-          }
-    return boundary_dofs.size();
-  }
-
-
-
   template<int dim, int spacedim>
   types::global_dof_index
   DoFHandler<dim,spacedim>::n_boundary_dofs (const std::set<types::boundary_id> &boundary_ids) const
diff --git a/source/hp/dof_handler.inst.in b/source/hp/dof_handler.inst.in
index eac399e75d..97578352e9 100644
--- a/source/hp/dof_handler.inst.in
+++ b/source/hp/dof_handler.inst.in
@@ -13,38 +13,6 @@
 //
 // ---------------------------------------------------------------------
 
-for (scalar: REAL_SCALARS; deal_II_dimension : DIMENSIONS)
-{
-    namespace hp
-    \{
-    template types::global_dof_index DoFHandler<deal_II_dimension>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension,scalar>*> &boundary_ids) const;
-
-#if deal_II_dimension < 3
-    template types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+1>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension+1,scalar>*> &boundary_ids) const;
-#endif
-
-#if deal_II_dimension == 1
-    template types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+2>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension+2,scalar>*> &boundary_ids) const;
-#endif
-    \}
-}
-
-for (scalar: COMPLEX_SCALARS; deal_II_dimension : DIMENSIONS)
-{
-    namespace hp
-    \{
-    template types::global_dof_index DoFHandler<deal_II_dimension>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension,scalar>*> &boundary_ids) const;
-
-#if deal_II_dimension < 3
-    template types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+1>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension+1,scalar>*> &boundary_ids) const;
-#endif
-
-#if deal_II_dimension == 1
-    template types::global_dof_index DoFHandler<deal_II_dimension,deal_II_dimension+2>::n_boundary_dofs<scalar> (const std::map<types::boundary_id, const Function<deal_II_dimension+2,scalar>*> &boundary_ids) const;
-#endif
-    \}
-}
-
 
 for (deal_II_dimension : DIMENSIONS)
 {
-- 
2.39.5