34#ifndef Foam_OScountStream_H
35#define Foam_OScountStream_H
53 virtual public std::ios,
57 class countbuf :
public std::streambuf
60 std::streamsize size_;
65 virtual std::streampos seekoff
68 std::ios_base::seekdir way,
69 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
72 if (which & std::ios_base::out)
74 if (way == std::ios_base::beg)
78 else if (way == std::ios_base::cur)
82 else if (way == std::ios_base::end)
95 virtual std::streampos seekpos
98 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
101 return seekoff(
pos, std::ios_base::beg, which);
105 virtual int overflow(int_type c = traits_type::eof())
107 if (c != traits_type::eof()) ++size_;
112 virtual std::streamsize xsputn(
const char*
s, std::streamsize
n)
123 countbuf() : size_(0) {}
129 std::streamsize
count()
const noexcept {
return size_; }
132 void reset(std::streamsize
n = 0)
noexcept { size_ =
n; }
138 typedef countbuf buffer_type;
139 typedef std::ostream stream_type;
155 countbuf*
rdbuf() {
return &buf_; }
158 std::streamsize
count()
const noexcept {
return buf_.count(); }
161 void reset(std::streamsize
n = 0)
noexcept
164 stream_type::clear();
170 os <<
"count=" << buf_.count();
237 os <<
"ocountstream: ";
A wrapper to hold a std::stream type for OpenFOAM wrapped streams. This is necessary since the OpenFO...
Foam::ocountstream stream_
A simple container for options an IOstream can normally have.
versionNumber version() const noexcept
Get the stream version.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
streamFormat format() const noexcept
Get the current stream format.
An output stream for calculating byte counts.
OCountStream(IOstreamOption streamOpt=IOstreamOption())
Default construct.
std::streamsize size() const noexcept
The number of bytes counted.
OCountStream(const OCountStream &str)
Copy construct.
void reset(std::streamsize n=0) noexcept
Reset the count.
virtual void print(Ostream &os) const override
Print stream description.
virtual void rewind()
Rewind the stream, reset the count, clearing any old errors.
std::streamsize count() const noexcept
The number of bytes counted.
Generic output stream using a standard (STL) stream.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name).
OSstream(const OSstream &)=default
Copy construct.
void syncState()
Set stream state to match that of the std::ostream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void print(Ostream &os) const
Information about stream.
void debug_info(Ostream &os) const
Some information about the output buffer position/capacity.
ocountstream()
Default construct.
countbuf * rdbuf()
This hides both signatures of std::basic_ios::rdbuf().
void reset(std::streamsize n=0) noexcept
Reset the count.
std::streamsize count() const noexcept
The number of bytes counted.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar pos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
word format(conversionProperties.get< word >("format"))