vtkWriter Class Reference

A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format. More...

Inheritance diagram for vtkWriter:
[legend]
Collaboration diagram for vtkWriter:
[legend]

Public Member Functions

 TypeNameNoDebug ("vtk")
 Declare type-name, virtual type (without debug switch) More...
 
 vtkWriter ()
 Default construct. More...
 
 vtkWriter (const vtk::outputOptions &opts)
 Construct with some output options. More...
 
 vtkWriter (const dictionary &options)
 Construct with some output options. More...
 
 vtkWriter (const meshedSurf &surf, const fileName &outputPath, bool parallel=Pstream::parRun(), const dictionary &options=dictionary())
 Construct from components. More...
 
 vtkWriter (const pointField &points, const faceList &faces, const fileName &outputPath, bool parallel=Pstream::parRun(), const dictionary &options=dictionary())
 Construct from components with specified output path. More...
 
virtual ~vtkWriter ()
 Destructor. Calls close() More...
 
virtual void close ()
 Finish output, clears backend. More...
 
virtual void beginTime (const Time &t)
 Begin time step. Clears existing backend. More...
 
virtual void beginTime (const instant &inst)
 Begin time step. Clears existing backend. More...
 
virtual void endTime ()
 End time step. Clears existing backend. More...
 
virtual fileName write ()
 Write surface geometry to file. More...
 
 declareSurfaceWriterWriteMethod (label)
 
 declareSurfaceWriterWriteMethod (scalar)
 
 declareSurfaceWriterWriteMethod (vector)
 
 declareSurfaceWriterWriteMethod (sphericalTensor)
 
 declareSurfaceWriterWriteMethod (symmTensor)
 
 declareSurfaceWriterWriteMethod (tensor)
 
template<class Type >
Foam::fileName writeTemplate (const word &fieldName, const Field< Type > &localValues)
 
- Public Member Functions inherited from surfaceWriter
 TypeName ("surfaceWriter")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, surfaceWriter, word,(),())
 
 declareRunTimeSelectionTable (autoPtr, surfaceWriter, wordDict,(const dictionary &writeOpts),(writeOpts))
 
 surfaceWriter ()
 Default construct. More...
 
 surfaceWriter (const dictionary &options)
 Default construct with specified options. More...
 
 surfaceWriter (const meshedSurf &surf, bool parallel=Pstream::parRun(), const dictionary &options=dictionary())
 Construct from components. More...
 
 surfaceWriter (const pointField &points, const faceList &faces, bool parallel=Pstream::parRun(), const dictionary &options=dictionary())
 Construct from components. More...
 
virtual ~surfaceWriter ()
 Destructor. Calls close() More...
 
virtual bool enabled () const
 
virtual bool separateGeometry () const
 True if the surface format requires geometry in a separate file. More...
 
virtual bool usesFaceIds () const
 True if the writer format uses faceIds as part of its output. More...
 
virtual bool needsUpdate () const
 Does the writer need an update (eg, lagging behind surface changes) More...
 
virtual bool wroteData () const
 Geometry or fields written since the last open? More...
 
virtual bool expire ()
 
virtual void clear ()
 
virtual void setSurface (const meshedSurf &surf, bool parallel)
 
virtual void setSurface (const pointField &points, const faceList &faces, bool parallel)
 
virtual void setSurface (const meshedSurf &surf)
 
virtual void setSurface (const pointField &points, const faceList &faces)
 
bool hasSurface () const
 Writer is associated with a surface. More...
 
bool empty () const
 The surface to write is empty if the global number of faces is zero. More...
 
label size () const
 The global number of faces for the associated surface. More...
 
label nFields () const
 The number of expected output fields. More...
 
label nFields (const label n)
 Set the number of expected output fields. More...
 
bool isPointData () const
 Are the field data to be treated as point data? More...
 
bool isPointData (const bool on)
 Set handling of field data to face/point data. More...
 
bool useTimeDir () const
 Should a time directory be spliced into the output path? More...
 
bool useTimeDir (const bool on)
 Enable/disable use of spliced output path. More...
 
bool verbose () const
 Get output verbosity. More...
 
bool verbose (const bool on)
 Enable/disable verbose output. More...
 
scalar mergeDim () const
 The current value of the point merge dimension (metre) More...
 
scalar mergeDim (const scalar dist)
 Change the point merge dimension (metre) More...
 
bool hasTime () const
 True if there is a known time. More...
 
const wordtimeName () const
 The current time value/name. More...
 
scalar timeValue () const
 The current time value/name. More...
 
void setTime (const instant &inst)
 Set the current time. More...
 
void setTime (scalar timeValue)
 Set current time from timeValue, auto generating the name. More...
 
void setTime (scalar timeValue, const word &timeName)
 Set current time from timeValue and timeName. More...
 
void unsetTime ()
 Clear the current time. More...
 
