]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New p4est connectivity copy functions.
authorMarc Fehling <mafehling.git@gmail.com>
Sat, 20 Mar 2021 21:32:38 +0000 (15:32 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Mon, 22 Mar 2021 18:56:22 +0000 (12:56 -0600)
include/deal.II/distributed/p4est_wrappers.h
source/distributed/p4est_wrappers.cc

index 27894a5a7407877390a67c3a96aa8af5c92d1866..86ae54efce718af15a6de5cbe41e7efb13a3281a 100644 (file)
@@ -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<dim>::forest *parallel_forest,
                         const typename types<dim>::topidx  coarse_grid_cell);
 
+
+    /**
+     * Deep copy a p4est connectivity object.
+     */
+    template <int dim>
+    typename types<dim>::connectivity *
+    copy_connectivity(const typename types<dim>::connectivity *connectivity);
   } // namespace p4est
 } // namespace internal
 
index 07b15cdb744a86e6571a2ff006930228ad10740f..809548ed692687d8d22ac840d37f4d36d30a0cfe 100644 (file)
@@ -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,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.