From 7547fc8a34871c104db03ba3c09402d0ed15e4c4 Mon Sep 17 00:00:00 2001 From: leicht Date: Tue, 30 Jan 2007 07:49:55 +0000 Subject: [PATCH] Make DataOutReader::read() backwards compatible with old version of the deal.II intermediate format. git-svn-id: https://svn.dealii.org/trunk@14394 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/data_out_base.cc | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 4ead59c4c1..009e5c7486 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -4131,8 +4131,41 @@ operator >> (std::istream &in, for (unsigned int i=0; i::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); -- 2.39.5