From 7f76be1862b42ae4086389d5327074e2037f4aa8 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 16 May 2011 10:48:56 +0000 Subject: [PATCH] Added support of codim one meshes to PersistentTriangulation git-svn-id: https://svn.dealii.org/trunk@23696 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 5 ++ .../include/deal.II/grid/persistent_tria.h | 19 +++-- deal.II/source/grid/persistent_tria.cc | 82 ++++++++++--------- 3 files changed, 59 insertions(+), 47 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index cdfa497921..a08f1b027e 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -30,6 +30,11 @@ inconvenience this causes.
    +
  1. New: The PersistentTriangulation class now works also in +the codimension one case. +
    +(Luca Heltai, 2011/05/16) +
  2. New: The SparseDirectUMFPACK class can now also deal with matrices provided in SparseMatrixEZ format.
    diff --git a/deal.II/include/deal.II/grid/persistent_tria.h b/deal.II/include/deal.II/grid/persistent_tria.h index fa9cada264..abac7d1574 100644 --- a/deal.II/include/deal.II/grid/persistent_tria.h +++ b/deal.II/include/deal.II/grid/persistent_tria.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -100,8 +100,8 @@ DEAL_II_NAMESPACE_OPEN * @ingroup grid * @author Wolfgang Bangerth, 1999 */ -template -class PersistentTriangulation : public Triangulation +template +class PersistentTriangulation : public Triangulation { public: /** @@ -109,6 +109,7 @@ class PersistentTriangulation : public Triangulation * in function templates. */ static const unsigned int dimension = dim; + static const unsigned int spacedimension = spacedim; /** * Build up the triangulation from the @@ -124,7 +125,7 @@ class PersistentTriangulation : public Triangulation * be used upon reconstruction of the * grid. */ - PersistentTriangulation (const Triangulation &coarse_grid); + PersistentTriangulation (const Triangulation &coarse_grid); /** * Copy constructor. This operation @@ -134,7 +135,7 @@ class PersistentTriangulation : public Triangulation * as well as the pointer to the * coarse grid are copied, however. */ - PersistentTriangulation (const PersistentTriangulation &old_tria); + PersistentTriangulation (const PersistentTriangulation &old_tria); /** * Destructor. @@ -215,14 +216,14 @@ class PersistentTriangulation : public Triangulation * be used upon reconstruction of the * grid. */ - virtual void copy_triangulation (const Triangulation &tria); + virtual void copy_triangulation (const Triangulation &tria); /** * Throw an error, since this function * is not useful in the context of this * class. */ - virtual void create_triangulation (const std::vector > &vertices, + virtual void create_triangulation (const std::vector > &vertices, const std::vector > &cells, const SubCellData &subcelldata); @@ -235,7 +236,7 @@ class PersistentTriangulation : public Triangulation * class. */ virtual void create_triangulation_compatibility ( - const std::vector > &vertices, + const std::vector > &vertices, const std::vector > &cells, const SubCellData &subcelldata); @@ -282,7 +283,7 @@ class PersistentTriangulation : public Triangulation * This grid shall be used as coarse * grid. */ - SmartPointer,PersistentTriangulation > coarse_grid; + SmartPointer,PersistentTriangulation > coarse_grid; /** * Vectors holding the refinement and diff --git a/deal.II/source/grid/persistent_tria.cc b/deal.II/source/grid/persistent_tria.cc index 987b844323..168f0af7d6 100644 --- a/deal.II/source/grid/persistent_tria.cc +++ b/deal.II/source/grid/persistent_tria.cc @@ -20,28 +20,32 @@ DEAL_II_NAMESPACE_OPEN -template +template const unsigned int -PersistentTriangulation::dimension; +PersistentTriangulation::dimension; + +template +const unsigned int +PersistentTriangulation::spacedimension; -template -PersistentTriangulation:: -PersistentTriangulation (const Triangulation &coarse_grid) +template +PersistentTriangulation:: +PersistentTriangulation (const Triangulation &coarse_grid) : coarse_grid (&coarse_grid, typeid(*this).name()) {} -template -PersistentTriangulation:: -PersistentTriangulation (const PersistentTriangulation &old_tria) +template +PersistentTriangulation:: +PersistentTriangulation (const PersistentTriangulation &old_tria) : // default initialize // tria, i.e. it will be // empty on first use - Triangulation (), + Triangulation (), coarse_grid (old_tria.coarse_grid), refine_flags (old_tria.refine_flags), coarsen_flags (old_tria.coarsen_flags) @@ -51,15 +55,15 @@ PersistentTriangulation (const PersistentTriangulation &old_tria) -template -PersistentTriangulation::~PersistentTriangulation () +template +PersistentTriangulation::~PersistentTriangulation () {} -template +template void -PersistentTriangulation::execute_coarsening_and_refinement () +PersistentTriangulation::execute_coarsening_and_refinement () { // first save flags refine_flags.push_back (std::vector()); @@ -71,14 +75,14 @@ PersistentTriangulation::execute_coarsening_and_refinement () // this function throws an // exception, that's fine since it // is the last call here - Triangulation::execute_coarsening_and_refinement (); + Triangulation::execute_coarsening_and_refinement (); } -template +template void -PersistentTriangulation::restore () +PersistentTriangulation::restore () { // for each of the previous // refinement sweeps @@ -88,9 +92,9 @@ PersistentTriangulation::restore () -template +template void -PersistentTriangulation::restore (const unsigned int step) +PersistentTriangulation::restore (const unsigned int step) { if (step==0) @@ -98,7 +102,7 @@ PersistentTriangulation::restore (const unsigned int step) // this will yield an error if // the underlying triangulation // was not empty - Triangulation::copy_triangulation (*coarse_grid); + Triangulation::copy_triangulation (*coarse_grid); else // for each of the previous // refinement sweeps @@ -109,24 +113,24 @@ PersistentTriangulation::restore (const unsigned int step) this->load_refine_flags (refine_flags[step-1]); this->load_coarsen_flags (coarsen_flags[step-1]); - Triangulation::execute_coarsening_and_refinement (); + Triangulation::execute_coarsening_and_refinement (); } } -template +template unsigned int -PersistentTriangulation::n_refinement_steps() const +PersistentTriangulation::n_refinement_steps() const { return refine_flags.size(); } -template +template void -PersistentTriangulation::copy_triangulation (const Triangulation &old_grid) +PersistentTriangulation::copy_triangulation (const Triangulation &old_grid) { this->clear (); coarse_grid = &old_grid; @@ -136,9 +140,9 @@ PersistentTriangulation::copy_triangulation (const Triangulation &old_ -template +template void -PersistentTriangulation::create_triangulation (const std::vector > &, +PersistentTriangulation::create_triangulation (const std::vector > &, const std::vector > &, const SubCellData &) { @@ -147,10 +151,10 @@ PersistentTriangulation::create_triangulation (const std::vector -template +template void -PersistentTriangulation::create_triangulation_compatibility ( - const std::vector > &, +PersistentTriangulation::create_triangulation_compatibility ( + const std::vector > &, const std::vector > &, const SubCellData &) { @@ -159,9 +163,9 @@ PersistentTriangulation::create_triangulation_compatibility ( -template +template void -PersistentTriangulation::write_flags(std::ostream &out) const +PersistentTriangulation::write_flags(std::ostream &out) const { const unsigned int n_flag_levels=refine_flags.size(); @@ -184,9 +188,9 @@ PersistentTriangulation::write_flags(std::ostream &out) const -template +template void -PersistentTriangulation::read_flags(std::istream &in) +PersistentTriangulation::read_flags(std::istream &in) { Assert(refine_flags.size()==0 && coarsen_flags.size()==0, ExcFlagsNotCleared()); @@ -218,9 +222,9 @@ PersistentTriangulation::read_flags(std::istream &in) -template +template void -PersistentTriangulation::clear_flags() +PersistentTriangulation::clear_flags() { refine_flags.clear(); coarsen_flags.clear(); @@ -228,11 +232,11 @@ PersistentTriangulation::clear_flags() -template +template std::size_t -PersistentTriangulation::memory_consumption () const +PersistentTriangulation::memory_consumption () const { - return (Triangulation::memory_consumption () + + return (Triangulation::memory_consumption () + MemoryConsumption::memory_consumption (coarse_grid) + MemoryConsumption::memory_consumption (refine_flags) + MemoryConsumption::memory_consumption (coarsen_flags)); @@ -243,6 +247,8 @@ PersistentTriangulation::memory_consumption () const template class PersistentTriangulation<1>; template class PersistentTriangulation<2>; template class PersistentTriangulation<3>; +template class PersistentTriangulation<1,2>; +template class PersistentTriangulation<2,3>; DEAL_II_NAMESPACE_CLOSE -- 2.39.5