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  Copyright (C) 2020-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "decomposedBlockData.H"
31 #include "OFstreamCollator.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 (
39  const fileName& pathName,
40  IOstreamOption streamOpt,
41  const bool useThread
42 )
43 :
44  OStringStream(streamOpt),
45  writer_(writer),
46  pathName_(pathName),
47  atomic_(atomic),
48  compression_(streamOpt.compression()),
49  useThread_(useThread),
50  headerEntries_()
51 {}
52 
53 
55 (
57  const fileName& pathName,
58  IOstreamOption streamOpt,
59  const bool useThread
60 )
61 :
63  (
64  writer,
65  IOstreamOption::NON_ATOMIC,
66  pathName,
67  streamOpt,
68  useThread
69  )
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
76 {
77  writer_.write
78  (
79  decomposedBlockData::typeName,
80  pathName_,
81  str(),
83  atomic_,
85  useThread_,
86  headerEntries_
87  );
88 }
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
94 {
95  headerEntries_ = dict;
96 }
97 
98 
99 // ************************************************************************* //
dictionary dict
Threaded file writer.
A class for handling file names.
Definition: fileName.H:72
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/"finiteArea-edgesCentres"))
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Master-only drop-in replacement for OFstream.
void setHeaderEntries(const dictionary &dict)
Define the header entries for the data block(s)
A simple container for options an IOstream can normally have.
atomicType
Atomic operations (output)
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Definition: StringStream.H:256
threadedCollatedOFstream(OFstreamCollator &writer, IOstreamOption::atomicType atomic, const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool useThread=true)
Construct and set stream status.