From: Wolfgang Bangerth <bangerth@colostate.edu>
Date: Mon, 21 Nov 2022 18:02:18 +0000 (-0700)
Subject: Move declaration of vtu_stream to where it is used.
X-Git-Tag: v9.5.0-rc1~833^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14449%2Fhead;p=dealii.git

Move declaration of vtu_stream to where it is used.

While there, also use the underlying stream rather than vtu_out where possible.
---

diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc
index a6639db497..bfa6e2add1 100644
--- a/source/base/data_out_base.cc
+++ b/source/base/data_out_base.cc
@@ -6167,8 +6167,6 @@ namespace DataOutBase
     }
 
 
-    VtuStream vtu_out(out, flags);
-
     const unsigned int n_data_sets = data_names.size();
     // check against # of data sets in first patch. checks against all other
     // patches are made in write_gmv_reorder_data_vectors
@@ -6247,6 +6245,8 @@ namespace DataOutBase
     out << "  </Points>\n\n";
     //-------------------------------
     // now for the cells
+    VtuStream vtu_out(out, flags);
+
     out << "  <Cells>\n";
     out << "    <DataArray type=\"Int32\" Name=\"connectivity\" format=\""
         << ascii_or_binary << "\">\n";
@@ -6347,16 +6347,16 @@ namespace DataOutBase
         for (unsigned int i = 0; i < cell_types.size(); ++i)
           cell_types_uint8_t[i] = static_cast<std::uint8_t>(cell_types[i]);
 
-        vtu_out << vtu_stringize_array(cell_types_uint8_t,
-                                       flags.compression_level,
-                                       out.precision());
+        out << vtu_stringize_array(cell_types_uint8_t,
+                                   flags.compression_level,
+                                   out.precision());
       }
     else
 #endif
       {
-        vtu_out << vtu_stringize_array(cell_types,
-                                       flags.compression_level,
-                                       out.precision());
+        out << vtu_stringize_array(cell_types,
+                                   flags.compression_level,
+                                   out.precision());
       }
 
     out << '\n';