From 3992f267f19765539ca6982a3fdd8677e516d0fd Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Sat, 20 Mar 2021 15:32:38 -0600 Subject: [PATCH] New p4est connectivity copy functions. --- include/deal.II/distributed/p4est_wrappers.h | 39 ++++++++++ source/distributed/p4est_wrappers.cc | 76 ++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/include/deal.II/distributed/p4est_wrappers.h b/include/deal.II/distributed/p4est_wrappers.h index 27894a5a74..86ae54efce 100644 --- a/include/deal.II/distributed/p4est_wrappers.h +++ b/include/deal.II/distributed/p4est_wrappers.h @@ -159,6 +159,20 @@ namespace internal types<2>::topidx num_trees, types<2>::topidx num_corners, types<2>::topidx num_vtt); + + static types<2>::connectivity *(&connectivity_new_copy)( + types<2>::topidx num_vertices, + types<2>::topidx num_trees, + types<2>::topidx num_corners, + const double * vertices, + const types<2>::topidx *ttv, + const types<2>::topidx *ttt, + const int8_t * ttf, + const types<2>::topidx *ttc, + const types<2>::topidx *coff, + const types<2>::topidx *ctt, + const int8_t * ctc); + static void (&connectivity_join_faces)(types<2>::connectivity *conn, types<2>::topidx tree_left, types<2>::topidx tree_right, @@ -334,6 +348,24 @@ namespace internal types<3>::topidx num_corners, types<3>::topidx num_ctt); + static types<3>::connectivity *(&connectivity_new_copy)( + types<3>::topidx num_vertices, + types<3>::topidx num_trees, + types<3>::topidx num_edges, + types<3>::topidx num_corners, + const double * vertices, + const types<3>::topidx *ttv, + const types<3>::topidx *ttt, + const int8_t * ttf, + const types<3>::topidx *tte, + const types<3>::topidx *eoff, + const types<3>::topidx *ett, + const int8_t * ete, + const types<3>::topidx *ttc, + const types<3>::topidx *coff, + const types<3>::topidx *ctt, + const int8_t * ctc); + static void (&connectivity_join_faces)(types<3>::connectivity *conn, types<3>::topidx tree_left, types<3>::topidx tree_right, @@ -548,6 +580,13 @@ namespace internal tree_exists_locally(const typename types::forest *parallel_forest, const typename types::topidx coarse_grid_cell); + + /** + * Deep copy a p4est connectivity object. + */ + template + typename types::connectivity * + copy_connectivity(const typename types::connectivity *connectivity); } // namespace p4est } // namespace internal diff --git a/source/distributed/p4est_wrappers.cc b/source/distributed/p4est_wrappers.cc index 07b15cdb74..809548ed69 100644 --- a/source/distributed/p4est_wrappers.cc +++ b/source/distributed/p4est_wrappers.cc @@ -380,6 +380,19 @@ namespace internal types<2>::topidx num_corners, types<2>::topidx num_vtt) = p4est_connectivity_new; + types<2>::connectivity *(&functions<2>::connectivity_new_copy)( + types<2>::topidx num_vertices, + types<2>::topidx num_trees, + types<2>::topidx num_corners, + const double * vertices, + const types<2>::topidx *ttv, + const types<2>::topidx *ttt, + const int8_t * ttf, + const types<2>::topidx *ttc, + const types<2>::topidx *coff, + const types<2>::topidx *ctt, + const int8_t * ctc) = p4est_connectivity_new_copy; + void (&functions<2>::connectivity_join_faces)(types<2>::connectivity *conn, types<2>::topidx tree_left, types<2>::topidx tree_right, @@ -570,6 +583,24 @@ namespace internal types<3>::topidx num_corners, types<3>::topidx num_ctt) = p8est_connectivity_new; + types<3>::connectivity *(&functions<3>::connectivity_new_copy)( + types<3>::topidx num_vertices, + types<3>::topidx num_trees, + types<3>::topidx num_edges, + types<3>::topidx num_corners, + const double * vertices, + const types<3>::topidx *ttv, + const types<3>::topidx *ttt, + const int8_t * ttf, + const types<3>::topidx *tte, + const types<3>::topidx *eoff, + const types<3>::topidx *ett, + const int8_t * ete, + const types<3>::topidx *ttc, + const types<3>::topidx *coff, + const types<3>::topidx *ctt, + const int8_t * ctc) = p8est_connectivity_new_copy; + void (&functions<3>::connectivity_destroy)( p8est_connectivity_t *connectivity) = p8est_connectivity_destroy; @@ -791,6 +822,51 @@ namespace internal + // template specializations + + template <> + typename types<2>::connectivity * + copy_connectivity<2>(const typename types<2>::connectivity *connectivity) + { + return functions<2>::connectivity_new_copy( + connectivity->num_vertices, + connectivity->num_trees, + connectivity->num_corners, + connectivity->vertices, + connectivity->tree_to_vertex, + connectivity->tree_to_tree, + connectivity->tree_to_face, + connectivity->tree_to_corner, + connectivity->ctt_offset, + connectivity->corner_to_tree, + connectivity->corner_to_corner); + } + + template <> + typename types<3>::connectivity * + copy_connectivity<3>(const typename types<3>::connectivity *connectivity) + { + return functions<3>::connectivity_new_copy( + connectivity->num_vertices, + connectivity->num_trees, + connectivity->num_edges, + connectivity->num_corners, + connectivity->vertices, + connectivity->tree_to_vertex, + connectivity->tree_to_tree, + connectivity->tree_to_face, + connectivity->tree_to_edge, + connectivity->ett_offset, + connectivity->edge_to_tree, + connectivity->edge_to_edge, + connectivity->tree_to_corner, + connectivity->ctt_offset, + connectivity->corner_to_tree, + connectivity->corner_to_corner); + } + + + template <> bool quadrant_is_equal<1>(const typename types<1>::quadrant &q1, -- 2.39.5