mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: write patches as vtkPolyData instead of vtkUnstructuredGrid
- slightly better memory efficiency and file sizes - consistent with library reader
This commit is contained in:
@ -39,21 +39,16 @@ void Foam::writeFaceSet
|
||||
{
|
||||
const faceList& faces = vMesh.mesh().faces();
|
||||
|
||||
std::ofstream pStream(fileName.c_str());
|
||||
std::ofstream ostr(fileName.c_str());
|
||||
|
||||
pStream
|
||||
<< "# vtk DataFile Version 2.0" << std::endl
|
||||
<< set.name() << std::endl;
|
||||
if (binary)
|
||||
{
|
||||
pStream << "BINARY" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
pStream << "ASCII" << std::endl;
|
||||
}
|
||||
pStream << "DATASET POLYDATA" << std::endl;
|
||||
writeFuns::writeHeader
|
||||
(
|
||||
ostr,
|
||||
binary,
|
||||
set.name()
|
||||
);
|
||||
|
||||
ostr<< "DATASET POLYDATA" << std::endl;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
@ -79,13 +74,13 @@ void Foam::writeFaceSet
|
||||
|
||||
// Write points and faces as polygons
|
||||
|
||||
pStream << "POINTS " << fp.nPoints() << " float" << std::endl;
|
||||
ostr<< "POINTS " << fp.nPoints() << " float" << std::endl;
|
||||
|
||||
DynamicList<floatScalar> ptField(3*fp.nPoints());
|
||||
|
||||
writeFuns::insert(fp.localPoints(), ptField);
|
||||
|
||||
writeFuns::write(pStream, binary, ptField);
|
||||
writeFuns::write(ostr, binary, ptField);
|
||||
|
||||
|
||||
label nFaceVerts = 0;
|
||||
@ -94,8 +89,7 @@ void Foam::writeFaceSet
|
||||
{
|
||||
nFaceVerts += fp.localFaces()[faceI].size() + 1;
|
||||
}
|
||||
pStream << "POLYGONS " << fp.size() << ' ' << nFaceVerts
|
||||
<< std::endl;
|
||||
ostr<< "POLYGONS " << fp.size() << ' ' << nFaceVerts << std::endl;
|
||||
|
||||
|
||||
DynamicList<label> vertLabels(nFaceVerts);
|
||||
@ -108,7 +102,7 @@ void Foam::writeFaceSet
|
||||
|
||||
writeFuns::insert(f, vertLabels);
|
||||
}
|
||||
writeFuns::write(pStream, binary, vertLabels);
|
||||
writeFuns::write(ostr, binary, vertLabels);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
@ -119,14 +113,14 @@ void Foam::writeFaceSet
|
||||
|
||||
// Write faceID
|
||||
|
||||
pStream
|
||||
ostr
|
||||
<< "CELL_DATA " << fp.size() << std::endl
|
||||
<< "FIELD attributes 1" << std::endl;
|
||||
|
||||
// Cell ids first
|
||||
pStream << "faceID 1 " << fp.size() << " int" << std::endl;
|
||||
ostr<< "faceID 1 " << fp.size() << " int" << std::endl;
|
||||
|
||||
writeFuns::write(pStream, binary, setFaceLabels);
|
||||
writeFuns::write(ostr, binary, setFaceLabels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user