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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,11 +32,11 @@ License
|
|||||||
void Foam::vtk::surfaceWriter::beginPiece()
|
void Foam::vtk::surfaceWriter::beginPiece()
|
||||||
{
|
{
|
||||||
// Basic sizes
|
// Basic sizes
|
||||||
nLocalPoints_ = points_.size();
|
nLocalPoints_ = points_.get().size();
|
||||||
nLocalFaces_ = faces_.size();
|
nLocalFaces_ = faces_.get().size();
|
||||||
nLocalVerts_ = 0;
|
nLocalVerts_ = 0;
|
||||||
|
|
||||||
for (const face& f : faces_)
|
for (const face& f : faces_.get())
|
||||||
{
|
{
|
||||||
nLocalVerts_ += f.size();
|
nLocalVerts_ += f.size();
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ void Foam::vtk::surfaceWriter::writePoints()
|
|||||||
if (parallel_ ? Pstream::master() : true)
|
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;
|
label off = pointOffset;
|
||||||
|
|
||||||
{
|
{
|
||||||
for (const face& f : faces_)
|
for (const face& f : faces_.get())
|
||||||
{
|
{
|
||||||
*iter = f.size(); // The size prefix
|
*iter = f.size(); // The size prefix
|
||||||
++iter;
|
++iter;
|
||||||
@ -193,7 +193,7 @@ void Foam::vtk::surfaceWriter::writePolysLegacy(const label pointOffset)
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// off += points_.size();
|
// off += points_.get().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
|||||||
label off = pointOffset;
|
label off = pointOffset;
|
||||||
|
|
||||||
{
|
{
|
||||||
for (const face& f : faces_)
|
for (const face& f : faces_.get())
|
||||||
{
|
{
|
||||||
for (const label pfi : f)
|
for (const label pfi : f)
|
||||||
{
|
{
|
||||||
@ -259,7 +259,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// off += points_.size();
|
// off += points_.get().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ void Foam::vtk::surfaceWriter::writePolys(const label pointOffset)
|
|||||||
auto iter = vertOffsets.begin();
|
auto iter = vertOffsets.begin();
|
||||||
|
|
||||||
{
|
{
|
||||||
for (const face& f : faces_)
|
for (const face& f : faces_.get())
|
||||||
{
|
{
|
||||||
off += f.size(); // End offset
|
off += f.size(); // End offset
|
||||||
*iter = off;
|
*iter = off;
|
||||||
@ -355,8 +355,8 @@ Foam::vtk::surfaceWriter::surfaceWriter
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
vtk::fileWriter(vtk::fileTag::POLY_DATA, opts),
|
vtk::fileWriter(vtk::fileTag::POLY_DATA, opts),
|
||||||
points_(points),
|
points_(std::cref<pointField>(points)),
|
||||||
faces_(faces),
|
faces_(std::cref<faceList>(faces)),
|
||||||
numberOfPoints_(0),
|
numberOfPoints_(0),
|
||||||
numberOfCells_(0),
|
numberOfCells_(0),
|
||||||
nLocalPoints_(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 "pointField.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "instant.H"
|
#include "instant.H"
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -70,10 +71,10 @@ class surfaceWriter
|
|||||||
// Private Member Data
|
// Private Member Data
|
||||||
|
|
||||||
//- Reference to the points
|
//- Reference to the points
|
||||||
const pointField& points_;
|
std::reference_wrapper<const pointField> points_;
|
||||||
|
|
||||||
//- Reference to the faces
|
//- Reference to the faces
|
||||||
const faceList& faces_;
|
std::reference_wrapper<const faceList> faces_;
|
||||||
|
|
||||||
//- The numer of field points for the current Piece
|
//- The numer of field points for the current Piece
|
||||||
label numberOfPoints_;
|
label numberOfPoints_;
|
||||||
@ -209,6 +210,9 @@ public:
|
|||||||
//- Write the currently set time as "TimeValue" FieldData
|
//- Write the currently set time as "TimeValue" FieldData
|
||||||
void writeTimeValue();
|
void writeTimeValue();
|
||||||
|
|
||||||
|
//- Reset point, face references to begin a new piece
|
||||||
|
void piece(const pointField& points, const faceList& faces);
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user