From 71acb656d116de5b0972392cb3386affab7a045e Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sun, 30 Aug 2015 17:17:35 +0200 Subject: [PATCH] Cleanup interface of parallel::Triangulation without MPI --- include/deal.II/distributed/tria.h | 17 +------------- include/deal.II/distributed/tria_base.h | 10 +-------- source/distributed/tria.cc | 30 ++----------------------- source/distributed/tria_base.cc | 27 +++++++--------------- 4 files changed, 12 insertions(+), 72 deletions(-) diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index 7b24492e16..00c22c20c6 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -1079,7 +1079,7 @@ namespace parallel * actually be created if we don't have p4est available. */ template - class Triangulation : public dealii::Triangulation + class Triangulation : public dealii::parallel::Triangulation { private: /** @@ -1087,21 +1087,6 @@ namespace parallel */ Triangulation (); - public: - - /** - * Destructor. - */ - virtual ~Triangulation (); - - /** - * Return the subdomain id of those cells that are owned by the current - * processor. All cells in the triangulation that do not have this - * subdomain id are either owned by another processor or have children - * that only exist on other processors. - */ - types::subdomain_id locally_owned_subdomain () const; - }; } } diff --git a/include/deal.II/distributed/tria_base.h b/include/deal.II/distributed/tria_base.h index b5f1ade171..6ef81639cd 100644 --- a/include/deal.II/distributed/tria_base.h +++ b/include/deal.II/distributed/tria_base.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2008 - 2013 by the deal.II authors +// Copyright (C) 2008 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -56,25 +56,19 @@ namespace parallel /** * Constructor. */ -#ifdef DEAL_II_WITH_MPI Triangulation (MPI_Comm mpi_communicator, const typename dealii::Triangulation::MeshSmoothing smooth_grid = (dealii::Triangulation::none), const bool check_for_distorted_cells = false); -#else - Triangulation (); -#endif /** * Destructor. */ virtual ~Triangulation (); -#ifdef DEAL_II_WITH_MPI /** * Return MPI communicator used by this triangulation. */ virtual MPI_Comm get_communicator () const; -#endif /** * Implementation of the same function as in the base class. @@ -143,14 +137,12 @@ namespace parallel protected: -#ifdef DEAL_II_WITH_MPI /** * MPI communicator to be used for the triangulation. We create a unique * communicator for this class, which is a duplicate of the one passed * to the constructor. */ MPI_Comm mpi_communicator; -#endif /** * The subdomain id to be used for the current processor. diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index c259943410..9b16877249 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -4590,37 +4590,11 @@ namespace parallel { template Triangulation::Triangulation () + : + dealii::parallel::Triangulation(MPI_COMM_SELF) { Assert (false, ExcNotImplemented()); } - - - template - Triangulation::~Triangulation () - { - Assert (false, ExcNotImplemented()); - } - - - - template - types::subdomain_id - Triangulation::locally_owned_subdomain () const - { - Assert (false, ExcNotImplemented()); - return 0; - } - - -#ifdef DEAL_II_WITH_MPI - template - MPI_Comm - Triangulation::get_communicator () const - { - Assert (false, ExcNotImplemented()); - return MPI_COMM_WORLD; - } -#endif } } diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index d1b613afe0..ff948468eb 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -37,7 +37,6 @@ DEAL_II_NAMESPACE_OPEN namespace parallel { -#ifdef DEAL_II_WITH_MPI template Triangulation::Triangulation (MPI_Comm mpi_communicator, const typename dealii::Triangulation::MeshSmoothing smooth_grid, @@ -49,6 +48,10 @@ namespace parallel my_subdomain (Utilities::MPI::this_mpi_process (this->mpi_communicator)), n_subdomains(Utilities::MPI::n_mpi_processes(mpi_communicator)) { +#ifndef DEAL_II_WITH_MPI + Assert(false, ExcMessage("You compiled deal.II without MPI support, for " + "which parallel::Triangulation is not available.")); +#endif number_cache.n_locally_owned_active_cells.resize (n_subdomains); } @@ -56,6 +59,9 @@ namespace parallel void Triangulation::copy_triangulation (const dealii::Triangulation &old_tria) { +#ifndef DEAL_II_WITH_MPI + Assert(false, ExcNotImplemented()); +#endif if (const dealii::parallel::Triangulation * old_tria_x = dynamic_cast *>(&old_tria)) { @@ -63,22 +69,7 @@ namespace parallel } } -#else - template - Triangulation::Triangulation() - { - Assert (false, ExcNotImplemented()); - } - - template - void - Triangulation::copy_triangulation (const dealii::Triangulation &) - { - Assert (false, ExcNotImplemented()); - } - -#endif template std::size_t @@ -86,9 +77,7 @@ namespace parallel { std::size_t mem= this->dealii::Triangulation::memory_consumption() -#ifdef DEAL_II_WITH_MPI + MemoryConsumption::memory_consumption(mpi_communicator) -#endif + MemoryConsumption::memory_consumption(my_subdomain) + MemoryConsumption::memory_consumption(number_cache.n_locally_owned_active_cells) + MemoryConsumption::memory_consumption(number_cache.n_global_active_cells) @@ -141,7 +130,6 @@ namespace parallel return number_cache.n_locally_owned_active_cells; } -#ifdef DEAL_II_WITH_MPI template MPI_Comm Triangulation::get_communicator () const @@ -149,6 +137,7 @@ namespace parallel return mpi_communicator; } +#ifdef DEAL_II_WITH_MPI template void Triangulation::update_number_cache () -- 2.39.5