From cf05e2e1507037591662849f557a2842bb4f7956 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth <bangerth@math.tamu.edu> Date: Mon, 24 Jan 2011 04:18:28 +0000 Subject: [PATCH] Avoid trailing space in output files. git-svn-id: https://svn.dealii.org/trunk@23252 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/base/data_out_base.cc | 80 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/deal.II/source/base/data_out_base.cc b/deal.II/source/base/data_out_base.cc index 993244255c..c9d54809df 100644 --- a/deal.II/source/base/data_out_base.cc +++ b/deal.II/source/base/data_out_base.cc @@ -4333,7 +4333,7 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, << time->tm_hour << ":" << std::setw(2) << time->tm_min << ":" << std::setw(2) << time->tm_sec - << "\n --> \n"; + << "\n-->\n"; // LittleEndian vs BigEndian should not // matter; we are writing an ascii // file. @@ -4385,39 +4385,39 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, // note that according to the standard, we // have to print d=1..3 dimensions, even if // we are in reality in 2d, for example - out << "<Piece NumberOfPoints=\"" << n_nodes <<"\" NumberOfCells=\"" << n_cells << "\" > \n"; - out << " <Points> \n"; - out << " <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\"> \n"; + out << "<Piece NumberOfPoints=\"" << n_nodes <<"\" NumberOfCells=\"" << n_cells << "\" >\n"; + out << " <Points>\n"; + out << " <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\">\n"; write_nodes(patches, vtu_out); - out << " </DataArray> \n"; - out << " </Points> \n \n"; + out << " </DataArray>\n"; + out << " </Points>\n\n"; ///////////////////////////////// // now for the cells - out << " <Cells> \n"; - out << " <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\"> \n"; + out << " <Cells>\n"; + out << " <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n"; write_cells(patches, vtu_out); - out << " </DataArray> \n"; + out << " </DataArray>\n"; // XML VTU format uses offsets; this is // different than the VTK format, which // puts the number of nodes per cell in // front of the connectivity list. - out << " <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\"> \n"; + out << " <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n"; for(unsigned int i=0; i<n_cells; ++i) out << ' ' << ( (i+1)*GeometryInfo<dim>::vertices_per_cell); - out << " </DataArray> \n"; + out << " </DataArray>\n"; // next output the types of the // cells. since all cells are // the same, this is simple - out << " <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\"> \n"; + out << " <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n"; for (unsigned int i=0; i<n_cells; ++i) out << ' ' << vtk_cell_type[dim]; - out << " </DataArray> \n"; - out << " </Cells> \n"; + out << " </DataArray>\n"; + out << " </Cells>\n"; /////////////////////////////////////// @@ -4434,7 +4434,7 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, // we do not support explicitly // here). all following data sets // are point data - out << " <PointData Scalars=\"scalars\"> \n"; + out << " <PointData Scalars=\"scalars\">\n"; // when writing, first write out // all vector data, then handle the @@ -4480,7 +4480,7 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, out << data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; } - out << "\" NumberOfComponents=\"3\" format=\"ascii\"> \n"; + out << "\" NumberOfComponents=\"3\" format=\"ascii\">\n"; // now write data. pad all // vectors to have three @@ -4518,7 +4518,7 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, } } - out << " </DataArray> \n"; + out << " </DataArray>\n"; } // now do the left over scalar data sets @@ -4527,21 +4527,21 @@ DataOutBase::write_vtu (const std::vector<Patch<dim,spacedim> > &patches, { out << " <DataArray type=\"Float64\" Name=\"" << data_names[data_set] - << "\" format=\"ascii\"> \n"; + << "\" format=\"ascii\">\n"; std::copy (data_vectors[data_set].begin(), data_vectors[data_set].end(), std::ostream_iterator<double>(out, "\n")); out << '\n'; - out << " </DataArray> \n"; + out << " </DataArray>\n"; } - out << " </PointData> \n"; + out << " </PointData>\n"; // Finish up writing a valid XML file - out << " </Piece> \n"; - out << " </UnstructuredGrid> \n"; - out << "</VTKFile> \n"; + out << " </Piece>\n"; + out << " </UnstructuredGrid>\n"; + out << "</VTKFile>\n"; // make sure everything now gets to // disk out.flush (); @@ -4790,11 +4790,11 @@ DataOutInterface<dim,spacedim>::write_pvtu_record (std::ostream &out, const unsigned int n_data_sets = data_names.size(); - out << "<?xml version=\"1.0\"?> \n"; + out << "<?xml version=\"1.0\"?>\n"; std::time_t time1= std::time (0); std::tm *time = std::localtime(&time1); - out << "<!-- \n"; + out << "<!--\n"; out << "#This file was generated by the deal.II library on " << time->tm_year+1900 << "/" << time->tm_mon+1 << "/" @@ -4802,14 +4802,14 @@ DataOutInterface<dim,spacedim>::write_pvtu_record (std::ostream &out, << time->tm_hour << ":" << std::setw(2) << time->tm_min << ":" << std::setw(2) << time->tm_sec - << "\n --> \n"; + << "\n-->\n"; - out << "<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\"> \n"; - out << " <PUnstructuredGrid GhostLevel=\"0\"> \n"; - out << " <PPointData Scalars=\"scalars\"> \n"; - - // We need to output in the same order as the write_vtu function does: + out << "<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n"; + out << " <PUnstructuredGrid GhostLevel=\"0\">\n"; + out << " <PPointData Scalars=\"scalars\">\n"; + // We need to output in the same order as + // the write_vtu function does: std::vector<bool> data_set_written (n_data_sets, false); for (unsigned int n_th_vector=0; n_th_vector<vector_data_ranges.size(); ++n_th_vector) { @@ -4850,7 +4850,7 @@ DataOutInterface<dim,spacedim>::write_pvtu_record (std::ostream &out, out << data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; } - out << "\" NumberOfComponents=\"3\" format=\"ascii\"/> \n"; + out << "\" NumberOfComponents=\"3\" format=\"ascii\"/>\n"; } for (unsigned int data_set=0; data_set<n_data_sets; ++data_set) @@ -4858,20 +4858,20 @@ DataOutInterface<dim,spacedim>::write_pvtu_record (std::ostream &out, { out << " <PDataArray type=\"Float64\" Name=\"" << data_names[data_set] - << "\" format=\"ascii\"/> \n"; + << "\" format=\"ascii\"/>\n"; } - out << " </PPointData> \n"; + out << " </PPointData>\n"; - out << " <PPoints> \n"; - out << " <PDataArray type=\"Float64\" NumberOfComponents=\"3\"/> \n"; - out << " </PPoints> \n"; + out << " <PPoints>\n"; + out << " <PDataArray type=\"Float64\" NumberOfComponents=\"3\"/>\n"; + out << " </PPoints>\n"; for(unsigned int i=0; i<piece_names.size(); ++i) - out << " <Piece Source=\"" << piece_names[i] << "\"/> \n"; + out << " <Piece Source=\"" << piece_names[i] << "\"/>\n"; - out << " </PUnstructuredGrid> \n"; - out << "</VTKFile> \n"; + out << " </PUnstructuredGrid>\n"; + out << "</VTKFile>\n"; out.flush(); -- 2.39.5