39namespace coordSetWriters
53 fmtType_(static_cast<unsigned>(vtk::formatType::INLINE_BASE64)),
54 precision_(
IOstream::defaultPrecision()),
65 fmtType_(static_cast<unsigned>(opts.fmt())),
66 precision_(opts.precision()),
74 fmtType_(static_cast<unsigned>(vtk::formatType::INLINE_BASE64)),
77 options.getOrDefault(
"precision",
IOstream::defaultPrecision())
94 fmtType_ =
static_cast<unsigned>(opts.
fmt());
107 open(coords, outputPath);
120 open(tracks, outputPath);
198 Info<<
"Writing geometry to " << outputFile <<
endl;
201 if (!writer_ &&
true)
206 points.set(tracki, coords_.get(tracki));
220 if (useTracks_ || coords_.size() > 1)
228 writer_->setTime(currTime_);
229 writer_->writeTimeValue();
234 writer_->beginFile(outputPath_.nameLessExt());
237 writer_->writeGeometry();
250 const word& fieldName,
254 if (coords_.size() != fieldPtrs.size())
257 <<
"Attempted to write field: " << fieldName
258 <<
" (" << fieldPtrs.size() <<
" entries) for "
259 << coords_.size() <<
" sets" <<
nl
266 if (!nFields_ && writer_->legacy())
272 <<
"Using VTK legacy format, but did not define nFields!"
274 <<
"Assuming nFields=1 (may be incorrect) and continuing..."
276 <<
" Field " << fieldName <<
" to " << outputFile <<
nl;
282 writer_->beginPointData(nFields_);
284 writer_->writePointData(fieldName, fieldPtrs);
294 const word& fieldName,
305 return writeTemplate(fieldName, fieldPtrs);
312 const word& fieldName,
324 return writeTemplate(fieldName, fieldPtrs);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Generic templated field type.
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,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Base class for writing coordSet(s) and tracks with fields.
virtual void open(const fileName &outputPath)
Write separate geometry to file.
virtual void endTime()
End a time-step.
virtual void beginTime(const Time &t)
Begin a time-step.
virtual void endTime()
End time step. Clears existing backend.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
vtkWriter()
Default construct.
virtual fileName path() const
Expected (characteristic) output file name - information only.
virtual ~vtkWriter()
Destructor. Calls close()
virtual fileName write()
Write geometry to file.
Holds list of sampling positions.
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.
static const fileName null
An empty fileName.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Write as points/lines, optionally with fields, as a vtp file or a legacy vtk file.
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.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
Convenience macros for instantiating coordSetWriter methods.
#define defineCoordSetWriterWriteFields(ThisClass)
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
static constexpr char close