72#ifndef Foam_vtk_vtmWriter_H
73#define Foam_vtk_vtmWriter_H
100 enum entryType :
char
104 BEGIN_BLOCK =
'{', END_BLOCK =
'}',
121 vtmEntry(
const vtmEntry&) =
default;
122 vtmEntry(vtmEntry&&) =
default;
123 vtmEntry& operator=(
const vtmEntry&) =
default;
124 vtmEntry& operator=(vtmEntry&&) =
default;
129 type_(entryType::NONE),
142 type_(what), content_(content), name_(
name), file_(file)
149 static vtmEntry
block(
const string&
name)
151 return vtmEntry(entryType::BEGIN_BLOCK,
name,
"");
155 static vtmEntry endblock()
157 return vtmEntry(entryType::END_BLOCK,
"",
"");
161 static vtmEntry
entry
167 return vtmEntry(entryType::DATA,
"", file, content);
171 static vtmEntry
entry
178 return vtmEntry(entryType::DATA,
name, file, content);
185 bool isType(entryType what)
const noexcept
187 return (type_ == what);
193 if (type_ == entryType::DATA)
208 bool good()
const noexcept;
239 bool pruneEmptyBlocks();
242 bool collapseBlocks();
252 inline bool appendTyped(
const fileName& file);
297 void setTime(scalar timeValue);
356 template<vtk::fileTag DataType = vtk::fileTag::VTK_HDF>
362 template<vtk::fileTag DataType = vtk::fileTag::VTK_HDF>
369 void repair(
bool collapse=
false);
379 const word& blockName,
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic output stream using a standard (STL) stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
A keyword and a list of tokens is an 'entry'.
A class for handling file names.
label beginBlock(const word &blockName=word::null)
Start a new block, optionally with a name.
vtmWriter()
Default construct, with autoName on.
label endBlock(const word &blockName=word::null)
End the previous block, optionally with name checking.
bool append(const fileName &file)
Add a file. The name is either empty or created with autoName.
void repair(bool collapse=false)
Sanity fixes on the data.
void dump(Ostream &os) const
Print debug view of block and dataset contents.
static word ext()
File extension (always "vtm").
bool append_vtp(const word &name, const fileName &file)
Same as append_poly - used until (2025-12).
label write_xml(const fileName &file) const
Open file for writing (creates parent directory) and write the blocks and TimeValue.
bool append(const word &name, const fileName &file, vtk::fileTag contentType)
Add a file with name, with given contentType extension.
~vtmWriter()=default
Destructor.
bool append_poly(const fileName &file)
Add a PolyData (.vtp) file.
bool empty() const
If there are no data sets.
void setTime(scalar timeValue)
Define "TimeValue" for FieldData (name as per Catalyst output).
bool append(const fileName &file, vtk::fileTag contentType)
Add a file with given contentType extension The name is either empty or created with autoName.
bool append_ugrid(const fileName &file)
Add an UnstructuredGrid (.vtu) file.
bool append_vtu(const word &name, const fileName &file)
Same as append_ugrid - used until (2025-12).
label write(const fileName &file) const
Forwards to write_xml().
void add(const word &blockName, const fileName &prefix, const vtmWriter &other)
Add in content from another vtm and place under the given block name. Adjust the added 'file' entries...
label size() const
The number of data sets.
label write_xml(OSstream &os) const
Write the blocks and TimeValue (xml format).
void add(const word &blockName, const vtmWriter &other)
Add in content from another vtm and place under the given block name.
void clear()
Clear all entries and reset output.
bool append_hdf(const fileName &file)
Add a (.vtkhdf) file. Often need to specify the content type as well (PolyData, UnstructuredGrid).
bool append_vtp(const fileName &file)
Same as append_poly - used until (2025-12).
bool append_vtu(const fileName &file)
Same as append_ugrid - used until (2025-12).
label write_xml(std::ostream &os) const
Write the blocks and TimeValue (xml format).
vtmWriter(bool autoName)
Construct with specified behaviour for autoName.
bool append(const word &name, const fileName &file)
Add a file with name.
void setTime(const Time &t)
Define "TimeValue" for FieldData (name as per Catalyst output).
A class for handling words, derived from Foam::string.
static const word null
An empty word.
OBJstream os(runTime.globalPath()/outputName)
Namespace for handling VTK output. Contains classes and functions for writing VTK file content.
fileTag
Some common XML tags for vtk files.
bool isType(const U &obj)
Check if typeid of the object and Type are identical.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
word format(conversionProperties.get< word >("format"))