mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consolidate vtk classes into 'Foam::vtk' namespace
- elminate the foamVtkFormatter operator() in favour of xmlAttr. Improves readability and the purpose is clearer.
This commit is contained in:
@ -29,8 +29,8 @@ vtk/output/foamVtkPatchWriter.H
|
||||
vtk/output/foamVtkSurfaceMeshWriter.C
|
||||
vtk/output/foamVtkWriteSurfFields.C
|
||||
|
||||
vtk/part/foamVtkCells.C
|
||||
vtk/part/foamVtkMeshMaps.C
|
||||
vtk/part/foamVtuCells.C
|
||||
vtk/part/foamVtuSizing.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libconversion
|
||||
|
||||
@ -25,47 +25,46 @@ License
|
||||
|
||||
#include "foamVtkInternalWriter.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::beginPiece()
|
||||
void Foam::vtk::internalWriter::beginPiece()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format()
|
||||
.openTag(vtkFileTag::PIECE)
|
||||
( "NumberOfPoints", vtkCells_.nFieldPoints() )
|
||||
( "NumberOfCells", vtkCells_.nFieldCells() )
|
||||
.openTag(vtk::fileTag::PIECE)
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POINTS, vtuCells_.nFieldPoints())
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_CELLS, vtuCells_.nFieldCells())
|
||||
.closeTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writePoints()
|
||||
void Foam::vtk::internalWriter::writePoints()
|
||||
{
|
||||
// payload size
|
||||
const uint64_t payLoad = (vtkCells_.nFieldPoints() * 3 * sizeof(float));
|
||||
const uint64_t payLoad = (vtuCells_.nFieldPoints() * 3 * sizeof(float));
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::beginPoints(os_, vtkCells_.nFieldPoints());
|
||||
legacy::beginPoints(os_, vtuCells_.nFieldPoints());
|
||||
}
|
||||
else
|
||||
{
|
||||
format()
|
||||
.tag(vtkFileTag::POINTS)
|
||||
.openDataArray<float,3>(vtkFileTag::POINTS)
|
||||
.tag(vtk::fileTag::POINTS)
|
||||
.openDataArray<float,3>(vtk::dataArrayAttr::POINTS)
|
||||
.closeTag();
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
|
||||
foamVtkOutput::writeList(format(), mesh_.points());
|
||||
foamVtkOutput::writeList
|
||||
vtk::writeList(format(), mesh_.points());
|
||||
vtk::writeList
|
||||
(
|
||||
format(),
|
||||
mesh_.cellCentres(),
|
||||
vtkCells_.addPointCellLabels()
|
||||
vtuCells_.addPointCellLabels()
|
||||
);
|
||||
|
||||
format().flush();
|
||||
@ -74,25 +73,25 @@ void Foam::foamVtkOutput::internalWriter::writePoints()
|
||||
{
|
||||
format()
|
||||
.endDataArray()
|
||||
.endTag(vtkFileTag::POINTS);
|
||||
.endTag(vtk::fileTag::POINTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writeCellsLegacy()
|
||||
void Foam::vtk::internalWriter::writeCellsLegacy()
|
||||
{
|
||||
const List<uint8_t>& cellTypes = vtkCells_.cellTypes();
|
||||
const labelList& vertLabels = vtkCells_.vertLabels();
|
||||
const List<uint8_t>& cellTypes = vtuCells_.cellTypes();
|
||||
const labelList& vertLabels = vtuCells_.vertLabels();
|
||||
|
||||
os_ << "CELLS " << vtkCells_.nFieldCells() << ' '
|
||||
os_ << "CELLS " << vtuCells_.nFieldCells() << ' '
|
||||
<< vertLabels.size() << nl;
|
||||
|
||||
foamVtkOutput::writeList(format(), vertLabels);
|
||||
vtk::writeList(format(), vertLabels);
|
||||
format().flush();
|
||||
|
||||
os_ << "CELL_TYPES " << cellTypes.size() << nl;
|
||||
|
||||
// No nComponents for char, so cannot use foamVtkOutput::writeList
|
||||
// No nComponents for char, so cannot use vtk::writeList
|
||||
forAll(cellTypes, i)
|
||||
{
|
||||
format().write(cellTypes[i]);
|
||||
@ -101,22 +100,22 @@ void Foam::foamVtkOutput::internalWriter::writeCellsLegacy()
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
void Foam::vtk::internalWriter::writeCells()
|
||||
{
|
||||
format().tag(vtkFileTag::CELLS);
|
||||
format().tag(vtk::fileTag::CELLS);
|
||||
|
||||
//
|
||||
// 'connectivity'
|
||||
//
|
||||
{
|
||||
const labelList& vertLabels = vtkCells_.vertLabels();
|
||||
const labelList& vertLabels = vtuCells_.vertLabels();
|
||||
const uint64_t payLoad = vertLabels.size() * sizeof(label);
|
||||
|
||||
format().openDataArray<label>("connectivity")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY)
|
||||
.closeTag();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), vertLabels);
|
||||
vtk::writeList(format(), vertLabels);
|
||||
format().flush();
|
||||
|
||||
format().endDataArray();
|
||||
@ -127,14 +126,14 @@ void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
// 'offsets' (connectivity offsets)
|
||||
//
|
||||
{
|
||||
const labelList& vertOffsets = vtkCells_.vertOffsets();
|
||||
const labelList& vertOffsets = vtuCells_.vertOffsets();
|
||||
const uint64_t payLoad = vertOffsets.size() * sizeof(label);
|
||||
|
||||
format().openDataArray<label>("offsets")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::OFFSETS)
|
||||
.closeTag();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), vertOffsets);
|
||||
vtk::writeList(format(), vertOffsets);
|
||||
format().flush();
|
||||
|
||||
format().endDataArray();
|
||||
@ -145,16 +144,16 @@ void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
// 'types' (cell types)
|
||||
//
|
||||
{
|
||||
const List<uint8_t>& cellTypes = vtkCells_.cellTypes();
|
||||
const List<uint8_t>& cellTypes = vtuCells_.cellTypes();
|
||||
const uint64_t payLoad = cellTypes.size() * sizeof(uint8_t);
|
||||
|
||||
format().openDataArray<uint8_t>("types")
|
||||
format().openDataArray<uint8_t>(vtk::dataArrayAttr::TYPES)
|
||||
.closeTag();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
forAll(cellTypes, i)
|
||||
{
|
||||
// No nComponents for char, cannot use foamVtkOutput::writeList here
|
||||
// No nComponents for char, cannot use vtk::writeList here
|
||||
format().write(cellTypes[i]);
|
||||
}
|
||||
format().flush();
|
||||
@ -166,9 +165,9 @@ void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
//
|
||||
// can quit here if there are NO face streams
|
||||
//
|
||||
if (vtkCells_.faceLabels().empty())
|
||||
if (vtuCells_.faceLabels().empty())
|
||||
{
|
||||
format().endTag(vtkFileTag::CELLS);
|
||||
format().endTag(vtk::fileTag::CELLS);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -180,14 +179,14 @@ void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
// 'faces' (face streams)
|
||||
//
|
||||
{
|
||||
const labelList& faceLabels = vtkCells_.faceLabels();
|
||||
const labelList& faceLabels = vtuCells_.faceLabels();
|
||||
const uint64_t payLoad = faceLabels.size() * sizeof(label);
|
||||
|
||||
format().openDataArray<label>("faces")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::FACES)
|
||||
.closeTag();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), faceLabels);
|
||||
vtk::writeList(format(), faceLabels);
|
||||
format().flush();
|
||||
|
||||
format().endDataArray();
|
||||
@ -198,24 +197,24 @@ void Foam::foamVtkOutput::internalWriter::writeCells()
|
||||
// -1 to indicate that the cell is a primitive type that does not
|
||||
// have a face stream
|
||||
{
|
||||
const labelList& faceOffsets = vtkCells_.faceOffsets();
|
||||
const labelList& faceOffsets = vtuCells_.faceOffsets();
|
||||
const uint64_t payLoad = faceOffsets.size() * sizeof(label);
|
||||
|
||||
format().openDataArray<label>("faceoffsets")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::FACEOFFSETS)
|
||||
.closeTag();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), faceOffsets);
|
||||
vtk::writeList(format(), faceOffsets);
|
||||
format().flush();
|
||||
|
||||
format().endDataArray();
|
||||
}
|
||||
|
||||
format().endTag(vtkFileTag::CELLS);
|
||||
format().endTag(vtk::fileTag::CELLS);
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writeMesh()
|
||||
void Foam::vtk::internalWriter::writeMesh()
|
||||
{
|
||||
writePoints();
|
||||
if (legacy_)
|
||||
@ -231,18 +230,18 @@ void Foam::foamVtkOutput::internalWriter::writeMesh()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::internalWriter::internalWriter
|
||||
Foam::vtk::internalWriter::internalWriter
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const foamVtkCells& cells,
|
||||
const vtk::vtuCells& cells,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts
|
||||
const vtk::outputOptions outOpts
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
legacy_(outOpts.legacy()),
|
||||
format_(),
|
||||
vtkCells_(cells),
|
||||
vtuCells_(cells),
|
||||
os_()
|
||||
{
|
||||
outputOptions opts(outOpts);
|
||||
@ -255,7 +254,7 @@ Foam::foamVtkOutput::internalWriter::internalWriter
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::fileHeader(format(), title, vtkFileTag::UNSTRUCTURED_GRID);
|
||||
legacy::fileHeader(format(), title, vtk::fileTag::UNSTRUCTURED_GRID);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -264,7 +263,7 @@ Foam::foamVtkOutput::internalWriter::internalWriter
|
||||
format()
|
||||
.xmlHeader()
|
||||
.xmlComment(title)
|
||||
.beginVTKFile(vtkFileTag::UNSTRUCTURED_GRID, "0.1");
|
||||
.beginVTKFile(vtk::fileTag::UNSTRUCTURED_GRID, "0.1");
|
||||
}
|
||||
|
||||
beginPiece();
|
||||
@ -274,91 +273,91 @@ Foam::foamVtkOutput::internalWriter::internalWriter
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::internalWriter::~internalWriter()
|
||||
Foam::vtk::internalWriter::~internalWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::beginCellData(label nFields)
|
||||
void Foam::vtk::internalWriter::beginCellData(label nFields)
|
||||
{
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::dataHeader
|
||||
(
|
||||
os(),
|
||||
vtkFileTag::CELL_DATA,
|
||||
vtkCells_.nFieldCells(),
|
||||
vtk::fileTag::CELL_DATA,
|
||||
vtuCells_.nFieldCells(),
|
||||
nFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::CELL_DATA);
|
||||
format().tag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::endCellData()
|
||||
void Foam::vtk::internalWriter::endCellData()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::CELL_DATA);
|
||||
format().endTag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::beginPointData(label nFields)
|
||||
void Foam::vtk::internalWriter::beginPointData(label nFields)
|
||||
{
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::dataHeader
|
||||
(
|
||||
os(),
|
||||
vtkFileTag::POINT_DATA,
|
||||
vtkCells_.nFieldPoints(),
|
||||
vtk::fileTag::POINT_DATA,
|
||||
vtuCells_.nFieldPoints(),
|
||||
nFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::POINT_DATA);
|
||||
format().tag(vtk::fileTag::POINT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::endPointData()
|
||||
void Foam::vtk::internalWriter::endPointData()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::POINT_DATA);
|
||||
format().endTag(vtk::fileTag::POINT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writeFooter()
|
||||
void Foam::vtk::internalWriter::writeFooter()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
// slight cheat. </Piece> too
|
||||
format().endTag(vtkFileTag::PIECE);
|
||||
format().endTag(vtk::fileTag::PIECE);
|
||||
|
||||
format().endTag(vtkFileTag::UNSTRUCTURED_GRID)
|
||||
format().endTag(vtk::fileTag::UNSTRUCTURED_GRID)
|
||||
.endVTKFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::internalWriter::writeCellIDs()
|
||||
void Foam::vtk::internalWriter::writeCellIDs()
|
||||
{
|
||||
// Cell ids first
|
||||
const labelList& cellMap = vtkCells_.cellMap();
|
||||
const uint64_t payLoad = vtkCells_.nFieldCells() * sizeof(label);
|
||||
const labelList& cellMap = vtuCells_.cellMap();
|
||||
const uint64_t payLoad = vtuCells_.nFieldCells() * sizeof(label);
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
os_ << "cellID 1 " << vtkCells_.nFieldCells() << " int" << nl;
|
||||
os_ << "cellID 1 " << vtuCells_.nFieldCells() << " int" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -368,7 +367,7 @@ void Foam::foamVtkOutput::internalWriter::writeCellIDs()
|
||||
|
||||
format().writeSize(payLoad);
|
||||
|
||||
foamVtkOutput::writeList(format(), cellMap);
|
||||
vtk::writeList(format(), cellMap);
|
||||
format().flush();
|
||||
|
||||
if (!legacy_)
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::foamVtkOutput::internalWriter
|
||||
Foam::vtk::internalWriter
|
||||
|
||||
Description
|
||||
Write fields (internal).
|
||||
@ -40,9 +40,9 @@ SourceFiles
|
||||
#include "volFields.H"
|
||||
#include "pointFields.H"
|
||||
|
||||
#include "foamVtkCells.H"
|
||||
#include "foamVtkOutputFields.H"
|
||||
#include "foamVtkOutputOptions.H"
|
||||
#include "foamVtuCells.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
{
|
||||
class volPointInterpolation;
|
||||
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -67,10 +67,10 @@ class internalWriter
|
||||
//- Commonly used query
|
||||
const bool legacy_;
|
||||
|
||||
autoPtr<foamVtkOutput::formatter> format_;
|
||||
autoPtr<vtk::formatter> format_;
|
||||
|
||||
//- The volume cells (internalMesh)
|
||||
const foamVtkCells& vtkCells_;
|
||||
const vtuCells& vtuCells_;
|
||||
|
||||
std::ofstream os_;
|
||||
|
||||
@ -108,9 +108,9 @@ public:
|
||||
internalWriter
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const foamVtkCells& cells,
|
||||
const vtk::vtuCells& cells,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts
|
||||
const vtk::outputOptions outOpts
|
||||
);
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ public:
|
||||
return os_;
|
||||
}
|
||||
|
||||
inline foamVtkOutput::formatter& format()
|
||||
inline vtk::formatter& format()
|
||||
{
|
||||
return format_();
|
||||
}
|
||||
@ -212,7 +212,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace foamVtkOutput
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -31,12 +31,12 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::internalWriter::write
|
||||
void Foam::vtk::internalWriter::write
|
||||
(
|
||||
const UPtrList<const DimensionedField<Type, volMesh>>& flds
|
||||
)
|
||||
{
|
||||
const labelList& cellMap = vtkCells_.cellMap();
|
||||
const labelList& cellMap = vtuCells_.cellMap();
|
||||
|
||||
const int nCmpt(pTraits<Type>::nComponents);
|
||||
// const uint64_t payLoad(cellMap.size() * nCmpt * sizeof(float));
|
||||
@ -56,7 +56,7 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
}
|
||||
|
||||
// writeField includes payload size
|
||||
foamVtkOutput::writeField(format(), fld, cellMap);
|
||||
vtk::writeField(format(), fld, cellMap);
|
||||
|
||||
if (!legacy_)
|
||||
{
|
||||
@ -67,12 +67,12 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField>
|
||||
void Foam::foamVtkOutput::internalWriter::write
|
||||
void Foam::vtk::internalWriter::write
|
||||
(
|
||||
const UPtrList<const GeometricField<Type, PatchField, volMesh>>& flds
|
||||
)
|
||||
{
|
||||
const labelList& cellMap = vtkCells_.cellMap();
|
||||
const labelList& cellMap = vtuCells_.cellMap();
|
||||
|
||||
const int nCmpt(pTraits<Type>::nComponents);
|
||||
// const uint64_t payLoad(cellMap.size() * nCmpt * sizeof(float));
|
||||
@ -92,7 +92,7 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
}
|
||||
|
||||
// writeField includes payload size
|
||||
foamVtkOutput::writeField(format(), fld, cellMap);
|
||||
vtk::writeField(format(), fld, cellMap);
|
||||
|
||||
if (!legacy_)
|
||||
{
|
||||
@ -103,15 +103,15 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField>
|
||||
void Foam::foamVtkOutput::internalWriter::write
|
||||
void Foam::vtk::internalWriter::write
|
||||
(
|
||||
const UPtrList<const GeometricField<Type, PatchField, pointMesh>>& flds
|
||||
)
|
||||
{
|
||||
const labelList& addPointCellLabels = vtkCells_.addPointCellLabels();
|
||||
const labelList& addPointCellLabels = vtuCells_.addPointCellLabels();
|
||||
|
||||
const int nCmpt(pTraits<Type>::nComponents);
|
||||
const int nVals(vtkCells_.nFieldPoints());
|
||||
const int nVals(vtuCells_.nFieldPoints());
|
||||
|
||||
// Only needed for non-legacy
|
||||
const uint64_t payLoad(nVals * nCmpt * sizeof(float));
|
||||
@ -131,12 +131,12 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), fld);
|
||||
vtk::writeList(format(), fld);
|
||||
|
||||
forAll(addPointCellLabels, i)
|
||||
{
|
||||
const Type val = interpolatePointToCell(fld, addPointCellLabels[i]);
|
||||
foamVtkOutput::write(format(), val);
|
||||
vtk::write(format(), val);
|
||||
}
|
||||
|
||||
format().flush();
|
||||
@ -150,16 +150,16 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::internalWriter::write
|
||||
void Foam::vtk::internalWriter::write
|
||||
(
|
||||
const volPointInterpolation& pInterp,
|
||||
const UPtrList<const DimensionedField<Type, volMesh>>& flds
|
||||
)
|
||||
{
|
||||
const labelList& addPointCellLabels = vtkCells_.addPointCellLabels();
|
||||
const labelList& addPointCellLabels = vtuCells_.addPointCellLabels();
|
||||
|
||||
const int nCmpt(pTraits<Type>::nComponents);
|
||||
const int nVals(vtkCells_.nFieldPoints());
|
||||
const int nVals(vtuCells_.nFieldPoints());
|
||||
|
||||
// Only needed for non-legacy
|
||||
const uint64_t payLoad(nVals * nCmpt * sizeof(float));
|
||||
@ -180,8 +180,8 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), pfield);
|
||||
foamVtkOutput::writeList(format(), vfield, addPointCellLabels);
|
||||
vtk::writeList(format(), pfield);
|
||||
vtk::writeList(format(), vfield, addPointCellLabels);
|
||||
format().flush();
|
||||
|
||||
if (!legacy_)
|
||||
@ -193,16 +193,16 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField>
|
||||
void Foam::foamVtkOutput::internalWriter::write
|
||||
void Foam::vtk::internalWriter::write
|
||||
(
|
||||
const volPointInterpolation& pInterp,
|
||||
const UPtrList<const GeometricField<Type, PatchField, volMesh>>& flds
|
||||
)
|
||||
{
|
||||
const labelList& addPointCellLabels = vtkCells_.addPointCellLabels();
|
||||
const labelList& addPointCellLabels = vtuCells_.addPointCellLabels();
|
||||
|
||||
const int nCmpt(pTraits<Type>::nComponents);
|
||||
const int nVals(vtkCells_.nFieldPoints());
|
||||
const int nVals(vtuCells_.nFieldPoints());
|
||||
|
||||
// Only needed for non-legacy
|
||||
const uint64_t payLoad(nVals * nCmpt * sizeof(float));
|
||||
@ -223,8 +223,8 @@ void Foam::foamVtkOutput::internalWriter::write
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), pfield);
|
||||
foamVtkOutput::writeList(format(), vfield, addPointCellLabels);
|
||||
vtk::writeList(format(), pfield);
|
||||
vtk::writeList(format(), vfield, addPointCellLabels);
|
||||
format().flush();
|
||||
|
||||
if (!legacy_)
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InNamespace
|
||||
Foam::foamVtkOutput
|
||||
Foam::vtk
|
||||
|
||||
Description
|
||||
Additional functions for writing fields in VTK format.
|
||||
@ -42,36 +42,17 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Write internalField for mesh
|
||||
// The output includes the payload size and flush.
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
);
|
||||
|
||||
//- Write internalField based on the cellMap
|
||||
// The output includes the payload size and flush.
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
);
|
||||
|
||||
//- Write DimensionedField for mesh
|
||||
// The output includes the payload size and flush.
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
vtk::formatter& fmt,
|
||||
const DimensionedField<Type, volMesh>& fld
|
||||
);
|
||||
|
||||
@ -80,15 +61,34 @@ namespace foamVtkOutput
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
vtk::formatter& fmt,
|
||||
const DimensionedField<Type, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
);
|
||||
|
||||
//- Write internalField for mesh
|
||||
// The output includes the payload size and flush.
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
vtk::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
);
|
||||
|
||||
//- Write internalField based on the cellMap
|
||||
// The output includes the payload size and flush.
|
||||
template<class Type>
|
||||
void writeField
|
||||
(
|
||||
vtk::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace foamVtkOutput
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
@ -25,49 +25,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
)
|
||||
{
|
||||
const uint64_t payLoad =
|
||||
(
|
||||
fld.size() * pTraits<Type>::nComponents * sizeof(float)
|
||||
);
|
||||
|
||||
fmt.writeSize(payLoad);
|
||||
writeList(fmt, fld.internalField());
|
||||
|
||||
fmt.flush();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::writeField
|
||||
void Foam::vtk::writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
)
|
||||
{
|
||||
const uint64_t payLoad =
|
||||
(
|
||||
cellMap.size() * pTraits<Type>::nComponents * sizeof(float)
|
||||
);
|
||||
|
||||
fmt.writeSize(payLoad);
|
||||
writeList(fmt, fld.internalField(), cellMap);
|
||||
|
||||
fmt.flush();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
vtk::formatter& fmt,
|
||||
const DimensionedField<Type, volMesh>& fld
|
||||
)
|
||||
{
|
||||
@ -84,9 +46,9 @@ void Foam::foamVtkOutput::writeField
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::writeField
|
||||
void Foam::vtk::writeField
|
||||
(
|
||||
foamVtkOutput::formatter& fmt,
|
||||
vtk::formatter& fmt,
|
||||
const DimensionedField<Type, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
)
|
||||
@ -103,4 +65,43 @@ void Foam::foamVtkOutput::writeField
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::vtk::writeField
|
||||
(
|
||||
vtk::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld
|
||||
)
|
||||
{
|
||||
const uint64_t payLoad =
|
||||
(
|
||||
fld.size() * pTraits<Type>::nComponents * sizeof(float)
|
||||
);
|
||||
|
||||
fmt.writeSize(payLoad);
|
||||
writeList(fmt, fld.internalField());
|
||||
|
||||
fmt.flush();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::vtk::writeField
|
||||
(
|
||||
vtk::formatter& fmt,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& fld,
|
||||
const UList<label>& cellMap
|
||||
)
|
||||
{
|
||||
const uint64_t payLoad =
|
||||
(
|
||||
cellMap.size() * pTraits<Type>::nComponents * sizeof(float)
|
||||
);
|
||||
|
||||
fmt.writeSize(payLoad);
|
||||
writeList(fmt, fld.internalField(), cellMap);
|
||||
|
||||
fmt.flush();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,25 +29,24 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::beginPiece()
|
||||
void Foam::vtk::patchWriter::beginPiece()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format()
|
||||
.openTag(vtkFileTag::PIECE)
|
||||
( "NumberOfPoints", nPoints_ )
|
||||
( "NumberOfPolys", nFaces_ )
|
||||
.openTag(vtk::fileTag::PIECE)
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POINTS, nPoints_)
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POLYS, nFaces_)
|
||||
.closeTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writePoints()
|
||||
void Foam::vtk::patchWriter::writePoints()
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// payload count
|
||||
const uint64_t payLoad = (nPoints_*3* sizeof(float));
|
||||
const uint64_t payLoad = (nPoints_*3*sizeof(float));
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
@ -55,8 +54,8 @@ void Foam::foamVtkOutput::patchWriter::writePoints()
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::POINTS)
|
||||
.openDataArray<float, 3>(vtkFileTag::POINTS)
|
||||
format().tag(vtk::fileTag::POINTS)
|
||||
.openDataArray<float, 3>(vtk::dataArrayAttr::POINTS)
|
||||
.closeTag();
|
||||
}
|
||||
|
||||
@ -66,7 +65,7 @@ void Foam::foamVtkOutput::patchWriter::writePoints()
|
||||
{
|
||||
const polyPatch& pp = patches[patchIDs_[i]];
|
||||
|
||||
foamVtkOutput::writeList(format(), pp.localPoints());
|
||||
vtk::writeList(format(), pp.localPoints());
|
||||
}
|
||||
format().flush();
|
||||
|
||||
@ -74,12 +73,12 @@ void Foam::foamVtkOutput::patchWriter::writePoints()
|
||||
{
|
||||
format()
|
||||
.endDataArray()
|
||||
.endTag(vtkFileTag::POINTS);
|
||||
.endTag(vtk::fileTag::POINTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writePolysLegacy()
|
||||
void Foam::vtk::patchWriter::writePolysLegacy()
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
@ -123,7 +122,7 @@ void Foam::foamVtkOutput::patchWriter::writePolysLegacy()
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writePolys()
|
||||
void Foam::vtk::patchWriter::writePolys()
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
@ -131,7 +130,7 @@ void Foam::foamVtkOutput::patchWriter::writePolys()
|
||||
// 'connectivity'
|
||||
//
|
||||
|
||||
format().tag(vtkFileTag::POLYS);
|
||||
format().tag(vtk::fileTag::POLYS);
|
||||
|
||||
//
|
||||
// 'connectivity'
|
||||
@ -150,7 +149,7 @@ void Foam::foamVtkOutput::patchWriter::writePolys()
|
||||
}
|
||||
}
|
||||
|
||||
format().openDataArray<label>("connectivity")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY)
|
||||
.closeTag();
|
||||
|
||||
// payload size
|
||||
@ -185,7 +184,7 @@ void Foam::foamVtkOutput::patchWriter::writePolys()
|
||||
//
|
||||
{
|
||||
format()
|
||||
.openDataArray<label>("offsets")
|
||||
.openDataArray<label>(vtk::dataArrayAttr::OFFSETS)
|
||||
.closeTag();
|
||||
|
||||
// payload size
|
||||
@ -208,11 +207,11 @@ void Foam::foamVtkOutput::patchWriter::writePolys()
|
||||
format().endDataArray();
|
||||
}
|
||||
|
||||
format().endTag(vtkFileTag::POLYS);
|
||||
format().endTag(vtk::fileTag::POLYS);
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writeMesh()
|
||||
void Foam::vtk::patchWriter::writeMesh()
|
||||
{
|
||||
writePoints();
|
||||
if (legacy_)
|
||||
@ -228,11 +227,11 @@ void Foam::foamVtkOutput::patchWriter::writeMesh()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::patchWriter::patchWriter
|
||||
Foam::vtk::patchWriter::patchWriter
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool nearCellValue,
|
||||
const labelList& patchIDs
|
||||
)
|
||||
@ -274,7 +273,7 @@ Foam::foamVtkOutput::patchWriter::patchWriter
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::fileHeader(format(), title, vtkFileTag::POLY_DATA);
|
||||
legacy::fileHeader(format(), title, vtk::fileTag::POLY_DATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -283,7 +282,7 @@ Foam::foamVtkOutput::patchWriter::patchWriter
|
||||
format()
|
||||
.xmlHeader()
|
||||
.xmlComment(title)
|
||||
.beginVTKFile(vtkFileTag::POLY_DATA, "0.1");
|
||||
.beginVTKFile(vtk::fileTag::POLY_DATA, "0.1");
|
||||
}
|
||||
|
||||
beginPiece();
|
||||
@ -293,82 +292,82 @@ Foam::foamVtkOutput::patchWriter::patchWriter
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::patchWriter::~patchWriter()
|
||||
Foam::vtk::patchWriter::~patchWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::beginCellData(label nFields)
|
||||
void Foam::vtk::patchWriter::beginCellData(label nFields)
|
||||
{
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::dataHeader
|
||||
(
|
||||
os(),
|
||||
vtkFileTag::CELL_DATA,
|
||||
vtk::fileTag::CELL_DATA,
|
||||
nFaces_,
|
||||
nFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::CELL_DATA);
|
||||
format().tag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::endCellData()
|
||||
void Foam::vtk::patchWriter::endCellData()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::CELL_DATA);
|
||||
format().endTag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::beginPointData(label nFields)
|
||||
void Foam::vtk::patchWriter::beginPointData(label nFields)
|
||||
{
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::dataHeader
|
||||
(
|
||||
os(),
|
||||
vtkFileTag::POINT_DATA,
|
||||
vtk::fileTag::POINT_DATA,
|
||||
nPoints_,
|
||||
nFields
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::POINT_DATA);
|
||||
format().tag(vtk::fileTag::POINT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::endPointData()
|
||||
void Foam::vtk::patchWriter::endPointData()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::POINT_DATA);
|
||||
format().endTag(vtk::fileTag::POINT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writeFooter()
|
||||
void Foam::vtk::patchWriter::writeFooter()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
// slight cheat. </Piece> too
|
||||
format().endTag(vtkFileTag::PIECE);
|
||||
format().endTag(vtk::fileTag::PIECE);
|
||||
|
||||
format().endTag(vtkFileTag::POLY_DATA)
|
||||
format().endTag(vtk::fileTag::POLY_DATA)
|
||||
.endVTKFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::patchWriter::writePatchIDs()
|
||||
void Foam::vtk::patchWriter::writePatchIDs()
|
||||
{
|
||||
// Patch ids first
|
||||
const uint64_t payLoad = nFaces_ * sizeof(label);
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::foamVtkOutput::patchWriter
|
||||
Foam::vtk::patchWriter
|
||||
|
||||
Description
|
||||
Write patch fields
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
{
|
||||
class volPointInterpolation;
|
||||
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -67,7 +67,7 @@ class patchWriter
|
||||
//- Commonly used query
|
||||
const bool legacy_;
|
||||
|
||||
autoPtr<foamVtkOutput::formatter> format_;
|
||||
autoPtr<vtk::formatter> format_;
|
||||
|
||||
const bool nearCellValue_;
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool nearCellValue,
|
||||
const labelList& patchIDs
|
||||
);
|
||||
@ -131,7 +131,7 @@ public:
|
||||
return os_;
|
||||
}
|
||||
|
||||
inline foamVtkOutput::formatter& format()
|
||||
inline vtk::formatter& format()
|
||||
{
|
||||
return format_();
|
||||
}
|
||||
@ -202,7 +202,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace foamVtkOutput
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField>
|
||||
void Foam::foamVtkOutput::patchWriter::write
|
||||
void Foam::vtk::patchWriter::write
|
||||
(
|
||||
const UPtrList<const GeometricField<Type, PatchField, volMesh>>& flds
|
||||
)
|
||||
@ -59,11 +59,11 @@ void Foam::foamVtkOutput::patchWriter::write
|
||||
|
||||
if (nearCellValue_)
|
||||
{
|
||||
foamVtkOutput::writeList(format(), pfld.patchInternalField()());
|
||||
vtk::writeList(format(), pfld.patchInternalField()());
|
||||
}
|
||||
else
|
||||
{
|
||||
foamVtkOutput::writeList(format(), pfld);
|
||||
vtk::writeList(format(), pfld);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void Foam::foamVtkOutput::patchWriter::write
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField>
|
||||
void Foam::foamVtkOutput::patchWriter::write
|
||||
void Foam::vtk::patchWriter::write
|
||||
(
|
||||
const UPtrList<const GeometricField<Type, PatchField, pointMesh>>& flds
|
||||
)
|
||||
@ -106,7 +106,7 @@ void Foam::foamVtkOutput::patchWriter::write
|
||||
{
|
||||
const auto& pfld = fld.boundaryField()[patchIDs_[i]];
|
||||
|
||||
foamVtkOutput::writeList(format(), pfld.patchInternalField()());
|
||||
vtk::writeList(format(), pfld.patchInternalField()());
|
||||
}
|
||||
|
||||
format().flush();
|
||||
@ -120,7 +120,7 @@ void Foam::foamVtkOutput::patchWriter::write
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::patchWriter::write
|
||||
void Foam::vtk::patchWriter::write
|
||||
(
|
||||
const PrimitivePatchInterpolation<primitivePatch>& pInter,
|
||||
const UPtrList<const GeometricField<Type, fvPatchField, volMesh>>& flds
|
||||
@ -154,13 +154,13 @@ void Foam::foamVtkOutput::patchWriter::write
|
||||
auto tfield =
|
||||
pInter.faceToPointInterpolate(pfld.patchInternalField()());
|
||||
|
||||
foamVtkOutput::writeList(format(), tfield());
|
||||
vtk::writeList(format(), tfield());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto tfield = pInter.faceToPointInterpolate(pfld);
|
||||
|
||||
foamVtkOutput::writeList(format(), tfield());
|
||||
vtk::writeList(format(), tfield());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,22 +29,21 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::beginPiece()
|
||||
void Foam::vtk::surfaceMeshWriter::beginPiece()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format()
|
||||
.openTag(vtkFileTag::PIECE)
|
||||
( "NumberOfPoints", pp_.nPoints() )
|
||||
( "NumberOfPolys", pp_.size() )
|
||||
.openTag(vtk::fileTag::PIECE)
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POINTS, pp_.nPoints())
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POLYS, pp_.size())
|
||||
.closeTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::writePoints()
|
||||
void Foam::vtk::surfaceMeshWriter::writePoints()
|
||||
{
|
||||
// payload count
|
||||
const uint64_t payLoad = (pp_.nPoints()*3*sizeof(float));
|
||||
|
||||
if (legacy_)
|
||||
@ -53,26 +52,26 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePoints()
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::POINTS)
|
||||
.openDataArray<float, 3>(vtkFileTag::POINTS)
|
||||
format().tag(vtk::fileTag::POINTS)
|
||||
.openDataArray<float, 3>(vtk::dataArrayAttr::POINTS)
|
||||
.closeTag();
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
|
||||
foamVtkOutput::writeList(format(), pp_.localPoints());
|
||||
vtk::writeList(format(), pp_.localPoints());
|
||||
format().flush();
|
||||
|
||||
if (!legacy_)
|
||||
{
|
||||
format()
|
||||
.endDataArray()
|
||||
.endTag(vtkFileTag::POINTS);
|
||||
.endTag(vtk::fileTag::POINTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::writePolysLegacy()
|
||||
void Foam::vtk::surfaceMeshWriter::writePolysLegacy()
|
||||
{
|
||||
// connectivity count without additional storage (done internally)
|
||||
uint64_t nConnectivity = 0;
|
||||
@ -92,20 +91,20 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePolysLegacy()
|
||||
const face& f = pp_.localFaces()[facei];
|
||||
|
||||
format().write(f.size()); // The size prefix
|
||||
foamVtkOutput::writeList(format(), f);
|
||||
vtk::writeList(format(), f);
|
||||
}
|
||||
|
||||
format().flush();
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::writePolys()
|
||||
void Foam::vtk::surfaceMeshWriter::writePolys()
|
||||
{
|
||||
//
|
||||
// 'connectivity'
|
||||
//
|
||||
|
||||
format().tag(vtkFileTag::POLYS);
|
||||
format().tag(vtk::fileTag::POLYS);
|
||||
|
||||
//
|
||||
// 'connectivity'
|
||||
@ -118,7 +117,7 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePolys()
|
||||
payLoad += pp_[facei].size();
|
||||
}
|
||||
|
||||
format().openDataArray<label>("connectivity")
|
||||
format().openDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY)
|
||||
.closeTag();
|
||||
|
||||
// payload size
|
||||
@ -127,7 +126,7 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePolys()
|
||||
forAll(pp_, facei)
|
||||
{
|
||||
const face& f = pp_.localFaces()[facei];
|
||||
foamVtkOutput::writeList(format(), f);
|
||||
vtk::writeList(format(), f);
|
||||
}
|
||||
|
||||
format().flush();
|
||||
@ -142,7 +141,7 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePolys()
|
||||
//
|
||||
{
|
||||
format()
|
||||
.openDataArray<label>("offsets")
|
||||
.openDataArray<label>(vtk::dataArrayAttr::OFFSETS)
|
||||
.closeTag();
|
||||
|
||||
// payload size
|
||||
@ -160,11 +159,11 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writePolys()
|
||||
format().endDataArray();
|
||||
}
|
||||
|
||||
format().endTag(vtkFileTag::POLYS);
|
||||
format().endTag(vtk::fileTag::POLYS);
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::writeMesh()
|
||||
void Foam::vtk::surfaceMeshWriter::writeMesh()
|
||||
{
|
||||
writePoints();
|
||||
if (legacy_)
|
||||
@ -180,12 +179,12 @@ void Foam::foamVtkOutput::surfaceMeshWriter::writeMesh()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::surfaceMeshWriter::surfaceMeshWriter
|
||||
Foam::vtk::surfaceMeshWriter::surfaceMeshWriter
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const word& name,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts
|
||||
const vtk::outputOptions outOpts
|
||||
)
|
||||
:
|
||||
pp_(pp),
|
||||
@ -201,7 +200,7 @@ Foam::foamVtkOutput::surfaceMeshWriter::surfaceMeshWriter
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::fileHeader(format(), name, vtkFileTag::POLY_DATA);
|
||||
legacy::fileHeader(format(), name, vtk::fileTag::POLY_DATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -210,7 +209,7 @@ Foam::foamVtkOutput::surfaceMeshWriter::surfaceMeshWriter
|
||||
format()
|
||||
.xmlHeader()
|
||||
.xmlComment(name)
|
||||
.beginVTKFile(vtkFileTag::POLY_DATA, "0.1");
|
||||
.beginVTKFile(vtk::fileTag::POLY_DATA, "0.1");
|
||||
|
||||
}
|
||||
|
||||
@ -221,42 +220,42 @@ Foam::foamVtkOutput::surfaceMeshWriter::surfaceMeshWriter
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkOutput::surfaceMeshWriter::~surfaceMeshWriter()
|
||||
Foam::vtk::surfaceMeshWriter::~surfaceMeshWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::beginCellData(label nFields)
|
||||
void Foam::vtk::surfaceMeshWriter::beginCellData(label nFields)
|
||||
{
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::dataHeader(os(), vtkFileTag::CELL_DATA, pp_.size(), nFields);
|
||||
legacy::dataHeader(os(), vtk::fileTag::CELL_DATA, pp_.size(), nFields);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::CELL_DATA);
|
||||
format().tag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::endCellData()
|
||||
void Foam::vtk::surfaceMeshWriter::endCellData()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::CELL_DATA);
|
||||
format().endTag(vtk::fileTag::CELL_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::writeFooter()
|
||||
void Foam::vtk::surfaceMeshWriter::writeFooter()
|
||||
{
|
||||
if (!legacy_)
|
||||
{
|
||||
// slight cheat. </Piece> too
|
||||
format().endTag(vtkFileTag::PIECE);
|
||||
format().endTag(vtk::fileTag::PIECE);
|
||||
|
||||
format().endTag(vtkFileTag::POLY_DATA)
|
||||
format().endTag(vtk::fileTag::POLY_DATA)
|
||||
.endVTKFile();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::foamVtkOutput::surfaceMeshWriter
|
||||
Foam::vtk::surfaceMeshWriter
|
||||
|
||||
Description
|
||||
Write faces with fields
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
{
|
||||
class volPointInterpolation;
|
||||
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -65,7 +65,7 @@ class surfaceMeshWriter
|
||||
//- Commonly used query
|
||||
const bool legacy_;
|
||||
|
||||
autoPtr<foamVtkOutput::formatter> format_;
|
||||
autoPtr<vtk::formatter> format_;
|
||||
|
||||
std::ofstream os_;
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
const indirectPrimitivePatch& pp,
|
||||
const word& name,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts
|
||||
const vtk::outputOptions outOpts
|
||||
);
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
return os_;
|
||||
}
|
||||
|
||||
inline foamVtkOutput::formatter& format()
|
||||
inline vtk::formatter& format()
|
||||
{
|
||||
return format_();
|
||||
}
|
||||
@ -156,7 +156,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace foamVtkOutput
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::foamVtkOutput::surfaceMeshWriter::getFaceField
|
||||
Foam::vtk::surfaceMeshWriter::getFaceField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld
|
||||
) const
|
||||
@ -60,7 +60,7 @@ Foam::foamVtkOutput::surfaceMeshWriter::getFaceField
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::foamVtkOutput::surfaceMeshWriter::write
|
||||
void Foam::vtk::surfaceMeshWriter::write
|
||||
(
|
||||
const UPtrList
|
||||
<
|
||||
@ -86,7 +86,7 @@ void Foam::foamVtkOutput::surfaceMeshWriter::write
|
||||
}
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), getFaceField(fld)());
|
||||
vtk::writeList(format(), getFaceField(fld)());
|
||||
|
||||
format().flush();
|
||||
|
||||
|
||||
@ -32,11 +32,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkOutput::writeSurfFields
|
||||
void Foam::vtk::writeSurfFields
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||
)
|
||||
{
|
||||
@ -46,7 +46,7 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
const bool legacy_(opts.legacy());
|
||||
|
||||
std::ofstream os((baseName + (legacy_ ? ".vtk" : ".vtp")).c_str());
|
||||
autoPtr<foamVtkOutput::formatter> format = opts.newFormatter(os);
|
||||
autoPtr<vtk::formatter> format = opts.newFormatter(os);
|
||||
|
||||
// Same payload size for points and vector fields!
|
||||
const int nCmpt(3); // vector
|
||||
@ -54,7 +54,7 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
|
||||
if (legacy_)
|
||||
{
|
||||
legacy::fileHeader(format(), "surfaceFields", vtkFileTag::POLY_DATA);
|
||||
legacy::fileHeader(format(), "surfaceFields", vtk::fileTag::POLY_DATA);
|
||||
legacy::beginPoints(os, mesh.nFaces());
|
||||
}
|
||||
else
|
||||
@ -64,30 +64,30 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
format()
|
||||
.xmlHeader()
|
||||
.xmlComment("surfaceFields")
|
||||
.beginVTKFile(vtkFileTag::POLY_DATA, "0.1");
|
||||
.beginVTKFile(vtk::fileTag::POLY_DATA, "0.1");
|
||||
|
||||
// Tricky - hide in beginPiece()
|
||||
format()
|
||||
.openTag(vtkFileTag::PIECE)
|
||||
( "NumberOfPoints", mesh.nFaces() )
|
||||
.openTag(vtk::fileTag::PIECE)
|
||||
.xmlAttr(vtk::fileAttr::NUMBER_OF_POINTS, mesh.nFaces())
|
||||
.closeTag();
|
||||
|
||||
format().tag(vtkFileTag::POINTS)
|
||||
.openDataArray<float,3>(vtkFileTag::POINTS)
|
||||
format().tag(vtk::fileTag::POINTS)
|
||||
.openDataArray<float,3>(vtk::dataArrayAttr::POINTS)
|
||||
.closeTag();
|
||||
}
|
||||
|
||||
const pointField& fc = mesh.faceCentres();
|
||||
|
||||
format().writeSize(payLoad);
|
||||
foamVtkOutput::writeList(format(), fc);
|
||||
vtk::writeList(format(), fc);
|
||||
format().flush();
|
||||
|
||||
if (!legacy_)
|
||||
{
|
||||
format()
|
||||
.endDataArray()
|
||||
.endTag(vtkFileTag::POINTS);
|
||||
.endTag(vtk::fileTag::POINTS);
|
||||
}
|
||||
|
||||
|
||||
@ -97,14 +97,14 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
legacy::dataHeader
|
||||
(
|
||||
os,
|
||||
vtkFileTag::POINT_DATA,
|
||||
vtk::fileTag::POINT_DATA,
|
||||
mesh.nFaces(),
|
||||
surfVectorFields.size()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
format().tag(vtkFileTag::POINT_DATA);
|
||||
format().tag(vtk::fileTag::POINT_DATA);
|
||||
}
|
||||
|
||||
// surfVectorFields
|
||||
@ -126,7 +126,7 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
|
||||
for (label facei=0; facei < mesh.nInternalFaces(); ++facei)
|
||||
{
|
||||
foamVtkOutput::write(format(), fld[facei]);
|
||||
vtk::write(format(), fld[facei]);
|
||||
}
|
||||
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
@ -139,12 +139,12 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
// Note: loop over polypatch size, not fvpatch size.
|
||||
forAll(pp.patch(), i)
|
||||
{
|
||||
foamVtkOutput::write(format(), vector::zero);
|
||||
vtk::write(format(), vector::zero);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foamVtkOutput::writeList(format(), pf);
|
||||
vtk::writeList(format(), pf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,12 +158,12 @@ void Foam::foamVtkOutput::writeSurfFields
|
||||
|
||||
if (!legacy_)
|
||||
{
|
||||
format().endTag(vtkFileTag::POINT_DATA);
|
||||
format().endTag(vtk::fileTag::POINT_DATA);
|
||||
|
||||
// slight cheat. </Piece> too
|
||||
format().endTag(vtkFileTag::PIECE);
|
||||
format().endTag(vtk::fileTag::PIECE);
|
||||
|
||||
format().endTag(vtkFileTag::POLY_DATA)
|
||||
format().endTag(vtk::fileTag::POLY_DATA)
|
||||
.endVTKFile();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InNamespace
|
||||
Foam::foamVtkOutput
|
||||
Foam::vtk
|
||||
|
||||
Description
|
||||
Write surface fields as vectors
|
||||
@ -44,7 +44,7 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
//- Write surface vector fields
|
||||
@ -52,11 +52,11 @@ void writeSurfFields
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fileName& baseName,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const UPtrList<const surfaceVectorField>& surfVectorFields
|
||||
);
|
||||
|
||||
} // End namespace foamVtkOutput
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
|
||||
@ -26,6 +26,8 @@ Class
|
||||
|
||||
Description
|
||||
Bookkeeping for mesh subsetting and/or polyhedral cell decomposition.
|
||||
Although the main use case is for handling vtk meshes, it is not specific
|
||||
to VTK alone.
|
||||
|
||||
The cellMap is a local-to-global lookup for normal and decomposed cells.
|
||||
The pointMap is an optional local-to-global lookup for point ids.
|
||||
@ -101,17 +103,19 @@ public:
|
||||
//- Clear
|
||||
inline void clear();
|
||||
|
||||
//- Renumber cell ids to account for subset meshes
|
||||
//- Renumber cell ids (cellMap and additionalIds) to account for
|
||||
// subset meshes
|
||||
void renumberCells(const UList<label>& mapping);
|
||||
|
||||
//- Renumber point ids to account for subset meshes
|
||||
//- Renumber point ids (pointMap) to account for subset meshes
|
||||
void renumberPoints(const UList<label>& mapping);
|
||||
|
||||
|
||||
//- Original cell ids for all cells (regular and decomposed).
|
||||
// A regular mesh comprising only primitive cell types, this will just
|
||||
// be an identity list. However, for subsetted meshes and decomposed
|
||||
// cells this becomes a useful means of mapping from the original mesh.
|
||||
// For a regular mesh comprising only primitive cell types, this
|
||||
// will simply be an identity list. However, for subsetted meshes
|
||||
// and decomposed cells this becomes a useful means of mapping from
|
||||
// the original mesh.
|
||||
inline DynamicList<label>& cellMap();
|
||||
|
||||
//- Point labels for subsetted meshes
|
||||
|
||||
@ -24,18 +24,18 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "foamVtkCells.H"
|
||||
#include "foamVtuCells.H"
|
||||
#include "foamVtkOutputOptions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkCells::foamVtkCells
|
||||
Foam::vtk::vtuCells::vtuCells
|
||||
(
|
||||
const contentType output,
|
||||
const bool decompose
|
||||
)
|
||||
:
|
||||
foamVtuSizing(),
|
||||
vtk::vtuSizing(),
|
||||
output_(output),
|
||||
decomposeRequest_(decompose),
|
||||
cellTypes_(),
|
||||
@ -47,26 +47,26 @@ Foam::foamVtkCells::foamVtkCells
|
||||
{}
|
||||
|
||||
|
||||
Foam::foamVtkCells::foamVtkCells
|
||||
Foam::vtk::vtuCells::vtuCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const contentType output,
|
||||
const bool decompose
|
||||
)
|
||||
:
|
||||
foamVtkCells(output, decompose)
|
||||
vtuCells(output, decompose)
|
||||
{
|
||||
reset(mesh);
|
||||
}
|
||||
|
||||
|
||||
Foam::foamVtkCells::foamVtkCells
|
||||
Foam::vtk::vtuCells::vtuCells
|
||||
(
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool decompose
|
||||
)
|
||||
:
|
||||
foamVtkCells
|
||||
vtuCells
|
||||
(
|
||||
(outOpts.legacy() ? contentType::LEGACY : contentType::XML),
|
||||
decompose
|
||||
@ -74,14 +74,14 @@ Foam::foamVtkCells::foamVtkCells
|
||||
{}
|
||||
|
||||
|
||||
Foam::foamVtkCells::foamVtkCells
|
||||
Foam::vtk::vtuCells::vtuCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool decompose
|
||||
)
|
||||
:
|
||||
foamVtkCells(outOpts, decompose)
|
||||
vtuCells(outOpts, decompose)
|
||||
{
|
||||
reset(mesh);
|
||||
}
|
||||
@ -89,15 +89,15 @@ Foam::foamVtkCells::foamVtkCells
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtkCells::~foamVtkCells()
|
||||
Foam::vtk::vtuCells::~vtuCells()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtkCells::clear()
|
||||
void Foam::vtk::vtuCells::clear()
|
||||
{
|
||||
foamVtuSizing::clear();
|
||||
vtuSizing::clear();
|
||||
cellTypes_.clear();
|
||||
vertLabels_.clear();
|
||||
vertOffset_.clear();
|
||||
@ -108,15 +108,15 @@ void Foam::foamVtkCells::clear()
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkCells::reset(const polyMesh& mesh)
|
||||
void Foam::vtk::vtuCells::reset(const polyMesh& mesh)
|
||||
{
|
||||
foamVtuSizing::reset(mesh, decomposeRequest_);
|
||||
vtuSizing::reset(mesh, decomposeRequest_);
|
||||
|
||||
cellTypes_.setSize(nFieldCells());
|
||||
vertLabels_.setSize(slotSize(output_, slotType::CELLS));
|
||||
vertOffset_.setSize(slotSize(output_, slotType::CELLS_OFFSETS));
|
||||
faceLabels_.setSize(slotSize(output_, slotType::FACES));
|
||||
faceOffset_.setSize(slotSize(output_, slotType::FACES_OFFSETS));
|
||||
vertLabels_.setSize(sizeOf(output_, slotType::CELLS));
|
||||
vertOffset_.setSize(sizeOf(output_, slotType::CELLS_OFFSETS));
|
||||
faceLabels_.setSize(sizeOf(output_, slotType::FACES));
|
||||
faceOffset_.setSize(sizeOf(output_, slotType::FACES_OFFSETS));
|
||||
|
||||
switch (output_)
|
||||
{
|
||||
@ -157,7 +157,7 @@ void Foam::foamVtkCells::reset(const polyMesh& mesh)
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkCells::reset
|
||||
void Foam::vtk::vtuCells::reset
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const enum contentType output,
|
||||
@ -171,13 +171,13 @@ void Foam::foamVtkCells::reset
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkCells::renumberCells(const UList<label>& mapping)
|
||||
void Foam::vtk::vtuCells::renumberCells(const UList<label>& mapping)
|
||||
{
|
||||
maps_.renumberCells(mapping);
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtkCells::renumberPoints(const UList<label>& mapping)
|
||||
void Foam::vtk::vtuCells::renumberPoints(const UList<label>& mapping)
|
||||
{
|
||||
maps_.renumberPoints(mapping);
|
||||
}
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::foamVtkCells
|
||||
Foam::vtk::vtuCells
|
||||
|
||||
Description
|
||||
A deep-copy description of an OpenFOAM volume mesh in data structures
|
||||
@ -36,20 +36,20 @@ Description
|
||||
related to the xml format, but not entirely.
|
||||
|
||||
SeeAlso
|
||||
Foam::foamVtuSizing
|
||||
Foam::vtk::vtuSizing
|
||||
|
||||
SourceFiles
|
||||
foamVtkCells.C
|
||||
foamVtkCellsI.H
|
||||
foamVtuCells.C
|
||||
foamVtuCellsI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef foamVtkCells_H
|
||||
#define foamVtkCells_H
|
||||
#ifndef foamVtuCells_H
|
||||
#define foamVtuCells_H
|
||||
|
||||
#include "foamVtkCore.H"
|
||||
#include "foamVtkMeshMaps.H"
|
||||
#include "foamVtuSizing.H"
|
||||
#include "foamVtkCore.H"
|
||||
#include "DynamicList.H"
|
||||
#include "labelList.H"
|
||||
|
||||
@ -61,22 +61,20 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class polyMesh;
|
||||
|
||||
namespace foamVtkOutput
|
||||
namespace vtk
|
||||
{
|
||||
// Forward declaration of classes
|
||||
class outputOptions;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class foamVtkCells Declaration
|
||||
Class Foam::vtk::vtuCells Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class foamVtkCells
|
||||
class vtuCells
|
||||
:
|
||||
public fileFormats::foamVtkCore,
|
||||
public foamVtuSizing
|
||||
public vtuSizing
|
||||
{
|
||||
// Private data
|
||||
// Private Member Data
|
||||
|
||||
// Requested output types
|
||||
|
||||
@ -111,10 +109,10 @@ class foamVtkCells
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
foamVtkCells(const foamVtkCells&) = delete;
|
||||
vtuCells(const vtuCells&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const foamVtkCells&) = delete;
|
||||
void operator=(const vtuCells&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
@ -123,7 +121,7 @@ public:
|
||||
|
||||
//- Construct from components.
|
||||
// Optionally with polyhedral decomposition.
|
||||
foamVtkCells
|
||||
vtuCells
|
||||
(
|
||||
const enum contentType output = contentType::XML,
|
||||
const bool decompose = false
|
||||
@ -131,7 +129,7 @@ public:
|
||||
|
||||
//- Construct from components and create the output information
|
||||
// immediately
|
||||
foamVtkCells
|
||||
vtuCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const enum contentType output = contentType::XML,
|
||||
@ -140,24 +138,24 @@ public:
|
||||
|
||||
//- Construct from components.
|
||||
// Optionally with polyhedral decomposition.
|
||||
foamVtkCells
|
||||
vtuCells
|
||||
(
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool decompose = false
|
||||
);
|
||||
|
||||
//- Construct from components and create the output information
|
||||
// immediately
|
||||
foamVtkCells
|
||||
vtuCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const foamVtkOutput::outputOptions outOpts,
|
||||
const vtk::outputOptions outOpts,
|
||||
const bool decompose = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~foamVtkCells();
|
||||
~vtuCells();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -230,11 +228,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "foamVtkCellsI.H"
|
||||
#include "foamVtuCellsI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -23,79 +23,80 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "foamVtkCells.H"
|
||||
#include "foamVtuCells.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
inline enum Foam::foamVtkCells::contentType Foam::foamVtkCells::content() const
|
||||
inline enum Foam::vtk::vtuCells::contentType
|
||||
Foam::vtk::vtuCells::content() const
|
||||
{
|
||||
return output_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::foamVtkCells::decomposeRequested() const
|
||||
inline bool Foam::vtk::vtuCells::decomposeRequested() const
|
||||
{
|
||||
return decomposeRequest_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::foamVtkCells::empty() const
|
||||
inline bool Foam::vtk::vtuCells::empty() const
|
||||
{
|
||||
return cellTypes_.empty();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtkCells::size() const
|
||||
inline Foam::label Foam::vtk::vtuCells::size() const
|
||||
{
|
||||
return cellTypes_.size();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::List<uint8_t>&
|
||||
Foam::foamVtkCells::cellTypes() const
|
||||
Foam::vtk::vtuCells::cellTypes() const
|
||||
{
|
||||
return cellTypes_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::vertLabels() const
|
||||
Foam::vtk::vtuCells::vertLabels() const
|
||||
{
|
||||
return vertLabels_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::vertOffsets() const
|
||||
Foam::vtk::vtuCells::vertOffsets() const
|
||||
{
|
||||
return vertOffset_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::faceLabels() const
|
||||
Foam::vtk::vtuCells::faceLabels() const
|
||||
{
|
||||
return faceLabels_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::faceOffsets() const
|
||||
Foam::vtk::vtuCells::faceOffsets() const
|
||||
{
|
||||
return faceOffset_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::addPointCellLabels() const
|
||||
Foam::vtk::vtuCells::addPointCellLabels() const
|
||||
{
|
||||
return maps_.additionalIds();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::foamVtkCells::cellMap() const
|
||||
Foam::vtk::vtuCells::cellMap() const
|
||||
{
|
||||
return maps_.cellMap();
|
||||
}
|
||||
@ -29,12 +29,12 @@ License
|
||||
#include "cellShape.H"
|
||||
#include "cellModeller.H"
|
||||
|
||||
// only used in this file
|
||||
// Only used in this file
|
||||
#include "foamVtuSizingTemplates.C"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtuSizing::presizeMaps(foamVtkMeshMaps& maps) const
|
||||
void Foam::vtk::vtuSizing::presizeMaps(foamVtkMeshMaps& maps) const
|
||||
{
|
||||
maps.cellMap().setSize(this->nFieldCells());
|
||||
maps.additionalIds().setSize(this->nAddPoints());
|
||||
@ -43,7 +43,7 @@ void Foam::foamVtuSizing::presizeMaps(foamVtkMeshMaps& maps) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtuSizing::foamVtuSizing
|
||||
Foam::vtk::vtuSizing::vtuSizing
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const bool decompose
|
||||
@ -54,7 +54,7 @@ Foam::foamVtuSizing::foamVtuSizing
|
||||
}
|
||||
|
||||
|
||||
Foam::foamVtuSizing::foamVtuSizing()
|
||||
Foam::vtk::vtuSizing::vtuSizing()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -62,13 +62,13 @@ Foam::foamVtuSizing::foamVtuSizing()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamVtuSizing::~foamVtuSizing()
|
||||
Foam::vtk::vtuSizing::~vtuSizing()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::foamVtuSizing::reset
|
||||
void Foam::vtk::vtuSizing::reset
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const bool decompose
|
||||
@ -160,7 +160,7 @@ void Foam::foamVtuSizing::reset
|
||||
|
||||
const labelList& cFaces = mesh.cells()[celli];
|
||||
|
||||
// Unique node ids used (only needed for XML)
|
||||
// Unique node ids used (XML/INTERNAL, not needed for LEGACY)
|
||||
hashUniqId.clear();
|
||||
|
||||
// Face stream sizing:
|
||||
@ -189,7 +189,7 @@ void Foam::foamVtuSizing::reset
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::foamVtuSizing::slotSize
|
||||
Foam::label Foam::vtk::vtuSizing::sizeOf
|
||||
(
|
||||
const enum contentType output,
|
||||
const enum slotType slot
|
||||
@ -269,7 +269,7 @@ Foam::label Foam::foamVtuSizing::slotSize
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateLegacy
|
||||
void Foam::vtk::vtuSizing::populateLegacy
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -298,7 +298,7 @@ void Foam::foamVtuSizing::populateLegacy
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateXml
|
||||
void Foam::vtk::vtuSizing::populateXml
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -327,7 +327,7 @@ void Foam::foamVtuSizing::populateXml
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -356,7 +356,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -385,7 +385,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -414,7 +414,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -442,7 +442,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -470,7 +470,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::populateInternal
|
||||
void Foam::vtk::vtuSizing::populateInternal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<uint8_t>& cellTypes,
|
||||
@ -498,7 +498,7 @@ void Foam::foamVtuSizing::populateInternal
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::clear()
|
||||
void Foam::vtk::vtuSizing::clear()
|
||||
{
|
||||
decompose_ = false;
|
||||
nCells_ = 0;
|
||||
@ -515,7 +515,7 @@ void Foam::foamVtuSizing::clear()
|
||||
}
|
||||
|
||||
|
||||
void Foam::foamVtuSizing::info(Ostream& os) const
|
||||
void Foam::vtk::vtuSizing::info(Ostream& os) const
|
||||
{
|
||||
os << "nFieldCells:" << nFieldCells();
|
||||
if (nAddCells_)
|
||||
@ -551,7 +551,7 @@ void Foam::foamVtuSizing::info(Ostream& os) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::foamVtuSizing::operator==(const foamVtuSizing& rhs) const
|
||||
bool Foam::vtk::vtuSizing::operator==(const vtuSizing& rhs) const
|
||||
{
|
||||
return
|
||||
(
|
||||
@ -569,7 +569,7 @@ bool Foam::foamVtuSizing::operator==(const foamVtuSizing& rhs) const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::foamVtuSizing::operator!=(const foamVtuSizing& rhs) const
|
||||
bool Foam::vtk::vtuSizing::operator!=(const vtuSizing& rhs) const
|
||||
{
|
||||
return !operator==(rhs);
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::foamVtuSizing
|
||||
Foam::vtk::vtuSizing
|
||||
|
||||
Description
|
||||
Sizing descriptions and routines for transcribing an OpenFOAM volume mesh
|
||||
@ -97,32 +97,36 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class polyMesh;
|
||||
|
||||
namespace vtk
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class foamVtuSizing Declaration
|
||||
Class Foam::vtk::vtuSizing Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class foamVtuSizing
|
||||
class vtuSizing
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Types of content that the storage may represent
|
||||
enum contentType
|
||||
{
|
||||
LEGACY, //!< Legacy VTK content
|
||||
XML, //!< XML (VTU) content
|
||||
INTERNAL //!< Internal vtkUnstructuredGrid content
|
||||
};
|
||||
//- Types of content that the storage may represent
|
||||
enum contentType
|
||||
{
|
||||
LEGACY, //!< Legacy VTK content
|
||||
XML, //!< XML (VTU) content
|
||||
INTERNAL //!< Internal vtkUnstructuredGrid content
|
||||
};
|
||||
|
||||
//- The possible storage 'slots' that can be used
|
||||
enum slotType
|
||||
{
|
||||
CELLS, //!< Cell connectivity (ALL)
|
||||
CELLS_OFFSETS, //!< End-offsets (XML) or locations (INTERNAL) for cells
|
||||
FACES, //!< Face-stream (XML, INTERNAL)
|
||||
FACES_OFFSETS //!< End-offsets (XML) or locations (INTERNAL) for faces
|
||||
};
|
||||
|
||||
//- The storage 'slots' required
|
||||
enum slotType
|
||||
{
|
||||
CELLS, //!< Cell connectivity (ALL)
|
||||
CELLS_OFFSETS, //!< Begin (XML) or end (INTERNAL) offsets into cells
|
||||
FACES, //!< Face-stream (XML, INTERNAL)
|
||||
FACES_OFFSETS //!< Begin (XML) or end (INTERNAL) offsets into faces
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@ -173,7 +177,7 @@ private:
|
||||
static void populateArrays
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const foamVtuSizing& sizing,
|
||||
const vtk::vtuSizing& sizing,
|
||||
UList<uint8_t>& cellTypes,
|
||||
UList<LabelType>& vertLabels,
|
||||
UList<LabelType>& vertOffset,
|
||||
@ -191,15 +195,15 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null.
|
||||
foamVtuSizing();
|
||||
vtuSizing();
|
||||
|
||||
//- Construct sizes by analyzing the mesh,
|
||||
// optionally with polyhedral decomposition.
|
||||
foamVtuSizing(const polyMesh& mesh, const bool decompose=false);
|
||||
vtuSizing(const polyMesh& mesh, const bool decompose=false);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~foamVtuSizing();
|
||||
~vtuSizing();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -257,7 +261,7 @@ public:
|
||||
// Derived sizes
|
||||
|
||||
//- Return the required size for the storage slot
|
||||
label slotSize
|
||||
label sizeOf
|
||||
(
|
||||
const enum contentType output,
|
||||
const enum slotType slot
|
||||
@ -385,16 +389,17 @@ public:
|
||||
// Member Operators
|
||||
|
||||
//- Test equality
|
||||
bool operator==(const foamVtuSizing& rhs) const;
|
||||
bool operator==(const vtuSizing& rhs) const;
|
||||
|
||||
//- Test inequality
|
||||
bool operator!=(const foamVtuSizing& rhs) const;
|
||||
bool operator!=(const vtuSizing& rhs) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace vtk
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -27,108 +27,108 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::foamVtuSizing::decompose() const
|
||||
inline bool Foam::vtk::vtuSizing::decompose() const
|
||||
{
|
||||
return decompose_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nCells() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nCells() const
|
||||
{
|
||||
return nCells_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nPoints() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nPoints() const
|
||||
{
|
||||
return nPoints_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nVertLabels() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nVertLabels() const
|
||||
{
|
||||
return nVertLabels_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nFaceLabels() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nFaceLabels() const
|
||||
{
|
||||
return nFaceLabels_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nCellsPoly() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nCellsPoly() const
|
||||
{
|
||||
return nCellsPoly_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nVertPoly() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nVertPoly() const
|
||||
{
|
||||
return nVertPoly_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nAddCells() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nAddCells() const
|
||||
{
|
||||
return nAddCells_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nAddPoints() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nAddPoints() const
|
||||
{
|
||||
return nAddPoints_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nAddVerts() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nAddVerts() const
|
||||
{
|
||||
return nAddVerts_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nFieldCells() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nFieldCells() const
|
||||
{
|
||||
return nCells_ + nAddCells_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::nFieldPoints() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::nFieldPoints() const
|
||||
{
|
||||
return nPoints_ + nAddPoints_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::sizeLegacy() const
|
||||
inline Foam::label Foam::vtk::vtuSizing::sizeLegacy() const
|
||||
{
|
||||
return slotSize(contentType::LEGACY, slotType::CELLS);
|
||||
return sizeOf(contentType::LEGACY, slotType::CELLS);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::sizeLegacy
|
||||
inline Foam::label Foam::vtk::vtuSizing::sizeLegacy
|
||||
(
|
||||
const enum slotType slot
|
||||
) const
|
||||
{
|
||||
return slotSize(contentType::LEGACY, slot);
|
||||
return sizeOf(contentType::LEGACY, slot);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::sizeXml
|
||||
inline Foam::label Foam::vtk::vtuSizing::sizeXml
|
||||
(
|
||||
const enum slotType slot
|
||||
) const
|
||||
{
|
||||
return slotSize(contentType::XML, slot);
|
||||
return sizeOf(contentType::XML, slot);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::foamVtuSizing::sizeInternal
|
||||
inline Foam::label Foam::vtk::vtuSizing::sizeInternal
|
||||
(
|
||||
const enum slotType slot
|
||||
) const
|
||||
{
|
||||
return slotSize(contentType::INTERNAL, slot);
|
||||
return sizeOf(contentType::INTERNAL, slot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,10 +32,10 @@ License
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class LabelType, class LabelType2>
|
||||
void Foam::foamVtuSizing::populateArrays
|
||||
void Foam::vtk::vtuSizing::populateArrays
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const foamVtuSizing& sizing,
|
||||
const vtk::vtuSizing& sizing,
|
||||
UList<uint8_t>& cellTypes,
|
||||
UList<LabelType>& vertLabels,
|
||||
UList<LabelType>& vertOffset,
|
||||
@ -46,8 +46,6 @@ void Foam::foamVtuSizing::populateArrays
|
||||
UList<LabelType2>& addPointsIds
|
||||
)
|
||||
{
|
||||
using vtkTypes = fileFormats::foamVtkCore::vtkTypes;
|
||||
|
||||
// STAGE 1: Verify storage sizes
|
||||
|
||||
if (cellTypes.size() != sizing.nFieldCells())
|
||||
@ -275,7 +273,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
|
||||
if (model == tet)
|
||||
{
|
||||
cellTypes[celli] = vtkTypes::VTK_TETRA;
|
||||
cellTypes[celli] = vtk::cellType::VTK_TETRA;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = shape.size();
|
||||
@ -292,7 +290,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
}
|
||||
else if (model == pyr)
|
||||
{
|
||||
cellTypes[celli] = vtkTypes::VTK_PYRAMID;
|
||||
cellTypes[celli] = vtk::cellType::VTK_PYRAMID;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = shape.size();
|
||||
@ -309,7 +307,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
}
|
||||
else if (model == hex)
|
||||
{
|
||||
cellTypes[celli] = vtkTypes::VTK_HEXAHEDRON;
|
||||
cellTypes[celli] = vtk::cellType::VTK_HEXAHEDRON;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = shape.size();
|
||||
@ -326,7 +324,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
}
|
||||
else if (model == prism)
|
||||
{
|
||||
cellTypes[celli] = vtkTypes::VTK_WEDGE;
|
||||
cellTypes[celli] = vtk::cellType::VTK_WEDGE;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = shape.size();
|
||||
@ -347,7 +345,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
else if (model == tetWedge && sizing.decompose())
|
||||
{
|
||||
// Treat as squeezed prism
|
||||
cellTypes[celli] = vtkTypes::VTK_WEDGE;
|
||||
cellTypes[celli] = vtk::cellType::VTK_WEDGE;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = 6;
|
||||
@ -367,7 +365,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
else if (model == wedge && sizing.decompose())
|
||||
{
|
||||
// Treat as squeezed hex
|
||||
cellTypes[celli] = vtkTypes::VTK_HEXAHEDRON;
|
||||
cellTypes[celli] = vtk::cellType::VTK_HEXAHEDRON;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celli] = 8;
|
||||
@ -443,7 +441,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
}
|
||||
cellMap[celLoc] = celli;
|
||||
|
||||
cellTypes[celLoc] = vtkTypes::VTK_PYRAMID;
|
||||
cellTypes[celLoc] = vtk::cellType::VTK_PYRAMID;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celLoc] = nShapePoints;
|
||||
@ -494,7 +492,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
}
|
||||
cellMap[celLoc] = celli;
|
||||
|
||||
cellTypes[celLoc] = vtkTypes::VTK_TETRA;
|
||||
cellTypes[celLoc] = vtk::cellType::VTK_TETRA;
|
||||
if (vertOffset.size())
|
||||
{
|
||||
vertOffset[celLoc] = nShapePoints;
|
||||
@ -504,7 +502,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
vertLabels[vrtLoc++] = nShapePoints;
|
||||
}
|
||||
|
||||
cellTypes[celLoc] = vtkTypes::VTK_TETRA;
|
||||
cellTypes[celLoc] = vtk::cellType::VTK_TETRA;
|
||||
|
||||
// See note above about the orientation.
|
||||
if (isOwner)
|
||||
@ -530,7 +528,7 @@ void Foam::foamVtuSizing::populateArrays
|
||||
|
||||
// face-stream
|
||||
// [nFaces, nFace0Pts, id1, id2, ..., nFace1Pts, id1, id2, ...]
|
||||
cellTypes[celli] = vtkTypes::VTK_POLYHEDRON;
|
||||
cellTypes[celli] = vtk::cellType::VTK_POLYHEDRON;
|
||||
const labelList& cFaces = mesh.cells()[celli];
|
||||
|
||||
const label startLabel = faceIndexer;
|
||||
|
||||
Reference in New Issue
Block a user