Go to the documentation of this file.
36 <<
"xml attribute '" <<
k <<
"' but not inside a tag!" <<
endl;
48 <<
"Cannot add " << what <<
" inside a tag!"
81 <<
"open xml tag '" << tagName <<
"', but already within a tag!"
89 os_ <<
'<' << tagName;
92 xmlTags_.append(tagName);
104 <<
"attempt to close xml tag, but not within a tag!"
125 Foam::vtk::formatter& Foam::vtk::formatter::endTag(const word& tagName)
127 const word curr(xmlTags_.remove());
133 << "adding xml endTag '" << curr
134 << "' but already in another tag!"
137 // Also suppress further output, or not?
140 // Verify expected end tag
141 if (!tagName.empty() && tagName != curr)
144 << "expecting to end xml tag '" << tagName
145 << "' but found '" << curr << "' instead"
149 os_ << "</" << curr << '>
' << nl;
157 Foam::vtk::formatter& Foam::vtk::formatter::beginVTKFile
159 const word& contentType,
160 const word& contentVersion,
164 openTag(vtk::fileTag::VTK_FILE);
165 xmlAttr("type", contentType);
166 xmlAttr("version", contentVersion);
167 xmlAttr("byte_order", vtkPTraits<Foam::endian>::typeName);
168 xmlAttr("header_type", vtkPTraits<headerType>::typeName);
171 openTag(contentType);
181 Foam::vtk::formatter& Foam::vtk::formatter::beginAppendedData()
183 openTag("AppendedData");
184 xmlAttr("encoding", encoding());
192 Foam::vtk::formatter& Foam::vtk::formatter::endAppendedData()
194 flush(); // Flush any pending encoded content
195 os_ << nl; // Ensure clear separation from content
196 return endTag("AppendedData");
200 Foam::vtk::formatter& Foam::vtk::formatter::beginBlock
206 openTag(vtk::fileTag::BLOCK);
209 xmlAttr("index", index);
213 xmlAttr("name", name);
221 Foam::vtk::formatter& Foam::vtk::formatter::beginPiece
227 openTag(vtk::fileTag::PIECE);
230 xmlAttr("index", index);
234 xmlAttr("name", name);
242 Foam::vtk::formatter& Foam::vtk::formatter::DataSet
249 openTag(vtk::fileTag::DATA_SET);
253 xmlAttr("index", index);
259 xmlAttr("name", fileName::nameLessExt(file));
261 xmlAttr("file", file);
263 closeTag(true); // Empty tag. ie, <DataSet ... />
269 Foam::vtk::formatter& Foam::vtk::formatter::DataSet
276 openTag(vtk::fileTag::DATA_SET);
280 xmlAttr("index", index);
284 xmlAttr("name", name);
288 xmlAttr("file", file);
290 closeTag(true); // Empty tag. ie, <DataSet ... />
296 Foam::vtk::formatter& Foam::vtk::formatter::writeTimeValue(scalar timeValue)
298 // Emit "TimeValue" as FieldData
299 // NumberOfTuples="1" (required!)
301 uint64_t payLoad = vtk::sizeofData<float>(1);
303 beginDataArray<float,1,1>("TimeValue");
315 // ************************************************************************* //
A class for handling words, derived from Foam::string.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
label k
Boltzmann constant.
#define WarningInFunction
Report a warning using Foam::Warning.