From bce810d3c23166d612f915ab58cd59d25c2e3413 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 Jul 2013 15:28:54 +0000 Subject: [PATCH] Patch by Martin Steigemann: implement parallel::distributed::Triangulation::copy_triangulation. git-svn-id: https://svn.dealii.org/trunk@29909 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 36 ++++++++++------- deal.II/source/distributed/tria.cc | 63 +++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 17 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index fb6ef1dbb1..738e2a2d44 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -71,11 +71,11 @@ this function.
    -
  1. 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 +
  2. 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.
    (Kainan Wang and Bruno Turcksin, 2013/06/05) @@ -147,6 +147,12 @@ this function.
      +
    1. New: The function parallel::distributed::Triangulation::copy_triangulation() is +now implemented. +
      +(Martin Steigemann, 2013/07/02) +
    2. +
    3. 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)
    4. -
    5. 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. +
    6. 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.
      (Christian Wülker, 2013/03/21)
    7. @@ -541,12 +547,12 @@ This is now fixed. (Timo Heister, 2013/03/01) -
    8. Added DataOutBase::write_svg() to allow for the output of a given +
    9. 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.
      (Christian Wülker, 2013/05/10)
    10. diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index f18e075130..bc4f5a88af 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -3238,9 +3238,68 @@ namespace parallel template void Triangulation:: - copy_triangulation (const dealii::Triangulation &) + copy_triangulation (const dealii::Triangulation &old_tria) { - Assert (false, ExcNotImplemented()); + try + { + dealii::Triangulation:: + copy_triangulation (old_tria); + } + catch (const typename dealii::Triangulation::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 * + old_tria_x = dynamic_cast *>(&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()); + + try + { + copy_local_forest_to_triangulation (); + } + catch (const typename Triangulation::DistortedCellList &) + { + // the underlying + // triangulation should not + // be checking for + // distorted cells + AssertThrow (false, ExcInternalError()); + } + + update_number_cache (); } -- 2.39.5