virtual void open (const fileName &outputPath)
 Open for output on specified path, using existing surface. More...
 
virtual void open (const pointField &points, const faceList &faces, const fileName &outputPath, bool parallel)
 Open from components. More...
 
virtual void open (const meshedSurf &surf, const fileName &outputPath, bool parallel)
 Open from components. More...
 
virtual void open (const pointField &points, const faceList &faces, const fileName &outputPath)
 Open from components, with the current parallel/serial treatment. More...
 
virtual void open (const meshedSurf &surf, const fileName &outputPath)
 Open from components, with the current parallel/serial treatment. More...
 
virtual fileName write (const word &fieldName, const Field< label > &values)=0
 Write field of label (per face or vertex) More...
 
virtual fileName write (const word &fieldName, const Field< scalar > &values)=0
 Write field of scalar (per face or vertex) More...
 
virtual fileName write (const word &fieldName, const Field< vector > &values)=0
 Write field of vector (per face or vertex) More...
 
virtual fileName write (const word &fieldName, const Field< sphericalTensor > &values)=0
 Write field of sphericalTensor (per face or vertex) More...
 
virtual fileName write (const word &fieldName, const Field< symmTensor > &values)=0
 Write field of symmTensor (per face or vertex) More...
 
virtual fileName write (const word &fieldName, const Field< tensor > &values)=0
 Write field of tensor (per face or vertex) More...
 
virtual InfoProxy< surfaceWriterinfo () const
 Return info proxy. More...
 
template<class Type >
Foam::tmp< Foam::Field< Type > > mergeFieldTemplate (const Field< Type > &fld) const
 

Additional Inherited Members

- Static Public Member Functions inherited from surfaceWriter
static bool supportedType (const word &writeType)
 True if New is likely to succeed for this writeType. More...
 
static autoPtr< surfaceWriterNew (const word &writeType)
 Return a reference to the selected surfaceWriter. More...
 
static autoPtr< surfaceWriterNew (const word &writeType, const dictionary &writeOptions)
 Return a reference to the selected surfaceWriter. More...
 
- Static Public Attributes inherited from surfaceWriter
static scalar defaultMergeDim = 1e-8
 The default merge dimension (1e-8) More...
 
- Protected Member Functions inherited from surfaceWriter
bool checkOpen () const
 Verify that the outputPath_ has been set or FatalError. More...
 
virtual bool merge () const
 
const meshedSurfsurface () const
 
template<class Type >
tmp< Field< Type > > mergeFieldTemplate (const Field< Type > &fld) const
 Gather (merge) fields with renumbering and shrinking for point data. More...
 
tmp< Field< label > > mergeField (const Field< label > &fld) const
 
tmp< Field< scalar > > mergeField (const Field< scalar > &fld) const
 
tmp< Field< vector > > mergeField (const Field< vector > &fld) const
 
tmp< Field< sphericalTensor > > mergeField (const Field< sphericalTensor > &fld) const
 
tmp< Field< symmTensor > > mergeField (const Field< symmTensor > &fld) const
 
tmp< Field< tensor > > mergeField (const Field< tensor > &fld) const
 
template<class Type >
fileName writeTemplate (const word &fieldName, const Field< Type > &localValues)
 Dummy templated write operation. More...
 
- Protected Attributes inherited from surfaceWriter
std::reference_wrapper< const meshedSurfsurf_
 Reference to a surface. More...
 
meshedSurfRef surfComp_
 Reference to raw surface components. More...
 
bool useComponents_
 Use raw surface components instead of surface reference. More...
 
bool upToDate_
 The topology/surface is up-to-date? More...
 
bool wroteGeom_
 Track if geometry has been written since the last open. More...
 
bool parallel_
 Writing in parallel (via master) More...
 
bool useTimeDir_
 Insert additional time sub-directory in the output path. More...
 
bool isPointData_
 Is point vs cell data. More...
 
bool verbose_
 Additional output verbosity. More...
 
label nFields_
 The number of fields. More...
 
scalar mergeDim_
 Dimension for merging. More...
 
mergedSurf merged_
 Merging information and the resulting merged surface (parallel) More...
 
instant currTime_
 The current time value/name. More...
 
fileName outputPath_
 The full output directory and file (surface) name. More...
 
- Static Protected Attributes inherited from surfaceWriter
static const meshedSurf::emptySurface emptySurface_
 Placeholder. More...
 

Detailed Description

A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format.

The formatOptions for vtk:

Property Description Required Default
format ascii or binary format no binary
legacy Legacy VTK output no false
precision Write precision in ascii no same as IOstream
fieldScale Output field scaling (dictionary) no empty
normal Write face area-normal in output no false

For example,

    formatOptions
    {
        vtk
        {
            format      binary;
            legacy      false;
            precision   10;
            fieldScale
            {
               "p.*"   0.01;  // [Pa] -> [mbar]
            }
        }
    }

