mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support VTK multi-piece output for surfaces
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,11 +32,11 @@ License
|
||||
void Foam::vtk::surfaceWriter::beginPiece()
|
||||
{
|
||||
// Basic sizes
|
||||
nLocalPoints_ = points_.size();
|
||||
nLocalFaces_ = faces_.size();
|
||||
nLocalPoints_ = points_.get().size();
|
||||
nLocalFaces_ = faces_.get().size();
|
||||
nLocalVerts_ = 0;
|
||||
|
||||
for (const face& f : faces_)
|
||||
for (const face& f : faces_.get())
|
||||
{
|
||||
nLocalVerts_ += f.size();
|
||||
}
|
||||
@ -90,7 +90,7 @@ void Foam::vtk::surfaceWriter::writePoints()
|
||||
if (parallel_ ? Pstream::master() : true)
|
||||
{
|
||||
{
|
||||
vtk::writeList(format(), points_);
|
||||
vtk::writeList(format(), points_.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ void Foam::vtk::surfaceWriter::writePoints()
|
||||
);
|
||||
|
||||
{
|
||||
toMaster << points_;
|
||||
toMaster << points_.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ void Foam::vtk::surfaceWriter::writePolysLegacy(const label pointOffset)
|
||||
label off = pointOffset;
|
||||
|
||||
{
|
||||
for (const face& f : faces_)
|
||||
for (const face& f : faces_.get())
|
||||
{
|
||||
*iter = f.size(); // The size prefix
|
||||
++iter;
|
||||
@ -193,7 +193,7 @@ void Foam::vtk::surfaceWriter::writePolysLegacy(const label pointOffset)
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
// off += points_.size();
|
||||
// off += points_.get().size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
||||
label off = pointOffset;
|
||||
|
||||
{
|
||||
for (const face& f : faces_)
|
||||
for (const face& f : faces_.get())
|
||||
{
|
||||
for (const label pfi : f)
|
||||
{
|
||||
@ -259,7 +259,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
// off += points_.size();
|
||||
// off += points_.get().size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
||||
auto iter = vertOffsets.begin();
|
||||
|
||||
{
|
||||
for (const face& f : faces_)
|
||||
for (const face& f : faces_.get())
|
||||
{
|
||||
off += f.size(); // End offset
|
||||
*iter = off;
|
||||
@ -355,8 +355,8 @@ Foam::vtk::surfaceWriter::surfaceWriter
|
||||
)
|
||||
:
|
||||
vtk::fileWriter(vtk::fileTag::POLY_DATA, opts),
|
||||
points_(points),
|
||||
faces_(faces),
|
||||
points_(std::cref<pointField>(points)),
|
||||
faces_(std::cref<faceList>(faces)),
|
||||
numberOfPoints_(0),
|
||||
numberOfCells_(0),
|
||||
nLocalPoints_(0),
|
||||
@ -473,4 +473,17 @@ void Foam::vtk::surfaceWriter::writeTimeValue()
|
||||
}
|
||||
|
||||
|
||||
void Foam::vtk::surfaceWriter::piece
|
||||
(
|
||||
const pointField& points,
|
||||
const faceList& faces
|
||||
)
|
||||
{
|
||||
endPiece();
|
||||
|
||||
points_ = std::cref<pointField>(points);
|
||||
faces_ = std::cref<faceList>(faces);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -51,6 +51,7 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "faceList.H"
|
||||
#include "instant.H"
|
||||
#include <functional>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -70,10 +71,10 @@ class surfaceWriter
|
||||
// Private Member Data
|
||||
|
||||
//- Reference to the points
|
||||
const pointField& points_;
|
||||
std::reference_wrapper<const pointField> points_;
|
||||
|
||||
//- Reference to the faces
|
||||
const faceList& faces_;
|
||||
std::reference_wrapper<const faceList> faces_;
|
||||
|
||||
//- The numer of field points for the current Piece
|
||||
label numberOfPoints_;
|
||||
@ -209,6 +210,9 @@ public:
|
||||
//- Write the currently set time as "TimeValue" FieldData
|
||||
void writeTimeValue();
|
||||
|
||||
//- Reset point, face references to begin a new piece
|
||||
void piece(const pointField& points, const faceList& faces);
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
|
||||
Reference in New Issue
Block a user