threadedCollatedOFstream.H
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 Copyright (C) 2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::threadedCollatedOFstream
29
30Description
31 Master-only drop-in replacement for OFstream.
32
33SourceFiles
34 threadedCollatedOFstream.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef threadedCollatedOFstream_H
39#define threadedCollatedOFstream_H
40
41#include "dictionary.H"
42#include "StringStream.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50class OFstreamCollator;
51
52/*---------------------------------------------------------------------------*\
53 Class threadedCollatedOFstream Declaration
54\*---------------------------------------------------------------------------*/
57:
58 public OStringStream
59{
60 // Private Data
61
62 //- The backend writer
63 OFstreamCollator& writer_;
64
65 const fileName pathName_;
66
67 const IOstreamOption::compressionType compression_;
68
69 const bool useThread_;
70
71 //- Additional FoamFile entries for decomposed data
72 dictionary headerEntries_;
73
74
75public:
76
77 // Constructors
78
79 //- Construct and set stream status
81 (
83 const fileName& pathname,
84 IOstreamOption streamOpt = IOstreamOption(),
85 const bool useThread = true
86 );
87
88
89 //- Destructor
91
92
93 // Member Functions
94
95 //- Define the header entries for the data block(s)
96 void setHeaderEntries(const dictionary& dict);
97
98
99 // Additional constructors and methods (as per v2012 and earlier)
100 #ifdef Foam_IOstream_extras
101
102 //- Construct and set stream status
104 (
106 const fileName& pathname,
110 const bool useThread = true
111 )
112 :
114 (
115 writer,
116 pathname,
117 IOstreamOption(fmt, ver, cmp),
118 useThread
119 )
120 {}
121
122 #endif /* Foam_IOstream_extras */
123};
124
125
126// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127
128} // End namespace Foam
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132#endif
133
134// ************************************************************************* //
Input/output from string buffers.
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
Representation of a major/minor version number.
The IOstreamOption is a simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary)
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
@ UNCOMPRESSED
compression = false
static const versionNumber currentVersion
The current version number (2.0)
Threaded file writer.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Definition: StringStream.H:231
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Master-only drop-in replacement for OFstream.
void setHeaderEntries(const dictionary &dict)
Define the header entries for the data block(s)
Namespace for OpenFOAM.
dictionary dict