From 575c6b079694f7dfc4ac04689c19881e68e1eaaa Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 5 Nov 2016 07:49:11 -0600 Subject: [PATCH] Rename a few local variables to avoid ambiguity with member variables. The `MGLevelGlobalTransfer` class has member variables `copy_indices_*` but in the `fill_and_communicate_copy_indices()` member function also allocates local variables of the same name. Rename these to make the distinction clearer. While there, also initialize a few member variables in the constructor of a local class. --- source/multigrid/mg_level_global_transfer.cc | 50 +++++++++++--------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/source/multigrid/mg_level_global_transfer.cc b/source/multigrid/mg_level_global_transfer.cc index d23ef3fba6..1002f233ce 100644 --- a/source/multigrid/mg_level_global_transfer.cc +++ b/source/multigrid/mg_level_global_transfer.cc @@ -55,10 +55,16 @@ namespace const types::global_dof_index global_dof_index, const types::global_dof_index level_dof_index) : - level(level), global_dof_index(global_dof_index), level_dof_index(level_dof_index) + level(level), + global_dof_index(global_dof_index), + level_dof_index(level_dof_index) {} DoFPair() + : + level (numbers::invalid_unsigned_int), + global_dof_index (numbers::invalid_dof_index), + level_dof_index (numbers::invalid_dof_index) {} }; @@ -390,14 +396,14 @@ MGLevelGlobalTransfer >::fill_and_com { // first go to the usual routine... std::vector > > - copy_indices; + my_copy_indices; std::vector > > - copy_indices_global_mine; + my_copy_indices_global_mine; std::vector > > - copy_indices_level_mine; + my_copy_indices_level_mine; - fill_copy_indices(mg_dof, mg_constrained_dofs, copy_indices, - copy_indices_global_mine, copy_indices_level_mine); + fill_copy_indices(mg_dof, mg_constrained_dofs, my_copy_indices, + my_copy_indices_global_mine, my_copy_indices_level_mine); // get all degrees of freedom that we need read access to in copy_to_mg // and copy_from_mg, respectively. We fill an IndexSet once on each level @@ -419,11 +425,11 @@ MGLevelGlobalTransfer >::fill_and_com std::vector level_index_set(mg_dof.get_triangulation().n_global_levels()); for (unsigned int l=0; l accessed_level_indices; - for (unsigned int i=0; i >::fill_and_com *ghosted_level_vector[level].get_partitioner(); // owned-owned case: the locally owned indices are going to control // the local index - this->copy_indices[level].resize(copy_indices[level].size()); - for (unsigned int i=0; icopy_indices[level].resize(my_copy_indices[level].size()); + for (unsigned int i=0; icopy_indices[level][i] = std::pair - (global_partitioner.global_to_local(copy_indices[level][i].first), - level_partitioner.global_to_local(copy_indices[level][i].second)); + (global_partitioner.global_to_local(my_copy_indices[level][i].first), + level_partitioner.global_to_local(my_copy_indices[level][i].second)); // remote-owned case: the locally owned indices for the level and the // ghost dofs for the global indices set the local index this->copy_indices_level_mine[level]. - resize(copy_indices_level_mine[level].size()); - for (unsigned int i=0; icopy_indices_level_mine[level][i] = std::pair - (global_partitioner.global_to_local(copy_indices_level_mine[level][i].first), - level_partitioner.global_to_local(copy_indices_level_mine[level][i].second)); + (global_partitioner.global_to_local(my_copy_indices_level_mine[level][i].first), + level_partitioner.global_to_local(my_copy_indices_level_mine[level][i].second)); // owned-remote case: the locally owned indices for the global dofs // and the ghost dofs for the level indices set the local index this->copy_indices_global_mine[level]. - resize(copy_indices_global_mine[level].size()); - for (unsigned int i=0; icopy_indices_global_mine[level][i] = std::pair - (global_partitioner.global_to_local(copy_indices_global_mine[level][i].first), - level_partitioner.global_to_local(copy_indices_global_mine[level][i].second)); + (global_partitioner.global_to_local(my_copy_indices_global_mine[level][i].first), + level_partitioner.global_to_local(my_copy_indices_global_mine[level][i].second)); } perform_plain_copy = this->copy_indices.back().size() -- 2.39.5