From 4b6a6a9aae750941723890c44f0cb3326e5ba87b Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 11 Feb 2014 16:34:57 +0000 Subject: [PATCH] support for p4est >0.3.4.2 (patch by Alexander Grayver) git-svn-id: https://svn.dealii.org/trunk@32458 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/distributed/tria.cc | 84 +++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index 5687fae27e..a6e5e85e04 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -155,10 +155,17 @@ 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 void (&save) (const char *filename, @@ -173,16 +180,28 @@ namespace internal void *user_pointer, types<2>::connectivity **p4est); +#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(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); @@ -301,10 +320,17 @@ namespace internal 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) = p4est_partition_ext; +#endif void (&functions<2>::save) (const char *filename, types<2>::forest *p4est, @@ -320,18 +346,31 @@ namespace internal types<2>::connectivity **p4est) = p4est_load; +#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(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; @@ -451,10 +490,17 @@ 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 void (&save) (const char *filename, @@ -469,16 +515,28 @@ namespace internal void *user_pointer, types<3>::connectivity **p4est); +#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(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); @@ -600,10 +658,17 @@ namespace internal 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) + = 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, @@ -619,18 +684,31 @@ namespace internal types<3>::connectivity **p4est) = p8est_load; +#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(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; @@ -2113,9 +2191,13 @@ namespace parallel Assert(version == 2, 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 (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().")); + "saved data with a greater or equal number of processes than were used to " + "save() when using p4est 0.3.4.2.")); +#endif attached_data_size = 0; n_attached_datas = 0; -- 2.39.5