36#ifndef Foam_ensightFile_H
37#define Foam_ensightFile_H
61 static bool allowUndef_;
64 static float undefValue_;
68 int64_t origFileSize_;
124 ensightFile(
const ensightFile&) =
delete;
127 void operator=(
const ensightFile&) =
delete;
221 void writeInt(const int32_t val, const
int fieldWidth);
224 void writeInt(const int64_t val, const
int fieldWidth);
227 void writeFloat(const
float val, const
int fieldWidth);
230 void writeFloat(const
double val, const
int fieldWidth);
255 virtual Ostream&
write(
const char* buf, std::streamsize count)
override;
264 virtual Ostream&
write(
const std::string& str)
override;
305 timeStepOffsets_.clear();
312 return timeStepOffsets_.size();
319 return timeStepOffsets_;
330 void beginPart(
const label index,
const std::string& description);
345 void writeLabels(
const IndirectListBase<label, Addr>& list);
382 static bool hasUndef(
const IndirectListBase<float, Addr>&
field);
386 static bool hasUndef(
const IndirectListBase<double, Addr>&
field);
397 #include "ensightFile.txx"
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary | coherent).
appendType
File appending (NO_APPEND | APPEND_APP | APPEND_ATE).
@ NO_APPEND
no append (truncates existing)
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
virtual const fileName & name() const override
Read/write access to the name of the stream.
OFstream(std::nullptr_t)
Construct a null output file stream that behaves like /dev/null.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream(const Ostream &)=default
Copy construct.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
static bool hasUndef(const IndirectListBase< float, Addr > &field)
Check for any NaN in the field.
static const ensightFile & null() noexcept
Return a null ensightFile.
static bool hasUndef(const IndirectListBase< double, Addr > &field)
Check for any NaN in the field.
void writeUndef()
Write undef value.
void clearTimeSteps() noexcept
Transient single-file: forget time-step file positions (advanced use).
void writeString(const char *str, size_t len)
Write character/string content as "%79s" or as binary (max 80 chars).
virtual Ostream & write(const char) override
Writing single character does not make sense.
int64_t writeTimeStepFooter()
Transient single-file: write the time-step file-offsets as footer information.
int64_t beginTimeStep()
Write "BEGIN TIME STEP" string and newline (for transient single-file format).
void writeList(const IndirectListBase< float, Addr > &field)
Write an indirect list of float as "%12.5e" or as binary.
static bool allowUndef() noexcept
Return setting for whether 'undef' values are allowed in results.
void writeLabels(const IndirectListBase< label, Addr > &list)
Write a list of integers.
static const char *const coordinates
The keyword "coordinates".
void operator=(const ensightFile &)=delete
No copy assignment.
virtual bool write(const token &) override
Writing token does not make sense.
void writeBinaryHeader()
Write "C Binary" string for binary files (eg, geometry/measured).
void beginCoordinates(const label nparticles)
Begin a "coordinates" block. Only used for geometry files.
void beginPart(const label index)
Begin a part (0-based index internally).
int64_t endTimeStep()
Write "END TIME STEP" string and newline (for transient single-file format).
void writeList(const UList< label > &field)
Write a list of integers as float values.
void writeLabels(const UList< label > &list)
Write a list of integers.
static float undefValue(float value) noexcept
Assign the value to represent undef in the results.
label nTimes() const noexcept
Transient single-file: the current number of time steps.
ensightFile(const fileName &path, const fileName &name, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct from path and name.
const UList< int64_t > & timeStepOffets() const noexcept
Transient single-file: the current file-offsets for time steps within the file.
void writeList(const IndirectListBase< double, Addr > &field)
Write an indirect list of double as "%12.5e" or as binary. (double is narrowed to float).
void beginParticleCoordinates(const label nparticles)
Begin a "particle coordinates" block (measured data).
virtual Ostream & writeKeyword(const keyType &key) override
Write element keyword with trailing newline, optionally with undef and the value for undefined.
static bool hasUndef(const UList< float > &field)
Check for any NaN in the field.
void writeFloat(const float val, const int fieldWidth)
Write floating-point with specified width or as binary.
void newline()
Add carriage return to ascii stream.
ensightFile(const ensightFile &)=delete
No copy construct.
void writeInt(const int32_t val, const int fieldWidth)
Write integer value with specified width or as binary.
float floatType
Ensight uses float not \d double for floating-point.
ensightFile(const fileName &pathname, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct from path-name.
~ensightFile()
Destructor. Commits the time-step footer information (if any).
A class for handling file names.
A class for handling keywords in dictionaries.
A token holds an item read from Istream.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.