From 4c443f06d8f3f12fdc829b872632d1a7162995cc Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sat, 27 Jun 2015 08:19:55 -0400 Subject: [PATCH] replace get_boundary_indices use IndexSet instead --- .../deal.II/multigrid/mg_constrained_dofs.h | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/include/deal.II/multigrid/mg_constrained_dofs.h b/include/deal.II/multigrid/mg_constrained_dofs.h index b9ef4e0701..0ee24682b7 100644 --- a/include/deal.II/multigrid/mg_constrained_dofs.h +++ b/include/deal.II/multigrid/mg_constrained_dofs.h @@ -89,7 +89,13 @@ public: * constraints. */ const std::vector > & - 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 > boundary_indices; + std::vector boundary_indices; + + /** + * old data structure only filled on demand + */ + mutable std::vector > 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 > & 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 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 > & MGConstrainedDoFs::get_refinement_edge_indices () const -- 2.39.5