Loading...
Searching...
No Matches
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-2025 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 Foam_threadedCollatedOFstream_H
39#define Foam_threadedCollatedOFstream_H
40
41#include "dictionary.H"
42#include "SpanStream.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
52/*---------------------------------------------------------------------------*\
53 Class threadedCollatedOFstream Declaration
54\*---------------------------------------------------------------------------*/
55
57:
58 public OCharStream
59{
60 // Private Data
61
62 //- The backend writer
63 OFstreamCollator& writer_;
64
65 //- The backend file name
66 const fileName pathName_;
67
68 //- Atomic file creation (ignored with append)
69 const IOstreamOption::atomicType atomic_;
70
71 //- Output file compression
72 const IOstreamOption::compressionType compression_;
73
74 //- Use threading
75 const bool useThread_;
76
77 //- Additional FoamFile entries for decomposed data
78 dictionary headerEntries_;
79
80
81 // Private Member Functions
82
83 //- Commit buffered information
84 void commit();
85
86public:
87
88 // Constructors
89
90 //- Construct and set stream status
92 (
95 const fileName& pathname,
96 IOstreamOption streamOpt = IOstreamOption(),
97 const bool useThread = true
98 );
99
100 //- Construct and set stream status
102 (
104 const fileName& pathname,
105 IOstreamOption streamOpt = IOstreamOption(),
106 const bool useThread = true
107 );
108
109
110 //- Destructor - commits buffered information to file
112
113
114 // Member Functions
115
116 // -> using OCharStream::rewind
117
118 //- Define the header entries for the data block(s)
119 void setHeaderEntries(const dictionary& dict);
120};
121
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125} // End namespace Foam
126
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129#endif
130
131// ************************************************************************* //
Input/output streams with (internal or external) character storage.
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
A simple container for options an IOstream can normally have.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression.
atomicType
Atomic operations (output).
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED).
OCharStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty output).
Threaded file writer.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
~threadedCollatedOFstream()
Destructor - commits buffered information to file.
threadedCollatedOFstream(OFstreamCollator &writer, IOstreamOption::atomicType atomic, const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool useThread=true)
Construct and set stream status.
void setHeaderEntries(const dictionary &dict)
Define the header entries for the data block(s).
Namespace for OpenFOAM.
dictionary dict