37namespace surfaceWriters
67 fmtType_(static_cast<unsigned>(vtk::formatType::INLINE_BASE64)),
68 precision_(
IOstream::defaultPrecision()),
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);
203 if (useTimeDir() && !
timeName().empty())
206 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
212 Info<<
"Writing geometry to " << outputFile <<
endl;
235 writer_->setTime(currTime_);
236 writer_->writeTimeValue();
241 writer_->beginFile(outputPath_.nameLessExt());
244 writer_->writeGeometry();
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());
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
@ ASCII
"ascii" (normal default)
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
An IOstream is an abstract base class for all input/output systems; be they streams,...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
A class for handling file names.
word ext() const
Return file name extension (part after last .)
static std::string path(const std::string &str)
Return directory path name (part before last /)
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Implements a meshed surface by referencing another meshed surface or faces/points components.
virtual const pointField & points() const
The points used for the surface.
virtual const faceList & faces() const
The faces used for the surface.
Abstract definition of a meshed surface defined by faces and points.
splitCell * master() const
Base class for surface writers.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
virtual void endTime()
End a time-step.
virtual void beginTime(const Time &t)
Begin a time-step.
virtual void close()
Finish output, performing any necessary cleanup.
A surfaceWriter for VTK legacy (.vtk) or XML (.vtp) format.
virtual void endTime()
End time step. Clears existing backend.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
virtual void close()
Finish output, clears backend.
vtkWriter()
Default construct.
virtual ~vtkWriter()
Destructor. Calls close()
virtual fileName write()
Write surface geometry to file.
A class for managing temporary objects.
word ext() const
File extension for current format type.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
bool legacy() const noexcept
True if writer uses legacy file format.
vtk::formatType fmt() const noexcept
The output format type.
bool ascii() const noexcept
True if output format is ASCII.
Write faces/points (optionally with fields) as a vtp file or a legacy vtk file.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
formatType
The output format type for file contents.
@ INLINE_BASE64
XML inline base64, base64Formatter.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Convenience macros for instantiating surfaceWriter methods.
#define defineSurfaceWriterWriteFields(ThisClass)