]> https://gitweb.dealii.org/ - dealii.git/commitdiff
replace get_boundary_indices
authorTimo Heister <timo.heister@gmail.com>
Sat, 27 Jun 2015 12:19:55 +0000 (08:19 -0400)
committerTimo Heister <timo.heister@gmail.com>
Tue, 30 Jun 2015 14:46:11 +0000 (10:46 -0400)
use IndexSet instead

include/deal.II/multigrid/mg_constrained_dofs.h

index b9ef4e070168e2df64ca928fe1d59a277bdda087..0ee24682b749872e9203e224b621366d3fc6021f 100644 (file)
@@ -89,7 +89,13 @@ public:
    * constraints.
    */
   const std::vector<std::set<types::global_dof_index> > &
-  get_boundary_indices () const;
+  get_boundary_indices () const DEAL_II_DEPRECATED;
+
+  /**
+   * Return the indices of dofs for each level that are subject to boundary constraints.
+   */
+  const IndexSet &
+  get_boundary_indices (const unsigned int level) const;
 
   /**
    * @deprecated Use at_refinement_edge() if possible, else
@@ -133,7 +139,12 @@ public:
   /**
    * The indices of boundary dofs for each level.
    */
-  std::vector<std::set<types::global_dof_index> > boundary_indices;
+  std::vector<IndexSet> boundary_indices;
+
+  /**
+   * old data structure only filled on demand
+   */
+  mutable std::vector<std::set<types::global_dof_index> > boundary_indices_old;
 
   /**
    * The degrees of freedom on the refinement edge between a level and coarser
@@ -216,7 +227,7 @@ MGConstrainedDoFs::is_boundary_index (const unsigned int level,
     return false;
 
   AssertIndexRange(level, boundary_indices.size());
-  return (boundary_indices[level].find(index) != boundary_indices[level].end());
+  return boundary_indices[level].is_element(index);
 }
 
 inline
@@ -234,9 +245,29 @@ inline
 const std::vector<std::set<types::global_dof_index> > &
 MGConstrainedDoFs::get_boundary_indices () const
 {
-  return boundary_indices;
+  if (boundary_indices_old.size()!=boundary_indices.size())
+  {
+    boundary_indices_old.resize(boundary_indices.size());
+    for (unsigned int l=0;l<boundary_indices.size(); ++l)
+      {
+        std::vector<types::global_dof_index> tmp;
+        boundary_indices[l].fill_index_vector(tmp);
+        boundary_indices_old[l].insert(tmp.begin(), tmp.end());
+      }
+  }
+  return boundary_indices_old;
 }
 
+
+inline
+const IndexSet &
+MGConstrainedDoFs::get_boundary_indices (const unsigned int level) const
+{
+  AssertIndexRange(level, boundary_indices.size());
+  return boundary_indices[level];
+}
+
+
 inline
 const std::vector<std::vector<bool> > &
 MGConstrainedDoFs::get_refinement_edge_indices () const

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.