37 namespace surfaceWriters
67 fmtType_(static_cast<unsigned>(vtk::
formatType::INLINE_BASE64)),
80 fmtType_(static_cast<unsigned>(opts.fmt())),
81 precision_(opts.precision()),
93 fmtType_(static_cast<unsigned>(vtk::
formatType::INLINE_BASE64)),
96 options.getOrDefault(
"precision",
IOstream::defaultPrecision())
98 writeNormal_(options.getOrDefault(
"normal", false)),
115 fmtType_ =
static_cast<unsigned>(opts.
fmt());
129 open(surf, outputPath, parallel);
144 open(
points, faces, outputPath, parallel);
203 if (useTimeDir() && !
timeName().empty())
206 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
212 Info<<
"Writing geometry to " << outputFile <<
endl;
216 const meshedSurfRef& surf = adjustSurface();
222 new vtk::surfaceWriter
235 writer_->setTime(currTime_);
236 writer_->writeTimeValue();
241 writer_->beginFile(outputPath_.stem());
244 writer_->writeGeometry();
251 Field<vector> normals(fcs.size());
254 normals[facei] = fcs[facei].areaNormal(
pts);
259 if (!this->isPointData())
262 nCellData += nFields_;
265 writer_->beginCellData(nCellData);
266 writer_->write(
"area-normal", normals);
280 const word& fieldName,
290 tmp<Field<Type>> tfield = adjustField(fieldName, mergeField(localValues));
294 Info<<
" to " << outputFile <<
endl;
300 if (!nFields_ && writer_->legacy())
306 <<
"Using VTK legacy format, but did not define nFields!" 308 <<
"Assuming nFields=1 (may be incorrect) and continuing..." 310 <<
" Field " << fieldName <<
" to " << outputFile <<
nl;
316 if (this->isPointData())
318 writer_->beginPointData(nFields_);
322 writer_->beginCellData(nFields_);
325 writer_->
write(fieldName, tfield());
addNamedToRunTimeSelectionTable(surfaceWriter, vtkWriter, word, vtp)
A class for handling file names.
A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static std::string path(const std::string &str)
Return directory path name (part before last /)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
word ext() const
Return file name extension (part after last .)
virtual void endTime()
End time step. Clears existing backend.
Macros for easy insertion into run-time selection tables.
Abstract definition of a meshed surface defined by faces and points.
virtual ~vtkWriter()
Destructor. Calls close()
virtual void close()
Finish output, clears backend.
#define forAll(list, i)
Loop across all elements in list.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
List< face > faceList
List of faces.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
virtual void endTime()
End a time-step.
vectorField pointField
pointField is a vectorField.
word ext() const
File extension for current format type.
A class for handling words, derived from Foam::string.
formatType
The output format type for file contents.
bool ascii() const noexcept
True if output format is ASCII.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
vtk::formatType fmt() const noexcept
The output format type.
virtual void close()
Finish output, performing any necessary cleanup.
Convenience macros for instantiating surfaceWriter methods.
defineTypeName(abaqusWriter)
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
vtkWriter()
Default construct.
static streamFormat formatEnum(const word &fmtName, const streamFormat deflt=streamFormat::ASCII)
Lookup streamFormat enum corresponding to the string (ascii | binary).
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
bool legacy() const noexcept
True if writer uses legacy file format.
defineSurfaceWriterWriteFields(Foam::surfaceWriters::vtkWriter)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Base class for surface writers.
XML inline base64, base64Formatter.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
A class for managing temporary objects.
addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word)
virtual fileName write()
Write surface geometry to file.
virtual void beginTime(const Time &t)
Begin a time-step.