]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make DataOutReader::read() backwards compatible with old version of the deal.II inter...
authorleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Jan 2007 07:49:55 +0000 (07:49 +0000)
committerleicht <leicht@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 30 Jan 2007 07:49:55 +0000 (07:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@14394 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/data_out_base.cc

index 4ead59c4c185aba8b3fcc4aa5f4f9284512f1bdd..009e5c7486eace278d9a35df934932b7d6f2a4a1 100644 (file)
@@ -4131,8 +4131,41 @@ operator >> (std::istream                     &in,
   for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
     in >> patch.neighbors[i];
 
-  in >> patch.patch_index >> patch.n_subdivisions >> patch.points_are_available;
+  in >> patch.patch_index >> patch.n_subdivisions;
 
+  {
+                                    // we would like to use
+                                    //   in >> patch.points_are_available;
+                                    // here, but in order to be compatible with
+                                    // older versions of the deal.II intermediate
+                                    // format, which did not contain this flag,
+                                    // we have to do it a bit more complicated.
+    
+    std::string line;
+                                    // eat the rest of the previous line
+    getline (in, line);
+                                    // now get the line that should contain the
+                                    // flag points_are_available
+    getline (in,line);
+    if (line=="1" || line=="true")
+      patch.points_are_available=true;
+    else if (line=="0" || line=="false")
+      patch.points_are_available=false;
+    else
+      {
+                                        // this is not the line we searched
+                                        // for, so this must be the old format,
+                                        // i.e. we have no points available
+       patch.points_are_available=false;
+                                        // put back the line, because it needs
+                                        // to be read in the following
+       in.putback('\n');
+       for (int c=line.length()-1; c>=0; --c)
+         in.putback(line[c]);
+       in.putback('\n');
+      }
+  }
+  
   unsigned int n_rows, n_cols;
   in >> n_rows >> n_cols;
   patch.data.reinit (n_rows, n_cols);

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.