From d7d243e57bec536462644e2b3b92ae4fc0f656d0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 16 Nov 2016 20:35:50 -0700 Subject: [PATCH] Move template function DoFHandler::n_boundary_dofs(). This function is currently in a .cc file, and the .inst.in file actually tries to instantiate it for all template arguments. Nonetheless, as #3599 shows, it is not instantiated appropriately. Rather than try to understand the exact cause, the easier solution is to just move the function to the .h file. It turns out to have a lot of code duplicated from the other function of same name, so shrink it down to the minimum and simply defer to the non-templated member function. --- include/deal.II/dofs/dof_handler.h | 19 +++++++++++++- source/dofs/dof_handler.cc | 41 +++--------------------------- source/dofs/dof_handler.inst.in | 28 -------------------- 3 files changed, 21 insertions(+), 67 deletions(-) diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index bb89fba363..046509edf0 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -1236,6 +1236,24 @@ DoFHandler::block_info () const } +template +template +types::global_dof_index +DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const +{ + // extract the set of boundary ids and forget about the function object pointers + std::set boundary_ids_only; + for (typename std::map*>::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); +} + + + namespace internal { /** @@ -1247,7 +1265,6 @@ namespace internal */ template std::string policy_to_string(const dealii::internal::DoFHandler::Policy::PolicyBase &policy); - } diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index d97af68e5b..2031a70fec 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 1998 - 2015 by the deal.II authors +// Copyright (C) 1998 - 2016 by the deal.II authors // // This file is part of the deal.II library. // @@ -1009,49 +1009,14 @@ types::global_dof_index DoFHandler::n_boundary_dofs () const -template -template -types::global_dof_index -DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const -{ - Assert (boundary_ids.find(numbers::internal_face_boundary_id) == boundary_ids.end(), - ExcInvalidBoundaryIndicator()); - - std::set boundary_dofs; - - const unsigned int dofs_per_face = get_fe().dofs_per_face; - std::vector dofs_on_face(dofs_per_face); - - // same as in the previous - // function, but with an additional - // check for the boundary indicator - active_cell_iterator cell = begin_active (), - endc = end(); - for (; cell!=endc; ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->at_boundary(f) - && - (boundary_ids.find(cell->face(f)->boundary_id()) != - boundary_ids.end())) - { - cell->face(f)->get_dof_indices (dofs_on_face); - for (unsigned int i=0; i +template types::global_dof_index DoFHandler::n_boundary_dofs (const std::set &boundary_ids) const { Assert (boundary_ids.find (numbers::internal_face_boundary_id) == boundary_ids.end(), ExcInvalidBoundaryIndicator()); - std::set boundary_dofs; + std::set boundary_dofs; const unsigned int dofs_per_face = get_fe().dofs_per_face; std::vector dofs_on_face(dofs_per_face); diff --git a/source/dofs/dof_handler.inst.in b/source/dofs/dof_handler.inst.in index cacf64f260..75aeba64f7 100644 --- a/source/dofs/dof_handler.inst.in +++ b/source/dofs/dof_handler.inst.in @@ -14,34 +14,6 @@ // --------------------------------------------------------------------- -for (scalar: REAL_SCALARS; deal_II_dimension : DIMENSIONS) -{ - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; - -#if deal_II_dimension < 3 - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; -#endif - -#if deal_II_dimension == 1 - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; -#endif - -} - -for (scalar: COMPLEX_SCALARS; deal_II_dimension : DIMENSIONS) -{ - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; - -#if deal_II_dimension < 3 - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; -#endif - -#if deal_II_dimension == 1 - template types::global_dof_index DoFHandler::n_boundary_dofs (const std::map*> &boundary_ids) const; -#endif - -} - for (deal_II_dimension : DIMENSIONS) { namespace internal -- 2.39.5