From: Marc Fehling Date: Tue, 3 Jul 2018 21:22:28 +0000 (-0600) Subject: Drop backward compatibilities to older versions of p4est than 2.0. X-Git-Tag: v9.1.0-rc1~959^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b92d3e3e3a59b66c5caf7935286889b4ea5b416;p=dealii.git Drop backward compatibilities to older versions of p4est than 2.0. --- diff --git a/include/deal.II/distributed/p4est_wrappers.h b/include/deal.II/distributed/p4est_wrappers.h index 9c23519cc6..58a82a5b5c 100644 --- a/include/deal.II/distributed/p4est_wrappers.h +++ b/include/deal.II/distributed/p4est_wrappers.h @@ -71,12 +71,9 @@ namespace internal using quadrant = p4est_quadrant_t; using topidx = p4est_topidx_t; using locidx = p4est_locidx_t; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + using gloidx = p4est_gloidx_t; using balance_type = p4est_connect_type_t; -# else - using balance_type = p4est_balance_type_t; -# endif - using ghost = p4est_ghost_t; + using ghost = p4est_ghost_t; }; template <> @@ -88,12 +85,9 @@ namespace internal using quadrant = p8est_quadrant_t; using topidx = p4est_topidx_t; using locidx = p4est_locidx_t; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + using gloidx = p4est_gloidx_t; using balance_type = p8est_connect_type_t; -# else - using balance_type = p8est_balance_type_t; -# endif - using ghost = p8est_ghost_t; + using ghost = p8est_ghost_t; }; @@ -182,21 +176,14 @@ namespace internal types<2>::balance_type btype, p4est_init_t init_fn); -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - static p4est_gloidx_t (&partition)(types<2>::forest *p4est, - int partition_for_coarsening, - p4est_weight_t weight_fn); -# else - static void (&partition)(types<2>::forest *p4est, - int partition_for_coarsening, - p4est_weight_t weight_fn); -# endif + static types<2>::gloidx (&partition)(types<2>::forest *p4est, + int partition_for_coarsening, + p4est_weight_t weight_fn); static void (&save)(const char * filename, types<2>::forest *p4est, int save_data); -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) static types<2>::forest *(&load_ext)(const char *filename, MPI_Comm mpicomm, size_t data_size, @@ -205,35 +192,14 @@ namespace internal int broadcasthead, void * user_pointer, types<2>::connectivity **p4est); -# else - static types<2>::forest *(&load)(const char * filename, - MPI_Comm mpicomm, - size_t data_size, - int load_data, - void * user_pointer, - types<2>::connectivity **p4est); -# endif - -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + static int (&connectivity_save)(const char * filename, types<2>::connectivity *connectivity); -# else - static void (&connectivity_save)(const char * filename, - types<2>::connectivity *connectivity); -# endif static int (&connectivity_is_valid)(types<2>::connectivity *connectivity); -# if DEAL_II_P4EST_VERSION_GTE(1, 0, 0, 0) static types<2>::connectivity *(&connectivity_load)(const char *filename, size_t * length); -# elif DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - static types<2>::connectivity *( - &connectivity_load)(const char *filename, long unsigned *length); -# else - static types<2>::connectivity *(&connectivity_load)(const char *filename, - long * length); -# endif static unsigned int (&checksum)(types<2>::forest *p4est); @@ -261,7 +227,7 @@ namespace internal dealii::internal::p4est::types<2>::ghost * parallel_ghost, void * user_data); - static const unsigned int max_level = P4EST_MAXLEVEL; + static constexpr unsigned int max_level = P4EST_MAXLEVEL; }; @@ -339,21 +305,14 @@ namespace internal types<3>::balance_type btype, p8est_init_t init_fn); -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - static p4est_gloidx_t (&partition)(types<3>::forest *p8est, - int partition_for_coarsening, - p8est_weight_t weight_fn); -# else - static void (&partition)(types<3>::forest *p8est, - int partition_for_coarsening, - p8est_weight_t weight_fn); -# endif + static types<3>::gloidx (&partition)(types<3>::forest *p8est, + int partition_for_coarsening, + p8est_weight_t weight_fn); static void (&save)(const char * filename, types<3>::forest *p4est, int save_data); -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) static types<3>::forest *(&load_ext)(const char *filename, MPI_Comm mpicomm, std::size_t data_size, @@ -362,35 +321,14 @@ namespace internal int broadcasthead, void * user_pointer, types<3>::connectivity **p4est); -# else - static types<3>::forest *(&load)(const char * filename, - MPI_Comm mpicomm, - std::size_t data_size, - int load_data, - void * user_pointer, - types<3>::connectivity **p4est); -# endif - -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + static int (&connectivity_save)(const char * filename, types<3>::connectivity *connectivity); -# else - static void (&connectivity_save)(const char * filename, - types<3>::connectivity *connectivity); -# endif static int (&connectivity_is_valid)(types<3>::connectivity *connectivity); -# if DEAL_II_P4EST_VERSION_GTE(1, 0, 0, 0) static types<3>::connectivity *(&connectivity_load)(const char *filename, size_t * length); -# elif DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - static types<3>::connectivity *( - &connectivity_load)(const char *filename, long unsigned *length); -# else - static types<3>::connectivity *(&connectivity_load)(const char *filename, - long * length); -# endif static unsigned int (&checksum)(types<3>::forest *p8est); @@ -413,7 +351,7 @@ namespace internal - static const unsigned int max_level = P8EST_MAXLEVEL; + static constexpr unsigned int max_level = P8EST_MAXLEVEL; }; diff --git a/source/distributed/p4est_wrappers.cc b/source/distributed/p4est_wrappers.cc index 50eea5d56c..86b7215012 100644 --- a/source/distributed/p4est_wrappers.cc +++ b/source/distributed/p4est_wrappers.cc @@ -362,7 +362,6 @@ namespace internal types<2>::topidx num_corners, types<2>::topidx num_vtt) = p4est_connectivity_new; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 1) void (&functions<2>::connectivity_join_faces)(types<2>::connectivity *conn, types<2>::topidx tree_left, types<2>::topidx tree_right, @@ -370,7 +369,6 @@ namespace internal int face_right, int orientation) = p4est_connectivity_join_faces; -# endif void (&functions<2>::connectivity_destroy)( p4est_connectivity_t *connectivity) = p4est_connectivity_destroy; @@ -400,24 +398,16 @@ namespace internal void (&functions<2>::balance)(types<2>::forest * p4est, types<2>::balance_type btype, p4est_init_t init_fn) = p4est_balance; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - p4est_gloidx_t (&functions<2>::partition)(types<2>::forest *p4est, - int partition_for_coarsening, - p4est_weight_t weight_fn) = - p4est_partition_ext; -# else - void (&functions<2>::partition)(types<2>::forest *p4est, - int partition_for_coarsening, - p4est_weight_t weight_fn) = + types<2>::gloidx (&functions<2>::partition)(types<2>::forest *p4est, + int partition_for_coarsening, + p4est_weight_t weight_fn) = p4est_partition_ext; -# endif void (&functions<2>::save)(const char * filename, types<2>::forest *p4est, int save_data) = p4est_save; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) types<2>::forest *(&functions<2>::load_ext)( const char * filename, MPI_Comm mpicomm, @@ -427,41 +417,17 @@ namespace internal int broadcasthead, void * user_pointer, types<2>::connectivity **p4est) = p4est_load_ext; -# else - types<2>::forest *(&functions<2>::load)(const char *filename, - MPI_Comm mpicomm, - std::size_t data_size, - int load_data, - void * user_pointer, - types<2>::connectivity **p4est) = - p4est_load; -# endif - -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + int (&functions<2>::connectivity_save)( const char * filename, types<2>::connectivity *connectivity) = p4est_connectivity_save; -# else - void (&functions<2>::connectivity_save)( - const char * filename, - types<2>::connectivity *connectivity) = p4est_connectivity_save; -# endif int (&functions<2>::connectivity_is_valid)( types<2>::connectivity *connectivity) = p4est_connectivity_is_valid; -# if DEAL_II_P4EST_VERSION_GTE(1, 0, 0, 0) + types<2>::connectivity *(&functions<2>::connectivity_load)( const char *filename, size_t * length) = p4est_connectivity_load; -# elif DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - types<2>::connectivity *(&functions<2>::connectivity_load)( - const char * filename, - long unsigned *length) = p4est_connectivity_load; -# else - types<2>::connectivity *(&functions<2>::connectivity_load)( - const char *filename, - long * length) = p4est_connectivity_load; -# endif unsigned int (&functions<2>::checksum)(types<2>::forest *p4est) = p4est_checksum; @@ -541,7 +507,7 @@ namespace internal return vertices_with_ghost_neighbors; } - const unsigned int functions<2>::max_level; + constexpr unsigned int functions<2>::max_level; @@ -594,7 +560,6 @@ namespace internal void (&functions<3>::connectivity_destroy)( p8est_connectivity_t *connectivity) = p8est_connectivity_destroy; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 1) void (&functions<3>::connectivity_join_faces)(types<3>::connectivity *conn, types<3>::topidx tree_left, types<3>::topidx tree_right, @@ -602,7 +567,6 @@ namespace internal int face_right, int orientation) = p8est_connectivity_join_faces; -# endif types<3>::forest *(&functions<3>::new_forest)( MPI_Comm mpicomm, @@ -630,23 +594,15 @@ namespace internal types<3>::balance_type btype, p8est_init_t init_fn) = p8est_balance; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - p4est_gloidx_t (&functions<3>::partition)(types<3>::forest *p8est, - int partition_for_coarsening, - p8est_weight_t weight_fn) = + types<3>::gloidx (&functions<3>::partition)(types<3>::forest *p8est, + int partition_for_coarsening, + p8est_weight_t weight_fn) = p8est_partition_ext; -# else - void (&functions<3>::partition)(types<3>::forest *p8est, - int partition_for_coarsening, - p8est_weight_t weight_fn) = - p8est_partition_ext; -# endif void (&functions<3>::save)(const char * filename, types<3>::forest *p4est, int save_data) = p8est_save; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) types<3>::forest *(&functions<3>::load_ext)( const char * filename, MPI_Comm mpicomm, @@ -656,42 +612,17 @@ namespace internal int broadcasthead, void * user_pointer, types<3>::connectivity **p4est) = p8est_load_ext; -# else - types<3>::forest *(&functions<3>::load)(const char *filename, - MPI_Comm mpicomm, - std::size_t data_size, - int load_data, - void * user_pointer, - types<3>::connectivity **p4est) = - p8est_load; -# endif - -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) + int (&functions<3>::connectivity_save)( const char * filename, types<3>::connectivity *connectivity) = p8est_connectivity_save; -# else - void (&functions<3>::connectivity_save)( - const char * filename, - types<3>::connectivity *connectivity) = p8est_connectivity_save; -# endif int (&functions<3>::connectivity_is_valid)( types<3>::connectivity *connectivity) = p8est_connectivity_is_valid; -# if DEAL_II_P4EST_VERSION_GTE(1, 0, 0, 0) types<3>::connectivity *(&functions<3>::connectivity_load)( const char *filename, size_t * length) = p8est_connectivity_load; -# elif DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) - types<3>::connectivity *(&functions<3>::connectivity_load)( - const char * filename, - long unsigned *length) = p8est_connectivity_load; -# else - types<3>::connectivity *(&functions<3>::connectivity_load)( - const char *filename, - long * length) = p8est_connectivity_load; -# endif unsigned int (&functions<3>::checksum)(types<3>::forest *p8est) = p8est_checksum; @@ -719,7 +650,7 @@ namespace internal size_t (&functions<3>::connectivity_memory_used)( types<3>::connectivity *p4est) = p8est_connectivity_memory_used; - const unsigned int functions<3>::max_level; + constexpr unsigned int functions<3>::max_level; diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index f725fbf043..069268e875 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1785,15 +1785,6 @@ namespace parallel ExcMessage("Incompatible version found in .info file.")); Assert(this->n_cells(0) == n_coarse_cells, ExcMessage("Number of coarse cells differ!")); -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) -# else - AssertThrow( - numcpus <= Utilities::MPI::n_mpi_processes(this->mpi_communicator), - ExcMessage( - "parallel::distributed::Triangulation::load() only supports loading " - "saved data with a greater or equal number of processes than were used to " - "save() when using p4est 0.3.4.2.")); -# endif // clear all of the callback data, as explained in the documentation of // register_data_attach() @@ -1801,7 +1792,6 @@ namespace parallel cell_attached_data.n_attached_datas = 0; cell_attached_data.n_attached_deserialize = attached_count; -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 3) parallel_forest = dealii::internal::p4est::functions::load_ext( filename, this->mpi_communicator, @@ -1811,16 +1801,7 @@ namespace parallel 0, this, &connectivity); -# else - (void)autopartition; - parallel_forest = - dealii::internal::p4est::functions::load(filename, - this->mpi_communicator, - attached_size, - attached_size > 0, - this, - &connectivity); -# endif + if (numcpus != Utilities::MPI::n_mpi_processes(this->mpi_communicator)) // We are changing the number of CPUs so we need to repartition. // Note that p4est actually distributes the cells between the changed @@ -3503,7 +3484,6 @@ namespace parallel const std::vector> &periodicity_vector) { -# if DEAL_II_P4EST_VERSION_GTE(0, 3, 4, 1) Assert(triangulation_has_content == true, ExcMessage("The triangulation is empty!")); Assert(this->n_levels() == 1, @@ -3663,9 +3643,6 @@ namespace parallel // The range of ghost_owners might have changed so update that information this->update_number_cache(); -# else - Assert(false, ExcMessage("Need p4est version >= 0.3.4.1!")); -# endif }