]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added support of codim one meshes to PersistentTriangulation
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 16 May 2011 10:48:56 +0000 (10:48 +0000)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 16 May 2011 10:48:56 +0000 (10:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@23696 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/grid/persistent_tria.h
deal.II/source/grid/persistent_tria.cc

index cdfa4979216be4acf2ecc21836fd1fb52a1f8c20..a08f1b027e1deb5edb3ace9a26cfbbb80d070b09 100644 (file)
@@ -30,6 +30,11 @@ inconvenience this causes.
 
 <ol>
 
+<li> New: The PersistentTriangulation class now works also in
+the codimension one case.
+<br>
+(Luca Heltai, 2011/05/16)
+
 <li> New: The SparseDirectUMFPACK class can now also deal with matrices
 provided in SparseMatrixEZ format.
 <br>
index fa9cada2640041fa7ac11000b3d61b481012a1a0..abac7d1574d187301f72afe19bf905a9b1a56302 100644 (file)
@@ -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 <int dim>
-class PersistentTriangulation : public Triangulation<dim> 
+template <int dim, int spacedim=dim>
+class PersistentTriangulation : public Triangulation<dim, spacedim
 {
   public:    
                                     /**
@@ -109,6 +109,7 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * 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<dim>
                                      * be used upon reconstruction of the
                                      * grid.
                                      */
-    PersistentTriangulation (const Triangulation<dim> &coarse_grid);
+    PersistentTriangulation (const Triangulation<dim, spacedim> &coarse_grid);
 
                                     /**
                                      * Copy constructor. This operation
@@ -134,7 +135,7 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * as well as the pointer to the
                                      * coarse grid are copied, however.
                                      */
-    PersistentTriangulation (const PersistentTriangulation<dim> &old_tria);
+    PersistentTriangulation (const PersistentTriangulation<dim, spacedim> &old_tria);
     
                                     /**
                                      * Destructor.
@@ -215,14 +216,14 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * be used upon reconstruction of the
                                      * grid.
                                      */
-    virtual void copy_triangulation (const Triangulation<dim> &tria);
+    virtual void copy_triangulation (const Triangulation<dim, spacedim> &tria);
 
                                     /**
                                      * Throw an error, since this function
                                      * is not useful in the context of this
                                      * class.
                                      */
-    virtual void create_triangulation (const std::vector<Point<dim> >    &vertices,
+    virtual void create_triangulation (const std::vector<Point<spacedim> >    &vertices,
                                       const std::vector<CellData<dim> > &cells,
                                       const SubCellData                 &subcelldata);
 
@@ -235,7 +236,7 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * class.
                                      */
     virtual void create_triangulation_compatibility (
-      const std::vector<Point<dim> >    &vertices,
+      const std::vector<Point<spacedim> >    &vertices,
       const std::vector<CellData<dim> > &cells,
       const SubCellData                 &subcelldata);
 
@@ -282,7 +283,7 @@ class PersistentTriangulation : public Triangulation<dim>
                                      * This grid shall be used as coarse
                                      * grid.
                                      */
-    SmartPointer<const Triangulation<dim>,PersistentTriangulation<dim> > coarse_grid;
+    SmartPointer<const Triangulation<dim,spacedim>,PersistentTriangulation<dim,spacedim> > coarse_grid;
     
                                     /**
                                      * Vectors holding the refinement and
index 987b84432381062fa3e771a837f69b32e5c9b0c3..168f0af7d66f1dd8b6112f35793d74fbecebb6ce 100644 (file)
 DEAL_II_NAMESPACE_OPEN
 
 
-template <int dim>
+template <int dim, int spacedim>
 const unsigned int
-PersistentTriangulation<dim>::dimension;
+PersistentTriangulation<dim,spacedim>::dimension;
+
+template <int dim, int spacedim>
+const unsigned int
+PersistentTriangulation<dim,spacedim>::spacedimension;
 
 
-template <int dim>
-PersistentTriangulation<dim>::
-PersistentTriangulation (const Triangulation<dim> &coarse_grid)
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::
+PersistentTriangulation (const Triangulation<dim,spacedim> &coarse_grid)
                 :
                coarse_grid (&coarse_grid, typeid(*this).name())
 {}
 
 
 
-template <int dim>
-PersistentTriangulation<dim>::
-PersistentTriangulation (const PersistentTriangulation<dim> &old_tria)
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::
+PersistentTriangulation (const PersistentTriangulation<dim,spacedim> &old_tria)
                 :
                                                 // default initialize
                                                 // tria, i.e. it will be
                                                 // empty on first use
-               Triangulation<dim> (),
+               Triangulation<dim,spacedim> (),
                 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<dim> &old_tria)
 
 
 
-template <int dim>
-PersistentTriangulation<dim>::~PersistentTriangulation ()
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::~PersistentTriangulation ()
 {}
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::execute_coarsening_and_refinement ()
+PersistentTriangulation<dim,spacedim>::execute_coarsening_and_refinement ()
 {
                                   // first save flags
   refine_flags.push_back (std::vector<bool>());
@@ -71,14 +75,14 @@ PersistentTriangulation<dim>::execute_coarsening_and_refinement ()
                                   // this function throws an
                                   // exception, that's fine since it
                                   // is the last call here
-  Triangulation<dim>::execute_coarsening_and_refinement ();
+  Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
 }
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::restore ()
+PersistentTriangulation<dim,spacedim>::restore ()
 {
                                   // for each of the previous
                                   // refinement sweeps
@@ -88,9 +92,9 @@ PersistentTriangulation<dim>::restore ()
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::restore (const unsigned int step)
+PersistentTriangulation<dim,spacedim>::restore (const unsigned int step)
 {
 
   if (step==0)
@@ -98,7 +102,7 @@ PersistentTriangulation<dim>::restore (const unsigned int step)
                                     // this will yield an error if
                                     // the underlying triangulation
                                     // was not empty
-    Triangulation<dim>::copy_triangulation (*coarse_grid);
+    Triangulation<dim,spacedim>::copy_triangulation (*coarse_grid);
   else
                                     // for each of the previous
                                     // refinement sweeps
@@ -109,24 +113,24 @@ PersistentTriangulation<dim>::restore (const unsigned int step)
       this->load_refine_flags  (refine_flags[step-1]);
       this->load_coarsen_flags (coarsen_flags[step-1]);
 
-      Triangulation<dim>::execute_coarsening_and_refinement ();
+      Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
     }
 }
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 unsigned int
-PersistentTriangulation<dim>::n_refinement_steps() const
+PersistentTriangulation<dim,spacedim>::n_refinement_steps() const
 {
   return refine_flags.size();
 }
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::copy_triangulation (const Triangulation<dim> &old_grid)
+PersistentTriangulation<dim,spacedim>::copy_triangulation (const Triangulation<dim,spacedim> &old_grid)
 {
   this->clear ();
   coarse_grid  = &old_grid;
@@ -136,9 +140,9 @@ PersistentTriangulation<dim>::copy_triangulation (const Triangulation<dim> &old_
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::create_triangulation (const std::vector<Point<dim> >    &,
+PersistentTriangulation<dim,spacedim>::create_triangulation (const std::vector<Point<spacedim> >    &,
                                                    const std::vector<CellData<dim> > &,
                                                    const SubCellData                 &)
 {
@@ -147,10 +151,10 @@ PersistentTriangulation<dim>::create_triangulation (const std::vector<Point<dim>
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::create_triangulation_compatibility (
-  const std::vector<Point<dim> >    &,
+PersistentTriangulation<dim,spacedim>::create_triangulation_compatibility (
+  const std::vector<Point<spacedim> >    &,
   const std::vector<CellData<dim> > &,
   const SubCellData                 &)
 {
@@ -159,9 +163,9 @@ PersistentTriangulation<dim>::create_triangulation_compatibility (
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::write_flags(std::ostream &out) const
+PersistentTriangulation<dim,spacedim>::write_flags(std::ostream &out) const
 {
   const unsigned int n_flag_levels=refine_flags.size();
 
@@ -184,9 +188,9 @@ PersistentTriangulation<dim>::write_flags(std::ostream &out) const
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::read_flags(std::istream &in)
+PersistentTriangulation<dim,spacedim>::read_flags(std::istream &in)
 {
   Assert(refine_flags.size()==0 && coarsen_flags.size()==0,
         ExcFlagsNotCleared());
@@ -218,9 +222,9 @@ PersistentTriangulation<dim>::read_flags(std::istream &in)
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-PersistentTriangulation<dim>::clear_flags()
+PersistentTriangulation<dim,spacedim>::clear_flags()
 {
   refine_flags.clear();
   coarsen_flags.clear();
@@ -228,11 +232,11 @@ PersistentTriangulation<dim>::clear_flags()
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 std::size_t
-PersistentTriangulation<dim>::memory_consumption () const
+PersistentTriangulation<dim,spacedim>::memory_consumption () const
 {
-  return (Triangulation<dim>::memory_consumption () +
+  return (Triangulation<dim,spacedim>::memory_consumption () +
          MemoryConsumption::memory_consumption (coarse_grid) +
          MemoryConsumption::memory_consumption (refine_flags) +
          MemoryConsumption::memory_consumption (coarsen_flags));
@@ -243,6 +247,8 @@ PersistentTriangulation<dim>::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
 

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.