Go to the documentation of this file.
37 namespace surfaceWriters
67 fmtType_(static_cast<unsigned>(vtk::
formatType::INLINE_BASE64)),
68 precision_(
IOstream::defaultPrecision()),
81 fmtType_(
static_cast<unsigned>(opts.
fmt())),
118 fmtType_ =
static_cast<unsigned>(opts.
fmt());
132 open(surf, outputPath, parallel);
147 open(
points, faces, outputPath, parallel);
206 if (useTimeDir() && !
timeName().empty())
209 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
215 Info<<
"Writing geometry to " << outputFile <<
endl;
237 writer_->setTime(currTime_);
238 writer_->writeTimeValue();
243 writer_->beginFile(outputPath_.nameLessExt());
246 writer_->writeGeometry();
256 normals[facei] = fcs[facei].areaNormal(pts);
261 if (!this->isPointData())
264 nCellData += nFields_;
267 writer_->beginCellData(nCellData);
268 writer_->write(
"area-normal", normals);
282 const word& fieldName,
295 const scalar varScale =
297 std::is_integral<Type>::value
299 : fieldScale_.getOrDefault<scalar>(fieldName, 1)
304 Info<<
"Writing field " << fieldName;
305 if (!
equal(varScale, 1))
307 Info<<
" (scaling " << varScale <<
')';
309 Info<<
" to " << outputFile <<
endl;
318 if (!nFields_ && writer_->legacy())
324 <<
"Using VTK legacy format, but did not define nFields!"
326 <<
"Assuming nFields=1 (may be incorrect) and continuing..."
328 <<
" Field " << fieldName <<
" to " << outputFile <<
nl;
334 if (this->isPointData())
336 writer_->beginPointData(nFields_);
340 writer_->beginCellData(nFields_);
343 writer_->
write(fieldName, tfield());
Encapsulated combinations of output format options. This is primarily useful when defining the output...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
Base class for surface writers.
A class for handling file names.
defineTypeName(abaqusWriter)
static std::string path(const std::string &str)
Return directory path name (part before last /)
A class for managing temporary objects.
unsigned precision() const
Return the ASCII write precision.
virtual fileName write()
Write surface geometry to file.
virtual const faceList & faces() const =0
The faces used for the surface.
virtual void close()
Finish output, clears backend.
An IOstream is an abstract base class for all input/output systems; be they streams,...
Abstract definition of a meshed surface defined by faces and points.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
static bool master(const label communicator=worldComm)
Am I the master process.
bool legacy() const
True if writer uses legacy file format.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Convenience macros for instantiating surfaceWriter methods.
formatType fmt() const
The output format type.
#define forAll(list, i)
Loop across all elements in list.
virtual void endTime()
End a time-step.
addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word)
A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format.
formatType
The output format type for file contents.
virtual void beginTime(const Time &t)
Begin a time-step.
bool ascii() const
True if output format is ASCII.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual void endTime()
End time step. Clears existing backend.
virtual const pointField & points() const =0
The points used for the surface.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
XML inline base64, base64Formatter.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
word ext() const
Return file name extension (part after last .)
virtual ~vtkWriter()
Destructor. Calls close()
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
static unsigned int defaultPrecision() noexcept
Return the default precision.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
defineSurfaceWriterWriteFields(Foam::surfaceWriters::vtkWriter)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
An instant of time. Contains the time value and name.
virtual void close()
Finish output, performing any necessary cleanup.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
vtkWriter()
Default construct.
word ext() const
File extension for current format type.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
addNamedToRunTimeSelectionTable(surfaceWriter, vtkWriter, word, vtp)