threadedCollatedOFstream.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "decomposedBlockData.H"
30 #include "OFstreamCollator.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
35 (
37  const fileName& pathName,
40  compressionType compression,
41  const bool useThread
42 )
43 :
45  writer_(writer),
46  pathName_(pathName),
47  compression_(compression),
48  useThread_(useThread)
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
53 
55 {
56  writer_.write
57  (
58  decomposedBlockData::typeName,
59  pathName_,
60  str(),
62  version(),
63  compression_,
64  false, // append
65  useThread_
66  );
67 }
68 
69 
70 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::OFstreamCollator::write
bool write(const word &typeName, const fileName &, const string &data, IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool append, const bool useThread=true)
Write file with contents. Blocks until writethread has space.
Definition: OFstreamCollator.C:357
Foam::threadedCollatedOFstream::~threadedCollatedOFstream
~threadedCollatedOFstream()
Destructor.
Definition: threadedCollatedOFstream.C:54
format
word format(conversionProperties.get< word >("format"))
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:79
Foam::IOstreamOption::version
versionNumber version() const noexcept
Get the stream version.
Definition: IOstreamOption.H:321
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:64
threadedCollatedOFstream.H
Foam::writer
Base class for graphics format writing. Entry points are.
Definition: writer.H:80
Foam::foamVersion::version
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
Foam::OFstreamCollator
Threaded file writer.
Definition: OFstreamCollator.H:71
Foam::Detail::StringStreamAllocator< std::ostringstream >::str
Foam::string str() const
Get the string - as Foam::string rather than std::string.
Definition: StringStream.H:92
Foam::IOstreamOption::BINARY
"binary"
Definition: IOstreamOption.H:67
decomposedBlockData.H
Foam::OStringStream
Output to string buffer, using a OSstream.
Definition: StringStream.H:189
Foam::threadedCollatedOFstream::threadedCollatedOFstream
threadedCollatedOFstream(OFstreamCollator &, const fileName &pathname, streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED, const bool useThread=true)
Construct and set stream status.
Definition: threadedCollatedOFstream.C:35
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:71
OFstreamCollator.H