39 namespace 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);
189 vtk::outputOptions opts(static_cast<vtk::formatType>(fmtType_), precision_);
198 Info<<
"Writing geometry to " << outputFile <<
endl;
201 if (!writer_ &&
true)
203 UPtrList<const pointField>
points(coords_.size());
206 points.set(tracki, coords_.get(tracki));
211 new vtk::coordSetWriter
220 if (useTracks_ || coords_.size() > 1)
228 writer_->setTime(currTime_);
229 writer_->writeTimeValue();
234 writer_->beginFile(outputPath_.stem());
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);
addToRunTimeSelectionTable(coordSetWriter, abaqusWriter, word)
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual void close(bool force=false)
Close and reset, clears backend.
virtual ~vtkWriter()
Destructor. Calls close()
constexpr char nl
The newline '\n' character (0x0a)
static const fileName null
An empty fileName.
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineTypeName(abaqusWriter)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual fileName path() const
Expected (characteristic) output file name - information only.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Encapsulated combinations of output format options. This is primarily useful when defining the output...
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
virtual void beginTime(const Time &t)
Begin a time-step.
virtual fileName write()
Write geometry to file.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Convenience macros for instantiating coordSetWriter methods.
defineCoordSetWriterWriteFields(Foam::coordSetWriters::vtkWriter)
Holds list of sampling positions.
Generic templated field type.
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.
Base class for writing coordSet(s) and tracks with fields.
bool ascii() const noexcept
True if output format is ASCII.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
vtk::formatType fmt() const noexcept
The output format type.
virtual void endTime()
End a time-step.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
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).
virtual void endTime()
End time step. Clears existing backend.
bool legacy() const noexcept
True if writer uses legacy file format.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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...
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.