From: wolf Date: Fri, 25 Aug 2000 14:36:04 +0000 (+0000) Subject: Change some args from maps to lists, and add a new n_boundary_dofs function to DoFHan... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b643a5a12c19347a4b07b04e3a5bc62e4d8532e;p=dealii-svn.git Change some args from maps to lists, and add a new n_boundary_dofs function to DoFHandler. git-svn-id: https://svn.dealii.org/trunk@3274 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index e4efb28af0..1770c7d84e 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -956,15 +957,31 @@ class DoFHandler : public Subscriptor, unsigned int n_boundary_dofs () const; /** - * Return the number of degrees of freedom - * located on those parts of the boundary - * which have a boundary indicator listed - * in the given set. The reason that a - * @p{map} rather than a @p{set} is used is the - * same as descibed in the section on the - * @p{make_boundary_sparsity_pattern} function. - */ - unsigned int n_boundary_dofs (const FunctionMap &boundary_indicators) const; + * Return the number of degrees + * of freedom located on those + * parts of the boundary which + * have a boundary indicator + * listed in the given set. The + * reason that a @p{map} rather + * than a @p{set} is used is the + * same as descibed in the + * section on the + * @p{make_boundary_sparsity_pattern} + * function. + */ + unsigned int + n_boundary_dofs (const FunctionMap &boundary_indicators) const; + + /** + * Same function, but with + * different data type of the + * argument, which is here simply + * a list of the boundary + * indicators under + * consideration. + */ + unsigned int + n_boundary_dofs (const list &boundary_indicators) const; /** * Return a constant reference to the diff --git a/deal.II/deal.II/include/dofs/dof_tools.h b/deal.II/deal.II/include/dofs/dof_tools.h index 9db6997882..1786321975 100644 --- a/deal.II/deal.II/include/dofs/dof_tools.h +++ b/deal.II/deal.II/include/dofs/dof_tools.h @@ -16,7 +16,7 @@ #include #include -#include +#include class SparsityPattern; template class Vector; @@ -801,7 +801,8 @@ class DoFTools * numbers of the trial functions * local to the boundary. * - * Prior content of @p{mapping} is deleted. + * Prior content of @p{mapping} + * is deleted. * * This function is not * implemented for one @@ -816,18 +817,21 @@ class DoFTools vector &mapping); /** - * Same as the previous function, except - * that only selected parts of the - * boundary are considered. + * Same as the previous function, + * except that only those parts + * of the boundary are considered + * for which the boundary + * indicator is listed in the + * second argument. * - * See the general doc of this class for - * more information. + * See the general doc of this + * class for more information. */ template static void - map_dof_to_boundary_indices (const DoFHandler &dof_handler, - const map*> &boundary_indicators, - vector &mapping); + map_dof_to_boundary_indices (const DoFHandler &dof_handler, + const list &boundary_indicators, + vector &mapping); /** diff --git a/deal.II/deal.II/source/dofs/dof_handler.cc b/deal.II/deal.II/source/dofs/dof_handler.cc index 74e1f23c88..af6ae3d4f3 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1127,15 +1127,28 @@ DoFHandler::last_active_hex () const { #if deal_II_dimension == 1 template <> -unsigned int DoFHandler<1>::n_boundary_dofs () const { +unsigned int DoFHandler<1>::n_boundary_dofs () const +{ Assert (selected_fe != 0, ExcNoFESelected()); Assert (false, ExcNotImplemented()); return 0; }; + template <> -unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const { +unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const +{ + Assert (selected_fe != 0, ExcNoFESelected()); + Assert (false, ExcNotImplemented()); + return 0; +}; + + + +template <> +unsigned int DoFHandler<1>::n_boundary_dofs (const list &) const +{ Assert (selected_fe != 0, ExcNoFESelected()); Assert (false, ExcNotImplemented()); return 0; @@ -1145,7 +1158,8 @@ unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const { template -unsigned int DoFHandler::n_boundary_dofs () const { +unsigned int DoFHandler::n_boundary_dofs () const +{ Assert (selected_fe != 0, ExcNoFESelected()); set boundary_dofs; @@ -1165,8 +1179,11 @@ unsigned int DoFHandler::n_boundary_dofs () const { }; + template -unsigned int DoFHandler::n_boundary_dofs (const FunctionMap &boundary_indicators) const { +unsigned int +DoFHandler::n_boundary_dofs (const FunctionMap &boundary_indicators) const +{ Assert (selected_fe != 0, ExcNoFESelected()); Assert (boundary_indicators.find(255) == boundary_indicators.end(), ExcInvalidBoundaryIndicator()); @@ -1189,12 +1206,47 @@ unsigned int DoFHandler::n_boundary_dofs (const FunctionMap &boundary_indic }; + template -const Triangulation & DoFHandler::get_tria () const { +unsigned int +DoFHandler::n_boundary_dofs (const list &boundary_indicators) const +{ + Assert (selected_fe != 0, ExcNoFESelected()); + Assert (find (boundary_indicators.begin(), + boundary_indicators.end(), + 255) == + boundary_indicators.end(), + ExcInvalidBoundaryIndicator()); + + set boundary_dofs; + + const unsigned int dofs_per_face = selected_fe->dofs_per_face; + vector dofs_on_face(dofs_per_face); + active_face_iterator face = begin_active_face (), + endf = end_face(); + for (; face!=endf; ++face) + if (find (boundary_indicators.begin(), + boundary_indicators.end(), + face->boundary_indicator()) != + boundary_indicators.end()) + { + face->get_dof_indices (dofs_on_face); + for (unsigned int i=0; i +const Triangulation & DoFHandler::get_tria () const +{ return *tria; }; + template void DoFHandler::distribute_dofs (const FiniteElement &ff, const unsigned int offset) diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index 883f07c8b2..bc5f965742 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -1489,7 +1489,7 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler<1> &dof_handler, template <> void DoFTools::map_dof_to_boundary_indices (const DoFHandler<1> &dof_handler, - const map*> &, + const list &, vector &) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); @@ -1532,12 +1532,15 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, template -void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, - const map*> &boundary_indicators, - vector &mapping) +void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, + const list &boundary_indicators, + vector &mapping) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); - Assert (boundary_indicators.find(255) == boundary_indicators.end(), + Assert (find (boundary_indicators.begin(), + boundary_indicators.end(), + 255) == + boundary_indicators.end(), ExcInvalidBoundaryIndicator()); mapping.clear (); @@ -1555,7 +1558,9 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, typename DoFHandler::active_face_iterator face = dof_handler.begin_active_face(), endf = dof_handler.end_face(); for (; face!=endf; ++face) - if (boundary_indicators.find(face->boundary_indicator()) != + if (find (boundary_indicators.begin(), + boundary_indicators.end(), + face->boundary_indicator()) != boundary_indicators.end()) { face->get_dof_indices (dofs_on_face); @@ -1670,7 +1675,7 @@ DoFTools::map_dof_to_boundary_indices (const DoFHandler &, template void DoFTools::map_dof_to_boundary_indices (const DoFHandler &, - const map*> &, + const list &, vector &); #endif diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 537691b178..c05789f9d9 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -719,7 +719,13 @@ VectorTools::project_boundary_values (const DoFHandler &dof, ExcComponentMismatch()); vector dof_to_boundary_mapping; - DoFTools::map_dof_to_boundary_indices (dof, boundary_functions, + list selected_boundary_components; + for (typename map*>::const_iterator + i=boundary_functions.begin(); + i!=boundary_functions.end(); ++i) + selected_boundary_components.push_back (i->first); + + DoFTools::map_dof_to_boundary_indices (dof, selected_boundary_components, dof_to_boundary_mapping); // set up sparsity structure diff --git a/deal.II/doc/news/2000/c-3-0.html b/deal.II/doc/news/2000/c-3-0.html index 0edd600ce1..a4eee346d3 100644 --- a/deal.II/doc/news/2000/c-3-0.html +++ b/deal.II/doc/news/2000/c-3-0.html @@ -402,6 +402,17 @@

deal.II

    +
  1. + New: There is now a function + DoFHandler::n_boundary_dofs + that takes the list of selected boundary indicators as a + list of values, rather than the + usual map of pairs of boundary + indicators and function object pointers. +
    + (WB 2000/08/25) +

    +
  2. Changed: The map_dof_to_boundary_index