Commit 07b9171d authored by Marcus Mohr's avatar Marcus Mohr
Browse files

Small update to VTKP1Writer

Opening and closing of <DataArray> element is now handled inside
writeScalarFunction and writeVectorFunction.
parent 8b049d45
......@@ -49,7 +49,7 @@ inline void writeXMLHeader( std::ostream& output )
{
output << "<?xml version=\"1.0\"?>\n";
output << "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\">\n";
output << " <UnstructuredGrid>\n";
output << "<UnstructuredGrid>\n";
}
}
......@@ -57,7 +57,7 @@ inline void writeXMLFooter( std::ostream& output )
{
WALBERLA_ROOT_SECTION()
{
output << " </UnstructuredGrid>\n";
output << "</UnstructuredGrid>\n";
output << "</VTKFile>\n";
}
}
......
......@@ -76,17 +76,12 @@ void VTKP1Writer::write( const VTKOutput& mgr, std::ostream& output, const uint_
for ( const auto& function : mgr.p1Functions_ )
{
vtk::openDataElement( output, typeToString< real_t >(), function.getFunctionName(), 1, mgr.vtkDataFormat_ );
writeScalarFunction( output, function, storage, level, mgr.write2D_, mgr.vtkDataFormat_ );
output << "\n</DataArray>\n";
}
for ( const auto& function : mgr.p1VecFunctions_ )
{
uint_t dim = mgr.write2D_ ? 2 : 3;
vtk::openDataElement( output, typeToString< real_t >(), function.getFunctionName(), dim, mgr.vtkDataFormat_ );
writeVectorFunction( output, function, storage, level, mgr.write2D_, mgr.vtkDataFormat_ );
output << "\n</DataArray>\n";
}
output << "</PointData>\n";
......@@ -105,6 +100,8 @@ void VTKP1Writer::writeScalarFunction( std::ostream&
VTKOutput::VTKStreamWriter< ScalarType > streamWriter( vtkDataFormat );
vtk::openDataElement( output, typeToString< real_t >(), function.getFunctionName(), 1, vtkDataFormat );
if ( write2D )
{
for ( const auto& it : storage->getFaces() )
......@@ -134,6 +131,8 @@ void VTKP1Writer::writeScalarFunction( std::ostream&
}
streamWriter.toStream( output );
output << "\n</DataArray>\n";
}
void VTKP1Writer::writeVectorFunction( std::ostream& output,
......@@ -147,6 +146,9 @@ void VTKP1Writer::writeVectorFunction( std::ostream&
VTKOutput::VTKStreamWriter< ScalarType > streamWriter( vtkDataFormat );
uint_t dim = write2D ? 2 : 3;
vtk::openDataElement( output, typeToString< real_t >(), function.getFunctionName(), dim, vtkDataFormat );
if ( write2D )
{
for ( const auto& it : storage->getFaces() )
......@@ -182,6 +184,8 @@ void VTKP1Writer::writeVectorFunction( std::ostream&
}
streamWriter.toStream( output );
output << "\n</DataArray>\n";
}
} // namespace hyteg
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment