From: maier Date: Sat, 26 Apr 2014 00:38:26 +0000 (+0000) Subject: Add a boolean autopartition to X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec28d00bf6161d2a3054eac855e7b1ffbe8bbd14;p=dealii-svn.git Add a boolean autopartition to parallel::distributed::Triangulation<...>::load to control automatic reparitioning behaviour of p4est git-svn-id: https://svn.dealii.org/trunk@32839 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 899dd3ce74..4af2ee48b4 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -148,6 +148,15 @@ inconvenience this causes.

Specific improvements

    +
  1. Fixed: parallel::distributed::Triangulation<...>::load now has an + additional parameter autopartition to control p4est's behaviour of + rebalancing triangulations between mpi nodes upon reading. It is + particularly useful to disable this behaviour when data is stored + seperately (see tests mpi/p4est_save_0?). +
    + (Alexander Grayver, Matthias Maier, 2014/04/26) +
  2. +
  3. Fixed: GridTools::find_active_cell_around_point() could get into an infinite loop if the point we are looking for is in fact not within the domain. This is now fixed. diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index 17dbdee034..673b0dc132 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.h @@ -553,16 +553,24 @@ namespace parallel void save(const char *filename) const; /** - * Load the refinement information saved with save() back in. The mesh - * must contain the same coarse mesh that was used in save() before calling - * this function. You do not - * need to load with the same number of MPI processes that you saved - * with. Rather, if a mesh is loaded with a different number of MPI - * processes than used at the time of saving, the mesh is repartitioned - * appropriately. Cell-based data that was saved with register_data_attach() - * can be read in with notify_ready_to_unpack() after calling load(). - */ - void load(const char *filename); + * Load the refinement information saved with save() back in. The + * mesh must contain the same coarse mesh that was used in save() + * before calling this function. + * + * You do not need to load with the same number of MPI processes that + * you saved with. Rather, if a mesh is loaded with a different + * number of MPI processes than used at the time of saving, the mesh + * is repartitioned appropriately. Cell-based data that was saved + * with register_data_attach() can be read in with + * notify_ready_to_unpack() after calling load(). + * + * If you use p4est version > 0.3.4.2 the @p autopartition flag tells + * p4est to ignore the partitioning that the triangulation had when + * it was saved and make it uniform upon loading. If @p autopartition + * set to false, the triangulation is only repartitioned if needed + * (i.e. if a different number of MPI processes is encountered). + */ + void load(const char *filename, bool autopartition = true); /** * Used to inform in the callbacks of register_data_attach() and diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index 6a22f877f5..48044be5a9 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -2214,7 +2214,7 @@ namespace parallel template void Triangulation:: - load(const char *filename) + load(const char *filename, bool autopartition) { Assert(this->n_cells()>0, ExcMessage("load() only works if Triangulation already contains the same coarse mesh!")); Assert(this->n_levels()==1, ExcMessage("Triangulation may only contain coarse cells when calling load().")); @@ -2257,7 +2257,7 @@ namespace parallel parallel_forest = dealii::internal::p4est::functions::load_ext ( filename, mpi_communicator, attached_size, attached_size>0, - 1, 0, + autopartition, 0, this, &connectivity); #else diff --git a/tests/mpi/p4est_save_01.cc b/tests/mpi/p4est_save_01.cc index aa26490503..6b03577a5b 100644 --- a/tests/mpi/p4est_save_01.cc +++ b/tests/mpi/p4est_save_01.cc @@ -87,7 +87,7 @@ void test() parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::hyper_cube(tr); - tr.load(filename.c_str()); + tr.load(filename.c_str(), false); if (myid == 0) { diff --git a/tests/mpi/p4est_save_02.cc b/tests/mpi/p4est_save_02.cc index 20f71ba070..177242bcf1 100644 --- a/tests/mpi/p4est_save_02.cc +++ b/tests/mpi/p4est_save_02.cc @@ -115,7 +115,7 @@ void test() parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::hyper_cube(tr); - tr.load(filename.c_str()); + tr.load(filename.c_str(), false); FE_Q fe(1); DoFHandler dh(tr); diff --git a/tests/mpi/p4est_save_03.cc b/tests/mpi/p4est_save_03.cc index b427832fc8..9a224f7d14 100644 --- a/tests/mpi/p4est_save_03.cc +++ b/tests/mpi/p4est_save_03.cc @@ -124,7 +124,7 @@ void test() parallel::distributed::Triangulation tr (MPI_COMM_WORLD); GridGenerator::hyper_cube (tr); - tr.load (filename.c_str()); + tr.load (filename.c_str(), false); FE_Q fe (1); DoFHandler dh (tr);