]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Change list<> to set<> at some places. Add new parameter to DoFTools::extract_boundar...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Dec 2000 16:26:29 +0000 (16:26 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Dec 2000 16:26:29 +0000 (16:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@3522 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/include/dofs/dof_tools.h
deal.II/deal.II/source/dofs/dof_handler.cc
deal.II/deal.II/source/dofs/dof_tools.cc
deal.II/deal.II/source/numerics/vectors.cc
deal.II/doc/news/2000/c-3-0.html

index 4fcd1af23df1de4cba01a8dc8abcafa0dd6e690c..29cd837b90c638602c93179147741521b55f64a5 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <vector>
 #include <map>
-#include <list>
+#include <set>
 #include <base/exceptions.h>
 #include <base/smartpointer.h>
 
@@ -984,7 +984,7 @@ class DoFHandler  :  public Subscriptor,
                                      * consideration.
                                      */
     unsigned int
-    n_boundary_dofs (const list<unsigned char> &boundary_indicators) const;
+    n_boundary_dofs (const set<unsigned char> &boundary_indicators) const;
 
                                     /**
                                      * Return a constant reference to the
index 4b4e169ed5c3e5039b9a57a5fa618dd8473562cb..f1caa874d92b5296948f15c328272969f7a9cb3a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <base/exceptions.h>
 #include <vector>
-#include <list>
+#include <set>
 
 class SparsityPattern;
 template <typename number> 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<dim> &dof_handler,
                           const vector<bool>    &component_select,
-                          vector<bool>          &selected_dofs);
+                          vector<bool>          &selected_dofs,
+                          const set<unsigned char> &boundary_indicators = set<unsigned char>());
 
                                     /**
                                      * Select all dofs that will be
@@ -829,9 +842,9 @@ class DoFTools
                                      */
     template <int dim>
     static void
-    map_dof_to_boundary_indices (const DoFHandler<dim>     &dof_handler,
-                                const list<unsigned char> &boundary_indicators,
-                                vector<unsigned int>      &mapping);
+    map_dof_to_boundary_indices (const DoFHandler<dim>    &dof_handler,
+                                const set<unsigned char> &boundary_indicators,
+                                vector<unsigned int>     &mapping);
     
                                   
                                     /**
index 5fb6a07912539795adde9eb0c6c9184a77b36017..8a341bd9790f51adf99ecc39e1c82aeec1755e7b 100644 (file)
@@ -1154,7 +1154,7 @@ unsigned int DoFHandler<1>::n_boundary_dofs (const FunctionMap &) const
 
 
 template <>
-unsigned int DoFHandler<1>::n_boundary_dofs (const list<unsigned char> &) const
+unsigned int DoFHandler<1>::n_boundary_dofs (const set<unsigned char> &) const
 {
   Assert (selected_fe != 0, ExcNoFESelected());
   Assert (false, ExcNotImplemented());
@@ -1216,13 +1216,10 @@ DoFHandler<dim>::n_boundary_dofs (const FunctionMap &boundary_indicators) const
 
 template <int dim>
 unsigned int
-DoFHandler<dim>::n_boundary_dofs (const list<unsigned char> &boundary_indicators) const
+DoFHandler<dim>::n_boundary_dofs (const set<unsigned char> &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<int> boundary_dofs;
index 1feec931a0abc646ef3381766031bc7ede7842dc..1a9d46969b4b110820a5f20e30bb987c62cf9388 100644 (file)
@@ -823,12 +823,21 @@ template <int dim>
 void
 DoFTools::extract_boundary_dofs (const DoFHandler<dim> &dof_handler,
                                 const vector<bool>    &component_select,
-                                vector<bool>          &selected_dofs)
+                                vector<bool>          &selected_dofs,
+                                const set<unsigned char> &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<dim> &dof_handler,
        cell!=dof_handler.end(); ++cell)
     for (unsigned int face=0; face<GeometryInfo<dim>::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.get_fe().dofs_per_face; ++i)
@@ -1583,7 +1595,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 list<unsigned char> &,
+                                           const set<unsigned char> &,
                                            vector<unsigned int> &)
 {
   Assert (&dof_handler.get_fe() != 0, ExcNoFESelected());
@@ -1626,15 +1638,12 @@ void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim> &dof_handler,
 
 
 template <int dim>
-void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim>     &dof_handler,
-                                           const list<unsigned char> &boundary_indicators,
-                                           vector<unsigned int>      &mapping)
+void DoFTools::map_dof_to_boundary_indices (const DoFHandler<dim>    &dof_handler,
+                                           const set<unsigned char> &boundary_indicators,
+                                           vector<unsigned int>     &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<dim>     &dof_handl
   typename DoFHandler<dim>::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<deal_II_dimension> &,
 template
 void
 DoFTools::map_dof_to_boundary_indices (const DoFHandler<deal_II_dimension> &,
-                                      const list<unsigned char> &,
+                                      const set<unsigned char> &,
                                       vector<unsigned int> &);
 
 #endif 
index c05789f9d9f16fa751ab97f5b4338224df613a4d..0b31df47f32908d353a8952d4a58db25f9868727 100644 (file)
@@ -719,11 +719,11 @@ VectorTools::project_boundary_values (const DoFHandler<dim>    &dof,
          ExcComponentMismatch());
   
   vector<unsigned int> dof_to_boundary_mapping;
-  list<unsigned char> selected_boundary_components;
+  set<unsigned char> selected_boundary_components;
   for (typename map<unsigned char,const Function<dim>*>::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);
index b7885f62c8be51d55ee21005f509a266217b81e2..2b04a0a1362d35a3b5827cfe90946677edc03ef7 100644 (file)
@@ -514,6 +514,28 @@ documentation, etc</a>.
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       Extend: <code class="member">DoFTools::extract_boundary_dofs</code>
+       now allows to also specify which boundary conditions shall be
+       considered. 
+       <br>
+       (WB 2000/12/04)
+       </p>
+
+  <li> <p>
+       New: some arguments of the functions 
+       <code class="member">DoFHandler::n_boundary_dofs</code>,
+       <code class="member">DoFTools::extract_boundary_dofs</code>,
+       and
+       <code class="member">DoFTools::map_dof_to_boundary_indices</code> 
+       are changed from <code class="class">list</code> to
+       <code class="class">set</code>, since that resembles more
+       closely the purpose of the parameter, and makes computations
+       slightly faster.
+       <br>
+       (WB 2000/12/04)
+       </p>
+
   <li> <p>
        New: almost all classes that store data now have a function
        <code class="member">memory_consumption</code> that returns an

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.