From d235f3c70451cc1576f000fb96d6be596324411d Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 4 Dec 2000 16:26:29 +0000 Subject: [PATCH] Change list<> to set<> at some places. Add new parameter to DoFTools::extract_boundary_dofs. git-svn-id: https://svn.dealii.org/trunk@3522 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_handler.h | 4 +-- deal.II/deal.II/include/dofs/dof_tools.h | 31 ++++++++++++++------ deal.II/deal.II/source/dofs/dof_handler.cc | 9 ++---- deal.II/deal.II/source/dofs/dof_tools.cc | 33 +++++++++++++--------- deal.II/deal.II/source/numerics/vectors.cc | 4 +-- deal.II/doc/news/2000/c-3-0.html | 22 +++++++++++++++ 6 files changed, 71 insertions(+), 32 deletions(-) diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 4fcd1af23d..29cd837b90 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -984,7 +984,7 @@ class DoFHandler : public Subscriptor, * consideration. */ unsigned int - n_boundary_dofs (const list &boundary_indicators) const; + n_boundary_dofs (const set &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 4b4e169ed5..f1caa874d9 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; @@ -514,13 +514,25 @@ class DoFTools * belong to specified components * of the solution. The function * returns its results in the - * last parameter which contains - * @p{true} is a degree of freedom - * is at the boundary and belongs - * to one of the selected + * last non-default-valued + * parameter which contains + * @p{true} if a degree of + * freedom is at the boundary and + * belongs to one of the selected * components, and @p{false} * otherwise. * + * By specifying the + * @p{boundary_indicator} + * variable, you can select which + * boundary indicators the faces + * have to have on which the + * degrees of freedom are located + * that shall be extracted. If it + * is an empty list, then all + * boundary indicators are + * accepted. + * * The size of @p{component_select} * shall equal the number of * components in the finite @@ -535,7 +547,8 @@ class DoFTools static void extract_boundary_dofs (const DoFHandler &dof_handler, const vector &component_select, - vector &selected_dofs); + vector &selected_dofs, + const set &boundary_indicators = set()); /** * Select all dofs that will be @@ -829,9 +842,9 @@ class DoFTools */ template static void - map_dof_to_boundary_indices (const DoFHandler &dof_handler, - const list &boundary_indicators, - vector &mapping); + map_dof_to_boundary_indices (const DoFHandler &dof_handler, + const set &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 5fb6a07912..8a341bd979 100644 --- a/deal.II/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/deal.II/source/dofs/dof_handler.cc @@ -1154,7 +1154,7 @@ unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const template <> -unsigned int DoFHandler<1>::n_boundary_dofs (const list &) const +unsigned int DoFHandler<1>::n_boundary_dofs (const set &) const { Assert (selected_fe != 0, ExcNoFESelected()); Assert (false, ExcNotImplemented()); @@ -1216,13 +1216,10 @@ DoFHandler::n_boundary_dofs (const FunctionMap &boundary_indicators) const template unsigned int -DoFHandler::n_boundary_dofs (const list &boundary_indicators) const +DoFHandler::n_boundary_dofs (const set &boundary_indicators) const { Assert (selected_fe != 0, ExcNoFESelected()); - Assert (find (boundary_indicators.begin(), - boundary_indicators.end(), - 255) == - boundary_indicators.end(), + Assert (boundary_indicators.find (255) == boundary_indicators.end(), ExcInvalidBoundaryIndicator()); set boundary_dofs; diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index 1feec931a0..1a9d46969b 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -823,12 +823,21 @@ template void DoFTools::extract_boundary_dofs (const DoFHandler &dof_handler, const vector &component_select, - vector &selected_dofs) + vector &selected_dofs, + const set &boundary_indicators) { Assert (component_select.size() == dof_handler.get_fe().n_components(), ExcWrongSize (component_select.size(), dof_handler.get_fe().n_components())); + Assert (boundary_indicators.find (255) == boundary_indicators.end(), + ExcInvalidBoundaryIndicator()); + // let's see whether we have to + // check for certain boundary + // indicators or whether we can + // accept all + const bool check_boundary_indicator = (boundary_indicators.size() != 0); + // clear and reset array by default // values selected_dofs.clear (); @@ -838,6 +847,9 @@ DoFTools::extract_boundary_dofs (const DoFHandler &dof_handler, cell!=dof_handler.end(); ++cell) for (unsigned int face=0; face::faces_per_cell; ++face) if (cell->at_boundary(face)) + if (! check_boundary_indicator || + (boundary_indicators.find (cell->face(face)->boundary_indicator()) + != boundary_indicators.end())) { cell->face(face)->get_dof_indices (face_dof_indices); for (unsigned int i=0; i &dof_handler, template <> void DoFTools::map_dof_to_boundary_indices (const DoFHandler<1> &dof_handler, - const list &, + const set &, vector &) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); @@ -1626,15 +1638,12 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, template -void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, - const list &boundary_indicators, - vector &mapping) +void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handler, + const set &boundary_indicators, + vector &mapping) { Assert (&dof_handler.get_fe() != 0, ExcNoFESelected()); - Assert (find (boundary_indicators.begin(), - boundary_indicators.end(), - 255) == - boundary_indicators.end(), + Assert (boundary_indicators.find (255) == boundary_indicators.end(), ExcInvalidBoundaryIndicator()); mapping.clear (); @@ -1652,9 +1661,7 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler &dof_handl typename DoFHandler::active_face_iterator face = dof_handler.begin_active_face(), endf = dof_handler.end_face(); for (; face!=endf; ++face) - if (find (boundary_indicators.begin(), - boundary_indicators.end(), - face->boundary_indicator()) != + if (boundary_indicators.find (face->boundary_indicator()) != boundary_indicators.end()) { face->get_dof_indices (dofs_on_face); @@ -1761,7 +1768,7 @@ DoFTools::map_dof_to_boundary_indices (const DoFHandler &, template void DoFTools::map_dof_to_boundary_indices (const DoFHandler &, - const list &, + const set &, vector &); #endif diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index c05789f9d9..0b31df47f3 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -719,11 +719,11 @@ VectorTools::project_boundary_values (const DoFHandler &dof, ExcComponentMismatch()); vector dof_to_boundary_mapping; - list selected_boundary_components; + set selected_boundary_components; for (typename map*>::const_iterator i=boundary_functions.begin(); i!=boundary_functions.end(); ++i) - selected_boundary_components.push_back (i->first); + selected_boundary_components.insert (i->first); DoFTools::map_dof_to_boundary_indices (dof, selected_boundary_components, dof_to_boundary_mapping); diff --git a/deal.II/doc/news/2000/c-3-0.html b/deal.II/doc/news/2000/c-3-0.html index b7885f62c8..2b04a0a136 100644 --- a/deal.II/doc/news/2000/c-3-0.html +++ b/deal.II/doc/news/2000/c-3-0.html @@ -514,6 +514,28 @@ documentation, etc.

deal.II

    +
  1. + Extend: DoFTools::extract_boundary_dofs + now allows to also specify which boundary conditions shall be + considered. +
    + (WB 2000/12/04) +

    + +
  2. + New: some arguments of the functions + DoFHandler::n_boundary_dofs, + DoFTools::extract_boundary_dofs, + and + DoFTools::map_dof_to_boundary_indices + are changed from list to + set, since that resembles more + closely the purpose of the parameter, and makes computations + slightly faster. +
    + (WB 2000/12/04) +

    +
  3. New: almost all classes that store data now have a function memory_consumption that returns an -- 2.39.5