]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a clear () function which resets the triangulation to a basic state.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 16 Aug 1999 11:29:29 +0000 (11:29 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 16 Aug 1999 11:29:29 +0000 (11:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@1699 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria.h
deal.II/deal.II/source/grid/tria.cc

index 28ae990938d477e77ad5a749e3d8e12abf38032b..6a6fcfc136bb687c6e3042fcd96bc525e82cb0ad 100644 (file)
@@ -1635,6 +1635,12 @@ class Triangulation
                                      *  the hierarchy.
                                      */
     virtual ~Triangulation ();
+
+                                    /**
+                                     * Reset this triangulation into a
+                                     * virgin state by deleting all data.
+                                     */
+    void clear ();
     
                                     /**                                        
                                      * Assign a boundary object to
index 6d72d4002879f95da616c21cb952b5160e8a754d..39d182a569594ff64a702dd0cd2bc4d9a3352c07 100644 (file)
@@ -56,10 +56,31 @@ Triangulation<dim>::~Triangulation ()
 {
   for (unsigned int i=0; i<levels.size(); ++i)
     delete levels[i];
+  levels.clear ();
 
   for (unsigned int i=0;i<255;++i)
     boundary[i]->unsubscribe ();
+};
+
+
+
+template <int dim>
+void Triangulation<dim>::clear () 
+{
+  for (unsigned int i=0; i<levels.size(); ++i)
+    delete levels[i];
   levels.clear ();
+
+  vertices.clear ();
+  vertices_used.clear ();
+  
+  for (unsigned int i=0; i<255; ++i)
+    {
+      boundary[i]->unsubscribe ();
+      boundary[i] = 0;
+    };
+
+  number_cache = TriaNumberCache<dim>();
 };
 
 
@@ -161,6 +182,9 @@ void Triangulation<dim>::copy_triangulation (const Triangulation<dim> &old_tria)
   Assert (vertices.size() == 0, ExcTriangulationNotEmpty());
   Assert (levels.size () == 0, ExcTriangulationNotEmpty());
 
+  Assert (old_tria.levels.size() != 0, ExcInternalError());
+  Assert (old_tria.vertices.size() != 0, ExcInternalError());
+  
                                   // copy normal elements
   vertices      = old_tria.vertices;
   vertices_used = old_tria.vertices_used;

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.