From 10ce02b801fb7ee021fea1e91fa6f855b8f855e5 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Fri, 11 Jan 2013 18:27:08 +0000 Subject: [PATCH] allow multigrid for distributed Triangulation with a constructor flag. Still work in progress, but this makes the unit tests work. git-svn-id: https://svn.dealii.org/trunk@28024 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/distributed/tria.h | 25 +++++++++++++++++++++- deal.II/source/distributed/tria.cc | 3 +-- deal.II/source/dofs/dof_handler_policy.cc | 10 +++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index 2893c8f50d..91fc256ede 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.h @@ -240,11 +240,19 @@ namespace parallel * cell ordering, this flag is * required to get reproducible * behaviour after snapshot/resume. + * + * The flag construct_multigrid_hierarchy + * needs to be set to use the geometric + * multigrid functionality. This option + * requires additional computation and + * communication. Note: geometric + * multigrid is still a work in progress. */ enum Settings { default_setting = 0x0, - mesh_reconstruction_after_repartitioning = 0x1 + mesh_reconstruction_after_repartitioning = 0x1, + construct_multigrid_hierarchy = 0x2 }; @@ -866,6 +874,21 @@ namespace parallel */ std::vector coarse_cell_to_p4est_tree_permutation; std::vector p4est_tree_to_coarse_cell_permutation; + + /** + * dummy settings + */ + enum Settings + { + default_setting = 0x0, + mesh_reconstruction_after_repartitioning = 0x1, + construct_multigrid_hierarchy = 0x2 + }; + /** + * dummy settings object + */ + Settings settings; + }; } } diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index a933e79b34..f5dbb393bb 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -2691,10 +2691,9 @@ namespace parallel // fill level_subdomain_ids for geometric multigrid - // This is disabled for now until it works correctly. // the level ownership of a cell is defined as the owner if the cell is active or as the owner of child(0) // we need this information for all our ancestors and the same-level neighbors of our own cells (=level ghosts) - if (false) + if (settings & construct_multigrid_hierarchy) { // step 1: We set our own ids all the way down and all the others to -1. Note that we do not fill // other cells we could figure out the same way, because we might accidentally set an id for a diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index fa280fadb2..31fcba27e5 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -2128,15 +2128,17 @@ namespace internal Assert (false, ExcNotImplemented()); #else - // TODO: distributed geometric multigrid is not complete yet - Assert (false, ExcNotImplemented()); - return; - parallel::distributed::Triangulation< dim, spacedim > *tr = (dynamic_cast*> (const_cast*> (&dof_handler.get_tria()))); Assert (tr != 0, ExcInternalError()); + + AssertThrow( + (tr->settings & parallel::distributed::Triangulation< dim, spacedim >::construct_multigrid_hierarchy), + ExcMessage("Multigrid DoFs can only be distributed on a parallel Triangulation if the flag construct_multigrid_hierarchy is set in the constructor.")); + + const unsigned int n_cpus = Utilities::MPI::n_mpi_processes (tr->get_communicator()); -- 2.39.5