]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a long-standing bug with user flags being not stored in the right way. Some of...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 13:10:39 +0000 (13:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 10 Aug 1999 13:10:39 +0000 (13:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@1658 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 5da8eb673aae1447eccef77aec1f9c0b4713d580..0e3b28771d36af2cec8fea8b78b9ab3220688e44 100644 (file)
@@ -2066,6 +2066,8 @@ class Triangulation
                                     /**
                                      * Same as above, but store the flags to
                                      * a bitvector rather than to a file.
+                                     * The output vector is resized if
+                                     * necessary.
                                      */
     void save_user_flags (vector<bool> &v) const;
 
@@ -2089,6 +2091,8 @@ class Triangulation
                                     /**
                                      * Same as above, but store the flags to
                                      * a bitvector rather than to a file.
+                                     * The output vector is resized if
+                                     * necessary.
                                      */
     void save_user_flags_line (vector<bool> &v) const;
 
@@ -2110,6 +2114,8 @@ class Triangulation
                                     /**
                                      * Same as above, but store the flags to
                                      * a bitvector rather than to a file.
+                                     * The output vector is resized if
+                                     * necessary.
                                      */
     void save_user_flags_quad (vector<bool> &v) const;
 
@@ -2131,6 +2137,8 @@ class Triangulation
                                     /**
                                      * Same as above, but store the flags to
                                      * a bitvector rather than to a file.
+                                     * The output vector is resized if
+                                     * necessary.
                                      */
     void save_user_flags_hex (vector<bool> &v) const;
 
index 98e3785f8aa1e79d64dac77ea6977343086114ce..7d1fb653c543188aefe847cf4e6b9d2caab8a921 100644 (file)
@@ -1414,20 +1414,6 @@ void Triangulation<1>::clear_user_flags () {
     cell->clear_user_flag ();
 };
 
-
-
-template <>
-void Triangulation<1>::save_user_flags (ostream &out) const {
-  save_user_flags_line (out);
-};
-
-
-
-template <>
-void Triangulation<1>::save_user_flags (vector<bool> &v) const {
-  save_user_flags_line (v);
-};
-
 #endif
 
 
@@ -1462,22 +1448,6 @@ void Triangulation<2>::clear_user_flags () {
 };
 
 
-
-template <>
-void Triangulation<2>::save_user_flags (ostream &out) const {
-  save_user_flags_line (out);
-  save_user_flags_quad (out);
-};
-
-
-
-template <>
-void Triangulation<2>::save_user_flags (vector<bool> &v) const {
-  save_user_flags_line (v);
-  save_user_flags_quad (v);
-};
-
-
 #endif
 
 
@@ -1524,25 +1494,47 @@ void Triangulation<3>::clear_user_flags () {
 };
 
 
+#endif
+
 
-template <>
-void Triangulation<3>::save_user_flags (ostream &out) const {
+
+
+template <int dim>
+void Triangulation<dim>::save_user_flags (ostream &out) const {
   save_user_flags_line (out);
-  save_user_flags_quad (out);
-  save_user_flags_hex (out);
+  
+  if (dim>=2)
+    save_user_flags_quad (out);
+  
+  if (dim>=3)
+    save_user_flags_hex (out);
 };
 
 
 
-template <>
-void Triangulation<3>::save_user_flags (vector<bool> &v) const {
-  save_user_flags_line (v);
-  save_user_flags_quad (v);
-  save_user_flags_hex (v);
-};
+template <int dim>
+void Triangulation<dim>::save_user_flags (vector<bool> &v) const {
+                                  // clear vector and append
+                                  // all the stuff later on
+  v.clear ();
 
+  vector<bool> tmp;
 
-#endif
+  save_user_flags_line (tmp);
+  v.insert (v.end(), tmp.begin(), tmp.end());
+
+  if (dim >= 2)
+    {
+      save_user_flags_quad (tmp);
+      v.insert (v.end(), tmp.begin(), tmp.end());
+    };
+  
+  if (dim >= 3)
+    {
+      save_user_flags_hex (tmp);
+      v.insert (v.end(), tmp.begin(), tmp.end());
+    };      
+};
 
 
 

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.