ENH: improvements for foamVtkOutput, foamVtkFormatter (issue #926)

- parallel list output for foamVtkOutput

- simplified '.series' file output

- beginDataArray() method instead of openDataArray() + closeTag()
  since this seems to be the most common use anyhow.
  With an optional argument for leaving the tag open, this works the
  same as openDataArray() which may be deprecated in the future.

- begin/end methods for CellData, PointData, FieldData (commonly used)

- templating parameters for file headers, content version,
  legacy fields. This improves coding robustness and convenience of use.

- use formatter and higher-level methods for legacy output

- attribute quoting character now part of the formatter itself
  instead of as an argument for xmlAttr().
  Toggle with quoting() method.

- pair-wise processing of xml attributes, which also allows them to be
  passed as optional entries when creating an xml tag.

- xmlComment with multiple arguments
This commit is contained in:
Mark Olesen
2018-09-17 08:59:03 +02:00
parent 19e03f7dd1
commit 05427217a0
41 changed files with 1957 additions and 603 deletions

View File

@ -226,20 +226,27 @@ void Foam::vtk::lagrangianWriter::beginParcelData(label nFields)
{
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType =
(
useVerts_
? vtk::fileTag::CELL_DATA
: vtk::fileTag::POINT_DATA
);
if (legacy_)
if (useVerts_)
{
legacy::dataHeader(os_, dataType, nParcels_, nFields);
if (legacy_)
{
legacy::beginCellData(format(), nParcels_, nFields);
}
else
{
format().beginCellData();
}
}
else
{
format().tag(dataType);
if (legacy_)
{
legacy::beginPointData(format(), nParcels_, nFields);
}
else
{
format().beginPointData();
}
}
}
@ -248,16 +255,17 @@ void Foam::vtk::lagrangianWriter::endParcelData()
{
if (!nParcels_) return; // Skip if there are no parcels
const vtk::fileTag dataType =
(
useVerts_
? vtk::fileTag::CELL_DATA
: vtk::fileTag::POINT_DATA
);
if (!legacy_)
{
format().endTag(dataType);
if (useVerts_)
{
format().endCellData();
}
else
{
format().endPointData();
}
}
}

View File

@ -78,7 +78,7 @@ void Foam::vtk::lagrangianWriter::writeIOField(const wordList& fieldNames)
if (legacy_)
{
legacy::intField(os(), fldName, nCmpt, fld.size());
legacy::intField<nCmpt>(format(), fldName, fld.size());
}
else
{
@ -103,7 +103,7 @@ void Foam::vtk::lagrangianWriter::writeIOField(const wordList& fieldNames)
if (legacy_)
{
legacy::floatField(os(), fldName, nCmpt, fld.size());
legacy::floatField<nCmpt>(format(), fldName, fld.size());
}
else
{