From 4658d075f6fc743be8e8b62e80ac4770bdebbdd3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 5 Nov 2012 00:44:55 +0000 Subject: [PATCH] Partial merge from the parallel_mg branch: introduce Triangulation::n_global_levels() on the distributed triangulation. git-svn-id: https://svn.dealii.org/trunk@27378 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 6 ++++ deal.II/include/deal.II/distributed/tria.h | 7 ++++ deal.II/source/distributed/tria.cc | 38 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index fe01bd696f..0a6fcfc76b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -154,6 +154,12 @@ DoFHandler, in particular removal of specializations.

Specific improvements

    +
  1. New: The parallel::distributed::Triangulation::n_global_levels() +function returns the maximal refinement level over all involved +processors. +
    +(Timo Heister, 2012/11/04) +
  2. New: In addition to the regular subdomain ids (see @ref GlossSubdomainId) there is now a second set of flags called "level subdomain ids" that also assigns a subdomain to every cell diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index 797d8c436f..7516e362e7 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.h @@ -441,6 +441,11 @@ namespace parallel */ unsigned int n_global_active_cells () const; + /** + * Returns the global maximum level. This may be bigger than n_levels. + */ + virtual unsigned int n_global_levels () const; + /** * Return the number of * active cells owned by each @@ -627,6 +632,7 @@ namespace parallel { std::vector n_locally_owned_active_cells; unsigned int n_global_active_cells; + unsigned int n_global_levels; }; NumberCache number_cache; @@ -825,6 +831,7 @@ namespace parallel * distributed triangulation. */ unsigned int n_global_active_cells () const; + virtual unsigned int n_global_levels () const; /** * Returns a permutation vector for the order the coarse diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index e025665818..6796e1c8d7 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -2816,6 +2816,7 @@ namespace parallel = std::accumulate (number_cache.n_locally_owned_active_cells.begin(), number_cache.n_locally_owned_active_cells.end(), 0); + number_cache.n_global_levels = Utilities::MPI::max(this->n_levels(), mpi_communicator); } @@ -2848,6 +2849,15 @@ namespace parallel + template + unsigned int + Triangulation::n_global_levels () const + { + return number_cache.n_global_levels; + } + + + template const std::vector & Triangulation::n_locally_owned_active_cells_per_processor () const @@ -2977,6 +2987,7 @@ namespace parallel + MemoryConsumption::memory_consumption(triangulation_has_content) + MemoryConsumption::memory_consumption(number_cache.n_locally_owned_active_cells) + MemoryConsumption::memory_consumption(number_cache.n_global_active_cells) + + MemoryConsumption::memory_consumption(number_cache.n_global_levels) + MemoryConsumption::memory_consumption(connectivity) + MemoryConsumption::memory_consumption(parallel_forest) + MemoryConsumption::memory_consumption(refinement_in_progress) @@ -3099,6 +3110,15 @@ namespace parallel } + template <> + unsigned int + Triangulation<1,1>::n_global_levels () const + { + Assert (false, ExcNotImplemented()); + return 0; + } + + template <> MPI_Comm Triangulation<1,1>::get_communicator () const @@ -3148,6 +3168,15 @@ namespace parallel } + template <> + unsigned int + Triangulation<1,2>::n_global_levels () const + { + Assert (false, ExcNotImplemented()); + return 0; + } + + template <> MPI_Comm Triangulation<1,2>::get_communicator () const @@ -3189,6 +3218,15 @@ namespace parallel } + template <> + unsigned int + Triangulation<1,3>::n_global_levels () const + { + Assert (false, ExcNotImplemented()); + return 0; + } + + template <> MPI_Comm Triangulation<1,3>::get_communicator () const -- 2.39.5