From: Timo Heister Date: Sun, 4 Oct 2015 18:43:21 +0000 (-0400) Subject: Merge remote-tracking branch 'upstream/master' into parmg X-Git-Tag: v8.4.0-rc2~277^2~24 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba0e7dbe97b9809d9364045fda0d2cb560aa70e2;p=dealii.git Merge remote-tracking branch 'upstream/master' into parmg Conflicts: examples/step-50/step-50.cc include/deal.II/dofs/dof_tools.h include/deal.II/grid/cell_id.h include/deal.II/multigrid/mg_transfer.h include/deal.II/multigrid/mg_transfer.templates.h source/multigrid/mg_transfer_prebuilt.cc --- ba0e7dbe97b9809d9364045fda0d2cb560aa70e2 diff --cc examples/step-50/step-50.cc index 5cff7533c8,f0d201e56c..8573b59089 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@@ -372,14 -371,10 +372,14 @@@ namespace Step5 constraints.close (); hanging_node_constraints.close (); + //check(constraints); + //check(hanging_node_constraints); + + DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs()); + DoFTools::make_sparsity_pattern (mg_dof_handler, dsp, constraints); + system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true); - CompressedSimpleSparsityPattern csp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs()); - DoFTools::make_sparsity_pattern (mg_dof_handler, csp, constraints); - system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD, true); + // The multigrid constraints have to be // initialized. They need to know about // the boundary values as well, so we diff --cc include/deal.II/dofs/dof_tools.h index 4cfa6fa467,729dcb0420..ed3356e928 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@@ -1438,16 -1416,42 +1416,54 @@@ namespace DoFTool extract_locally_relevant_dofs (const DH &dof_handler, IndexSet &dof_set); + /** + * + * For each processor, determine the set of locally owned degrees of freedom as an IndexSet. + * This function then returns a vector of index sets, where the vector has size equal to the + * number of MPI processes that participate in the DoF handler object. + * + * The function can be used for objects of type dealii::Triangulation or parallel::shared::Triangulation. + * It will not work for objects of type parallel::distributed::Triangulation since for such triangulations + * we do not have information about all cells of the triangulation available locally, + * and consequently can not say anything definitive about the degrees of freedom active on other + * processors' locally owned cells. + * + * @author Denis Davydov, 2015 + */ + template + std::vector + locally_owned_dofs_per_subdomain (const DH &dof_handler); + + /** + * + * For each processor, determine the set of locally relevant degrees of freedom as an IndexSet. + * This function then returns a vector of index sets, where the vector has size equal to the + * number of MPI processes that participate in the DoF handler object. + * + * The function can be used for objects of type dealii::Triangulation or parallel::shared::Triangulation. + * It will not work for objects of type parallel::distributed::Triangulation since for such triangulations + * we do not have information about all cells of the triangulation available locally, + * and consequently can not say anything definitive about the degrees of freedom active on other + * processors' locally owned cells. + * + * @author Jean-Paul Pelteret, 2015 + */ + template + std::vector + locally_relevant_dofs_per_subdomain (const DH &dof_handler); + ++ + /** + * Same as extract_locally_relevant_dofs() but for multigrid DoFs + * for the given @p level. + */ + template + void + extract_locally_relevant_mg_dofs (const DH &dof_handler, - IndexSet &dof_set, - unsigned int level); ++ IndexSet &dof_set, ++ unsigned int level); ++ + /** * For each DoF, return in the output array to which subdomain (as given by * the cell->subdomain_id() function) it belongs. The output array diff --cc include/deal.II/multigrid/mg_transfer.h index 5a4d9f720c,13add34b41..48c4131ff8 --- a/include/deal.II/multigrid/mg_transfer.h +++ b/include/deal.II/multigrid/mg_transfer.h @@@ -265,8 -282,8 +282,8 @@@ private * * Organization of the data is like for @p copy_indices_mine. */ - std::vector > > + std::vector > > - copy_indices_to_me; + copy_indices_global_mine; /** * Additional degrees of freedom for the copy_from_mg() function. These are @@@ -275,8 -292,8 +292,8 @@@ * * Organization of the data is like for @p copy_indices_mine. */ - std::vector > > + std::vector > > - copy_indices_from_me; + copy_indices_level_mine; /** diff --cc include/deal.II/multigrid/mg_transfer.templates.h index 67fbbbd17f,1af86a22af..5f56a9be9c --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@@ -154,13 -177,7 +184,13 @@@ MGTransferPrebuilt::copy_to_mg --level; VECTOR &dst_level = dst[level]; +#ifdef DEBUG_OUTPUT + MPI_Barrier(MPI_COMM_WORLD); + int myid=-1; + MPI_Comm_rank (MPI_COMM_WORLD, &myid); +#endif + - typedef std::vector >::const_iterator IT; + typedef std::vector >::const_iterator IT; for (IT i= copy_indices[level].begin(); i != copy_indices[level].end(); ++i) dst_level(i->second) = src(i->first); @@@ -211,17 -215,17 +241,17 @@@ MGTransferPrebuilt::copy_from_m dst = 0; for (unsigned int level=0; level >::const_iterator IT; + typedef std::vector >::const_iterator IT; +#ifdef DEBUG_OUTPUT + MPI_Barrier(MPI_COMM_WORLD); + std::cout << "copy_from_mg src " << level << " " << src[level].l2_norm() << std::endl; + MPI_Barrier(MPI_COMM_WORLD); +#endif // First copy all indices local to this process - if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) = src[level](i->second); - else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) = src[level](i->second); // Do the same for the indices where the level index is local, // but the global index is not @@@ -263,10 -259,15 +293,10 @@@ MGTransferPrebuilt::copy_from_m // functions for (unsigned int level=0; level >::const_iterator IT; + typedef std::vector >::const_iterator IT; - if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) += src[level](i->second); - else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) += src[level](i->second); // Do the same for the indices where the level index is local, // but the global index is not diff --cc source/multigrid/mg_transfer_prebuilt.cc index a9b2f8e93f,fa9d72f02e..c237e01cc0 --- a/source/multigrid/mg_transfer_prebuilt.cc +++ b/source/multigrid/mg_transfer_prebuilt.cc @@@ -331,24 -333,17 +351,24 @@@ void MGTransferPrebuilt::build_ bool global_mine = mg_dof.locally_owned_dofs().is_element(global_dof_indices[i]); bool level_mine = mg_dof.locally_owned_mg_dofs(level).is_element(level_dof_indices[i]); + if (global_mine && level_mine) - copy_indices[level].push_back( - std::make_pair (global_dof_indices[i], level_dof_indices[i])); - else if (level_mine) - copy_indices_from_me[level].push_back( + { + copy_indices[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::make_pair (global_dof_indices[i], level_dof_indices[i])); - else if (global_mine) - copy_indices_to_me[level].push_back( + } + else if(global_mine) + { + copy_indices_global_mine[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::make_pair (global_dof_indices[i], level_dof_indices[i])); + + //send this to the owner of the level_dof: + send_data_temp.push_back(dof_pair(level, global_dof_indices[i], level_dof_indices[i])); + } else - continue; + { + // somebody will send those to me + } dof_touched[global_idx] = true; } @@@ -454,13 -353,13 +474,13 @@@ // If we are in debugging mode, we order the copy indices, so we get // more reliable output for regression texts #ifdef DEBUG - std::less > compare; + std::less > compare; for (unsigned int level=0; level