]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Patch by Martin Steigemann: implement parallel::distributed::Triangulation::copy_tria...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 Jul 2013 15:28:54 +0000 (15:28 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 2 Jul 2013 15:28:54 +0000 (15:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@29909 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/distributed/tria.cc

index fb6ef1dbb18e95785afbae0c01528f99d4cec371..738e2a2d44ca8610b4710edd6eccaac086bdc672 100644 (file)
@@ -71,11 +71,11 @@ this function.
 
 
 <ol>
-  <li> New: deal.II can now be compiled to 64-bit global dof indices. To turn 
-  this feature on, use the cmake option -DDEAL_II_WITH_64BIT_INDICES=ON. If 
+  <li> New: deal.II can now be compiled to 64-bit global dof indices. To turn
+  this feature on, use the cmake option -DDEAL_II_WITH_64BIT_INDICES=ON. If
   PETSc and/or Trilinos are used, they must be compiled to support 64-bit
   indices. To write a code that can use 32-bit and 64-bit indices depending on
-  deal.II compilation option, use types::global_dof_index for all the global 
+  deal.II compilation option, use types::global_dof_index for all the global
   dof indices.
   <br>
   (Kainan Wang and Bruno Turcksin, 2013/06/05)
@@ -147,6 +147,12 @@ this function.
 
 <ol>
 
+<li> New: The function parallel::distributed::Triangulation::copy_triangulation() is
+now implemented.
+<br>
+(Martin Steigemann, 2013/07/02)
+</li>
+
 <li> New: TriaRawIterator::operator < (TriaRawIterator&) now implements a total ordering
 relation for cells even on distributed::parallel::Triangulation across processors.
 Additionally, TriaRawAccessor and CellAccessor now have an ordering relation.
@@ -506,14 +512,14 @@ sense.
 (Guido Kanschat, 2013/03/21)
 </li>
 
-<li> Added GridOut::write_svg() to allow for the output of 
-two-dimensional triangulations in two space dimensions in the SVG 
-format (Scalable Vector Graphics, an generic XML-based vector image 
-format developed and maintained by the World Wide Web Consortium W3C). 
-This function also provides cell coloring and cell labeling for the 
-visualization of basic cell properties. Pespective view is further 
-possible and the cell level number may be converted into altitude, 
-revealing the inactive cells lying below. 
+<li> Added GridOut::write_svg() to allow for the output of
+two-dimensional triangulations in two space dimensions in the SVG
+format (Scalable Vector Graphics, an generic XML-based vector image
+format developed and maintained by the World Wide Web Consortium W3C).
+This function also provides cell coloring and cell labeling for the
+visualization of basic cell properties. Pespective view is further
+possible and the cell level number may be converted into altitude,
+revealing the inactive cells lying below.
 <br>
 (Christian Wülker, 2013/03/21)
 </li>
@@ -541,12 +547,12 @@ This is now fixed.
 (Timo Heister, 2013/03/01)
 </li>
 
-<li> Added DataOutBase::write_svg() to allow for the output of a given 
+<li> Added DataOutBase::write_svg() to allow for the output of a given
 list of patches in two space dimensions in the SVG format (Scalable Vector
-Graphics, an generic XML-based vector image format developed and maintained 
-by the World Wide Web Consortium W3C). An additional dimension (z-direction) 
+Graphics, an generic XML-based vector image format developed and maintained
+by the World Wide Web Consortium W3C). An additional dimension (z-direction)
 is employed for the visualization of data values taken from a data vector.
-This function also provides patch coloring for the visual enhancement.  
+This function also provides patch coloring for the visual enhancement.
 <br>
 (Christian Wülker, 2013/05/10)
 </li>
index f18e075130cfdb12c38f132ab869e9b1671de066..bc4f5a88afdc60ab064add076f0a50d5ec1560d2 100644 (file)
@@ -3238,9 +3238,68 @@ namespace parallel
     template <int dim, int spacedim>
     void
     Triangulation<dim,spacedim>::
-    copy_triangulation (const dealii::Triangulation<dim, spacedim> &)
+    copy_triangulation (const dealii::Triangulation<dim, spacedim> &old_tria)
     {
-      Assert (false, ExcNotImplemented());
+      try
+        {
+          dealii::Triangulation<dim,spacedim>::
+            copy_triangulation (old_tria);
+       }
+      catch (const typename dealii::Triangulation<dim,spacedim>::DistortedCellList &)
+        {
+          // the underlying
+          // triangulation should not
+          // be checking for
+          // distorted cells
+          AssertThrow (false, ExcInternalError());
+        }
+
+      // note that now we have some content in
+      // the p4est objects and call the
+      // functions that do the actual work
+      // (which are dimension dependent, so
+      // separate)
+      triangulation_has_content = true;
+
+      Assert (old_tria.n_levels() == 1,
+              ExcMessage ("Parallel distributed triangulations can only be copied, "
+                          "if they are not refined!"));
+
+      if (const dealii::parallel::distributed::Triangulation<dim,spacedim> *
+         old_tria_x = dynamic_cast<const dealii::parallel::distributed::Triangulation<dim,spacedim> *>(&old_tria))
+        {
+          Assert (!old_tria_x->refinement_in_progress),
+                  ExcMessage ("Parallel distributed triangulations can only "
+                              "be copied, if no refinement is in progress!"));
+
+          mpi_communicator = Utilities::MPI::duplicate_communicator (old_tria_x->get_communicator ());
+
+          coarse_cell_to_p4est_tree_permutation = old_tria_x->coarse_cell_to_p4est_tree_permutation;
+          p4est_tree_to_coarse_cell_permutation = old_tria_x->p4est_tree_to_coarse_cell_permutation;
+          attached_data_size = old_tria_x->attached_data_size;
+          n_attached_datas   = old_tria_x->n_attached_datas;
+        }
+      else
+        {
+          setup_coarse_cell_to_p4est_tree_permutation ();
+        }
+
+      copy_new_triangulation_to_p4est (dealii::internal::int2type<dim>());
+
+      try
+        {
+          copy_local_forest_to_triangulation ();
+        }
+      catch (const typename Triangulation<dim>::DistortedCellList &)
+        {
+          // the underlying
+          // triangulation should not
+          // be checking for
+          // distorted cells
+          AssertThrow (false, ExcInternalError());
+        }
+
+      update_number_cache ();
     }
 
 

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.