file locations

The rootdir normally corresponds to something like postProcessing/<name>

Geometry

    rootdir
    `-- timeName
        `-- surfaceName.{vtk,vtp}
Source files

Definition at line 130 of file vtkSurfaceWriter.H.

Constructor & Destructor Documentation

◆ vtkWriter() [1/5]

vtkWriter ( )

Default construct.

Definition at line 64 of file vtkSurfaceWriter.C.

◆ vtkWriter() [2/5]

vtkWriter ( const vtk::outputOptions opts)
explicit

Construct with some output options.

Definition at line 76 of file vtkSurfaceWriter.C.

◆ vtkWriter() [3/5]

vtkWriter ( const dictionary options)
explicit

Construct with some output options.

Definition at line 90 of file vtkSurfaceWriter.C.

References IOstreamOption::ASCII, outputOptions::ascii(), IOstreamOption::BINARY, outputOptions::fmt(), IOstreamOption::formatEnum(), dictionary::getOrDefault(), Foam::vtk::INLINE_BASE64, and outputOptions::legacy().

Here is the call graph for this function:

◆ vtkWriter() [4/5]

vtkWriter ( const meshedSurf surf,
const fileName outputPath,
bool  parallel = Pstream::parRun(),
const dictionary options = dictionary() 
)

Construct from components.

The file name is with/without an extension.

Definition at line 123 of file vtkSurfaceWriter.C.

◆ vtkWriter() [5/5]

vtkWriter ( const pointField points,
const faceList faces,
const fileName outputPath,
bool  parallel = Pstream::parRun(),
const dictionary options = dictionary() 
)

Construct from components with specified output path.

The file name is with/without an extension.

Definition at line 137 of file vtkSurfaceWriter.C.

References points.

◆ ~vtkWriter()

~vtkWriter ( )
virtual

Destructor. Calls close()

Definition at line 153 of file vtkSurfaceWriter.C.

Member Function Documentation

◆ TypeNameNoDebug()

TypeNameNoDebug ( "vtk"  )

Declare type-name, virtual type (without debug switch)

◆ close()

void close ( )
virtual

Finish output, clears backend.

Reimplemented from surfaceWriter.

Definition at line 161 of file vtkSurfaceWriter.C.

References surfaceWriter::close().

Here is the call graph for this function:

◆ beginTime() [1/2]

void beginTime ( const Time t)
virtual

Begin time step. Clears existing backend.

Reimplemented from surfaceWriter.

Definition at line 168 of file vtkSurfaceWriter.C.

References surfaceWriter::beginTime().

Here is the call graph for this function:

◆ beginTime() [2/2]

void beginTime ( const instant inst)
virtual

Begin time step. Clears existing backend.

Reimplemented from surfaceWriter.

Definition at line 175 of file vtkSurfaceWriter.C.

References surfaceWriter::beginTime().

Here is the call graph for this function:

◆ endTime()

void endTime ( )
virtual

End time step. Clears existing backend.

Reimplemented from surfaceWriter.

Definition at line 182 of file vtkSurfaceWriter.C.

References surfaceWriter::endTime().

Here is the call graph for this function:

◆ write()

Foam::fileName write ( )
virtual

Write surface geometry to file.

Implements surfaceWriter.

Definition at line 189 of file vtkSurfaceWriter.C.

References Foam::endl(), fileWriter::ext(), fileName::ext(), meshedSurf::faces(), forAll, Foam::Info, UPstream::master(), fileName::path(), meshedSurf::points(), and timeName.

Here is the call graph for this function:

◆ declareSurfaceWriterWriteMethod() [1/6]

declareSurfaceWriterWriteMethod ( label  )

◆ declareSurfaceWriterWriteMethod() [2/6]

declareSurfaceWriterWriteMethod ( scalar  )

◆ declareSurfaceWriterWriteMethod() [3/6]

declareSurfaceWriterWriteMethod ( vector  )

◆ declareSurfaceWriterWriteMethod() [4/6]

declareSurfaceWriterWriteMethod ( sphericalTensor  )

◆ declareSurfaceWriterWriteMethod() [5/6]

declareSurfaceWriterWriteMethod ( symmTensor  )

◆ declareSurfaceWriterWriteMethod() [6/6]

declareSurfaceWriterWriteMethod ( tensor  )

◆ writeTemplate()

Foam::fileName writeTemplate ( const word fieldName,
const Field< Type > &  localValues 
)

Definition at line 281 of file vtkSurfaceWriter.C.

References Foam::endl(), Foam::equal(), Foam::FatalError, FatalErrorInFunction, Foam::Info, UPstream::master(), Foam::nl, Foam::vtk::write(), and Ostream::write().

Here is the call graph for this function:

The documentation for this class was generated from the following files: