ENH: support VTK output of uniform field

This commit is contained in:
Mark Olesen
2019-03-19 09:45:52 +01:00
parent 29c8a77a96
commit df8699108b
10 changed files with 246 additions and 9 deletions

View File

@ -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
@ -195,6 +195,10 @@ public:
// Write
//- Write a uniform field of Cell (Face) or Point values
template<class Type>
void writeUniform(const word& fieldName, const Type& val);
//- Write a list of Cell (Face) or Point values
template<class Type>
void write(const word& fieldName, const UList<Type>& field);

View File

@ -25,6 +25,34 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::vtk::indirectPatchWriter::writeUniform
(
const word& fieldName,
const Type& val
)
{
if (isState(outputState::CELL_DATA))
{
++nCellData_;
vtk::fileWriter::writeUniform<Type>(fieldName, val, numberOfCells_);
}
else if (isState(outputState::POINT_DATA))
{
++nPointData_;
vtk::fileWriter::writeUniform<Type>(fieldName, val, numberOfPoints_);
}
else
{
WarningInFunction
<< "Bad writer state (" << stateNames[state_]
<< ") for field " << fieldName << nl << endl
<< exit(FatalError);
}
}
template<class Type>
void Foam::vtk::indirectPatchWriter::write
(