From 5342d9cf0702f8ba79193a3e64128a1567e3700b Mon Sep 17 00:00:00 2001 From: deal Date: Tue, 31 Aug 2004 22:43:39 +0000 Subject: [PATCH] Unnamed temporary variables can't be bound to non-const references. git-svn-id: https://svn.dealii.org/trunk@9601 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/multigrid/mg_dof_tools.h | 2 +- .../deal.II/source/multigrid/mg_dof_tools.cc | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_dof_tools.h b/deal.II/deal.II/include/multigrid/mg_dof_tools.h index 5b1271df7c..bdfce7388e 100644 --- a/deal.II/deal.II/include/multigrid/mg_dof_tools.h +++ b/deal.II/deal.II/include/multigrid/mg_dof_tools.h @@ -217,7 +217,7 @@ class MGTools MGLevelObject > &v, const std::vector &selected, const std::vector &target_component, - std::vector >& cached_sizes + const std::vector >& cached_sizes = std::vector >()); }; diff --git a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc index 268613979e..c0997f0025 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc @@ -464,7 +464,7 @@ MGTools::reinit_vector (const MGDoFHandler &mg_dof, MGLevelObject > &v, const std::vector &selected, const std::vector &target_component, - std::vector >& ndofs) + const std::vector >& cached_dofs) { Assert (selected.size() == target_component.size(), ExcDimensionMismatch(selected.size(), target_component.size())); @@ -482,19 +482,19 @@ MGTools::reinit_vector (const MGDoFHandler &mg_dof, while (!selected[selected_block]) ++selected_block; - if (ndofs.size() == 0) - { - std::vector > - new_dofs(mg_dof.get_tria().n_levels(), - std::vector(target_component.size())); - std::swap(ndofs, new_dofs); - count_dofs_per_component (mg_dof, ndofs, target_component); - } + std::vector > + n_dofs(mg_dof.get_tria().n_levels(), + std::vector(target_component.size())); + + if (cached_dofs.size() == 0) + count_dofs_per_component (mg_dof, n_dofs, target_component); + else + n_dofs = cached_dofs; for (unsigned int level=v.get_minlevel(); level<=v.get_maxlevel();++level) { - v[level].reinit(ndofs[level][selected_block]); + v[level].reinit(n_dofs[level][selected_block]); } } -- 2.39.5