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)
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) {}
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(); }
170 os <<
"count=" << buf_.count();
Generic output stream using a standard (STL) stream.
A wrapper to hold a std::stream type for OpenFOAM wrapped streams. This is necessary since the OpenFO...
An output stream for calculating byte counts.
void syncState()
Set stream state to match that of the std::ostream.
Trivial output stream for calculating byte counts.
OCountStream(IOstreamOption streamOpt=IOstreamOption())
Default construct.
void debug_info(Ostream &os) const
Some information about the output buffer position/capacity.
A simple container for options an IOstream can normally have.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
virtual void rewind()
Rewind the stream, reset the count, clearing any old errors.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
virtual void print(Ostream &os) const override
Print stream description to Ostream.
dimensionedScalar pos(const dimensionedScalar &ds)
Foam::ocountstream stream_
The std::stream.
void reset(std::streamsize n=0) noexcept
Reset the count.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
countbuf * rdbuf()
This hides both signatures of std::basic_ios::rdbuf()
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
OBJstream os(runTime.globalPath()/outputName)
std::streamsize count() const noexcept
The number of bytes counted.
void reset(std::streamsize n=0) noexcept
Reset the count.
ocountstream()
Default construct.
std::streamsize size() const noexcept
The number of bytes counted.
const dimensionedScalar c
Speed of light in a vacuum.
std::streamsize count() const noexcept
The number of bytes counted.
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))
OSstream(const OSstream &)=default
Copy construct.