Write OpenFOAM patches and patch fields in VTP or legacy vtk format. More...
Public Member Functions | |
| patchMeshWriter (const polyMesh &mesh, const labelList &patchIDs, const vtk::outputOptions opts=vtk::formatType::INLINE_BASE64) | |
| Construct from components (default format INLINE_BASE64) More... | |
| patchMeshWriter (const polyMesh &mesh, const labelList &patchIDs, const fileName &file, bool parallel=Pstream::parRun()) | |
| patchMeshWriter (const polyMesh &mesh, const labelList &patchIDs, const vtk::outputOptions opts, const fileName &file, bool parallel=Pstream::parRun()) | |
| virtual | ~patchMeshWriter ()=default |
| Destructor. More... | |
| const labelList & | patchIDs () const |
| The patch IDs. More... | |
| virtual bool | beginFile (std::string title="") |
| Write file header (non-collective) More... | |
| virtual bool | writeGeometry () |
| Write patch topology. More... | |
| virtual bool | beginCellData (label nFields=0) |
| Begin CellData output section for specified number of fields. More... | |
| virtual bool | beginPointData (label nFields=0) |
| Begin PointData for specified number of fields. More... | |
| void | writePatchIDs () |
| Write patch ids as CellData. More... | |
| bool | writeProcIDs () |
| Write processor ids as CellData. This is no-op in serial. More... | |
| bool | writeNeighIDs () |
| Write processor neighbour ids as CellData. This is no-op in serial. More... | |
| template<class Type > | |
| void | writeUniform (const word &fieldName, const Type &val) |
| Write a uniform field of Cell (Face) or Point values. More... | |
Public Member Functions inherited from fileWriter | |
| fileWriter (const vtk::fileTag contentType, const vtk::outputOptions opts) | |
| Construct from components. More... | |
| virtual | ~fileWriter () |
| Destructor. More... | |
| vtk::fileTag | contentType () const |
| The content type. More... | |
| vtk::outputOptions | opts () const |
| The output options in use. More... | |
| word | ext () const |
| File extension for current format type. More... | |
| bool | legacy () const |
| Commonly used query. More... | |
| bool | parallel () const |
| Parallel output requested? More... | |
| const word & | state () const |
| The output state in printable format. More... | |
| const fileName & | output () const |
| The current output file name. More... | |
| bool | open (const fileName &file, bool parallel=Pstream::parRun()) |
| Open file for writing (creates parent directory). More... | |
| void | close () |
| End the file contents and close the file after writing. More... | |
| bool | beginFieldData (label nFields=0) |
| Begin FieldData output section for specified number of fields. More... | |
| label | nCellData () const |
| Return the number of CellData written for the Piece thus far. More... | |
| label | nPointData () const |
| Return the number of PointData written for the Piece thus far. More... | |
| bool | endFieldData () |
| Explicitly end FieldData output and switch to DECLARED state. More... | |
| bool | endCellData () |
| Explicitly end CellData output and switch to PIECE state. More... | |
| bool | endPointData () |
| Explicitly end PointData output and switch to PIECE state. More... | |
| void | writeTimeValue (scalar timeValue) |
| Write "TimeValue" FieldData (name as per Catalyst output) More... | |
Static Public Member Functions | |
| static word | ext (vtk::outputOptions opts) |
| File extension for given output type. More... | |
Protected Member Functions | |
| void | beginPiece () |
| void | writePoints () |
| Write patch points. More... | |
| void | writePolysLegacy (const label pointOffset) |
| Write patch faces, legacy format. More... | |
| void | writePolys (const label pointOffset) |
| Write patch faces. More... | |
| patchMeshWriter (const patchMeshWriter &)=delete | |
| No copy construct. More... | |
| void | operator= (const patchMeshWriter &)=delete |
| No copy assignment. More... | |
Protected Member Functions inherited from fileWriter | |
| std::ofstream & | os () |
| The backend ostream in use. More... | |
| vtk::formatter & | format () |
| The VTK formatter in use. More... | |
| bool | isState (outputState test) const |
| True if the output state corresponds to the test state. More... | |
| bool | notState (outputState test) const |
| True if the output state does not correspond to the test state. More... | |
| template<class Type > | |
| void | writeUniform (const word &fieldName, const Type &val, const label nValues) |
| Write uniform field content. More... | |
| bool | enter_Piece () |
| Trigger change state to Piece. Resets nCellData_, nPointData_. More... | |
| bool | endPiece () |
| Explicitly end Piece output and switch to DECLARED state. More... | |
| bool | enter_CellData (label nEntries, label nFields) |
| Trigger change state to CellData. More... | |
| bool | enter_PointData (label nEntries, label nFields) |
| Trigger change state to PointData. More... | |
| bool | exit_File () |
| Emit file footer (end data, end piece, end file) More... | |
| fileWriter (const fileWriter &)=delete | |
| No copy construct. More... | |
| void | operator= (const fileWriter &)=delete |
| No copy assignment. More... | |
Protected Attributes | |
| const polyMesh & | mesh_ |
| Reference to the OpenFOAM mesh (or subset) More... | |
| labelList | patchIDs_ |
| The selected patch ids. More... | |
| label | numberOfPoints_ |
| The number of field points for the current Piece. More... | |
| label | numberOfCells_ |
| The number of field cells (faces) for the current Piece. More... | |
| label | nLocalPoints_ |
| Local number of points. More... | |
| label | nLocalFaces_ |
| Local number of faces. More... | |
| label | nLocalVerts_ |
| Local face vertices (connectivity) count. Sum of face sizes. More... | |
Protected Attributes inherited from fileWriter | |
| vtk::fileTag | contentType_ |
| The content type. More... | |
| outputOptions | opts_ |
| The requested output options. More... | |
| bool | parallel_ |
| Writing in parallel (via master) More... | |
| outputState | state_ |
| The output state. More... | |
| label | nCellData_ |
| The number of CellData written for the Piece thus far. More... | |
| label | nPointData_ |
| The number of PointData written for the Piece thus far. More... | |
| fileName | outputFile_ |
| The output file name. More... | |
| autoPtr< vtk::formatter > | format_ |
| The VTK formatter in use (master process) More... | |
| std::ofstream | os_ |
| The backend ostream in use (master process) More... | |
Additional Inherited Members | |
Protected Types inherited from fileWriter | |
| enum | outputState { CLOSED = 0, OPENED, DECLARED, FIELD_DATA, PIECE, CELL_DATA, POINT_DATA } |
| Internal tracking of the output state. More... | |
Static Protected Attributes inherited from fileWriter | |
| static const Enum< outputState > | stateNames |
| Names for the output state (for messages, not for file output). More... | |
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
The file output states are managed by the Foam::vtk::fileWriter class. FieldData (eg, TimeValue) must appear before any geometry pieces.
Definition at line 67 of file foamVtkPatchMeshWriter.H.
|
protecteddelete |
No copy construct.
| patchMeshWriter | ( | const polyMesh & | mesh, |
| const labelList & | patchIDs, | ||
| const vtk::outputOptions | opts = vtk::formatType::INLINE_BASE64 |
||
| ) |
Construct from components (default format INLINE_BASE64)
| useNearCellValue | to use cell instead of patch values |
Definition at line 393 of file foamVtkPatchMeshWriter.C.
| patchMeshWriter | ( | const polyMesh & | mesh, |
| const labelList & | patchIDs, | ||
| const fileName & | file, | ||
| bool | parallel = Pstream::parRun() |
||
| ) |
Construct from components (default format INLINE_BASE64), and open the file for writing.
The file name is with/without an extension.
Definition at line 414 of file foamVtkPatchMeshWriter.C.
| patchMeshWriter | ( | const polyMesh & | mesh, |
| const labelList & | patchIDs, | ||
| const vtk::outputOptions | opts, | ||
| const fileName & | file, | ||
| bool | parallel = Pstream::parRun() |
||
| ) |
Construct from components (default format INLINE_BASE64), Construct from components and open the file for writing.
The file name is with/without an extension.
Definition at line 428 of file foamVtkPatchMeshWriter.C.
|
virtualdefault |
Destructor.
|
protected |
Determine sizes (nLocalPoints_, nLocalFaces_, nLocalVerts_), and begin piece.
Definition at line 36 of file foamVtkPatchMeshWriter.C.
References polyMesh::boundaryMesh(), f(), fileWriter::format(), fileWriter::format_, fileWriter::legacy(), patchMeshWriter::mesh_, patchMeshWriter::nLocalFaces_, patchMeshWriter::nLocalPoints_, patchMeshWriter::nLocalVerts_, PrimitivePatch< FaceList, PointField >::nPoints(), Foam::vtk::NUMBER_OF_POINTS, Foam::vtk::NUMBER_OF_POLYS, patchMeshWriter::numberOfCells_, patchMeshWriter::numberOfPoints_, fileWriter::parallel_, patches, patchId(), patchMeshWriter::patchIDs_, Foam::vtk::PIECE, Foam::reduce(), and formatter::tag().
|
protected |
Write patch points.
Definition at line 83 of file foamVtkPatchMeshWriter.C.
References Foam::vtk::legacy::beginPoints(), UPstream::blocking, UPstream::firstSlave(), format(), UPstream::lastSlave(), PrimitivePatch< FaceList, PointField >::localPoints(), UPstream::master(), UPstream::masterNo(), nPatches, patches, patchId(), Foam::vtk::POINTS, and Foam::vtk::writeList().
|
protected |
Write patch faces, legacy format.
| pointOffset | processor-local point offset |
Definition at line 178 of file foamVtkPatchMeshWriter.C.
References Foam::vtk::legacy::beginPolys(), Foam::exit(), f(), Foam::FatalError, FatalErrorInFunction, format(), PrimitivePatch< FaceList, PointField >::localFaces(), PrimitivePatch< FaceList, PointField >::nPoints(), patches, patchId(), Foam::reduce(), Foam::vtk::writeList(), and Foam::vtk::writeListParallel().
|
protected |
Write patch faces.
| pointOffset | processor-local point offset |
Definition at line 249 of file foamVtkPatchMeshWriter.C.
References Foam::vtk::CONNECTIVITY, f(), format(), PrimitivePatch< FaceList, PointField >::localFaces(), globalIndex::localStart(), PrimitivePatch< FaceList, PointField >::nPoints(), Foam::vtk::OFFSETS, patches, patchId(), Foam::vtk::POLYS, Foam::reduce(), Foam::vtk::writeList(), and Foam::vtk::writeListParallel().
|
protecteddelete |
No copy assignment.
|
inlinestatic |
File extension for given output type.
Definition at line 169 of file foamVtkPatchMeshWriter.H.
References outputOptions::ext(), fileWriter::opts(), and Foam::vtk::POLY_DATA.
|
inline |
The patch IDs.
Definition at line 175 of file foamVtkPatchMeshWriter.H.
References patchMeshWriter::patchIDs_.
|
virtual |
Write file header (non-collective)
Reimplemented from fileWriter.
Definition at line 444 of file foamVtkPatchMeshWriter.C.
References fileWriter::beginFile(), and Foam::name().
|
virtual |
Write patch topology.
Also writes the file header if not previously written.
Implements fileWriter.
Definition at line 494 of file foamVtkPatchMeshWriter.C.
References globalIndex::localStart().
|
virtual |
Begin CellData output section for specified number of fields.
Must be called prior to writing any cell data fields.
| nFields | is for legacy format only. When nFields=0, this a no-op for legacy format. |
Implements fileWriter.
Definition at line 520 of file foamVtkPatchMeshWriter.C.
|
virtual |
Begin PointData for specified number of fields.
Must be called prior to writing any point data fields.
| nFields | is for legacy format only. When nFields=0, this a no-op for legacy format. |
Implements fileWriter.
Definition at line 526 of file foamVtkPatchMeshWriter.C.
| void writePatchIDs | ( | ) |
Write patch ids as CellData.
Must be called within the CELL_DATA state.
Definition at line 532 of file foamVtkPatchMeshWriter.C.
References UPstream::blocking, Foam::vtk::CELL_DATA, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UPstream::firstSlave(), format(), UPstream::lastSlave(), UPstream::master(), UPstream::masterNo(), Foam::nl, patches, patchId(), Foam::reduce(), and Foam::vtk::write().
| bool writeProcIDs | ( | ) |
Write processor ids as CellData. This is no-op in serial.
Must be called within the CELL_DATA state.
Definition at line 643 of file foamVtkPatchMeshWriter.C.
References Foam::vtk::CELL_DATA, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, format(), globalIndex::localSize(), UPstream::master(), UPstream::myProcNo(), Foam::nl, UPstream::nProcs(), UPstream::parRun(), Foam::reduce(), Foam::returnReduce(), and Foam::vtk::write().
| bool writeNeighIDs | ( | ) |
Write processor neighbour ids as CellData. This is no-op in serial.
Must be called within the CELL_DATA state.
Definition at line 727 of file foamVtkPatchMeshWriter.C.
References UPstream::blocking, Foam::vtk::CELL_DATA, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UPstream::firstSlave(), format(), UPstream::lastSlave(), UPstream::master(), UPstream::masterNo(), Foam::nl, UPstream::parRun(), patches, patchId(), Foam::reduce(), Foam::returnReduce(), and Foam::vtk::write().
| void writeUniform | ( | const word & | fieldName, |
| const Type & | val | ||
| ) |
Write a uniform field of Cell (Face) or Point values.
Definition at line 35 of file foamVtkPatchMeshWriterTemplates.C.
References Foam::endl(), Foam::exit(), Foam::FatalError, Foam::nl, Foam::expressions::patchExpr::POINT_DATA, and WarningInFunction.
|
protected |
Reference to the OpenFOAM mesh (or subset)
Definition at line 76 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().
|
protected |
The selected patch ids.
Definition at line 79 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece(), and patchMeshWriter::patchIDs().
|
protected |
The number of field points for the current Piece.
Definition at line 82 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().
|
protected |
The number of field cells (faces) for the current Piece.
Definition at line 85 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().
|
protected |
Local number of points.
Definition at line 88 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().
|
protected |
Local number of faces.
Definition at line 91 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().
|
protected |
Local face vertices (connectivity) count. Sum of face sizes.
Definition at line 94 of file foamVtkPatchMeshWriter.H.
Referenced by patchMeshWriter::beginPiece().