collatedFileOperation.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 | Copyright (C) 2017 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fileOperations::collatedFileOperation
26 
27 Description
28  Version of masterUncollatedFileOperation that collates regIOobjects
29  into a container in the processors/ subdirectory.
30 
31  Uses threading if maxThreadFileBufferSize > 0.
32 
33 See also
34  masterUncollatedFileOperation
35 
36 SourceFiles
37  collatedFileOperation.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef fileOperations_collatedFileOperation_H
42 #define fileOperations_collatedFileOperation_H
43 
45 #include "OFstreamCollator.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace fileOperations
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class collatedFileOperation Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
61 {
62  // Private data
63 
64  //- Threaded writer
65  mutable OFstreamCollator writer_;
66 
67 
68  // Private Member Functions
69 
70  //- Append to processors/ file
71  bool appendObject
72  (
73  const regIOobject& io,
74  const fileName& pathName,
78  ) const;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("collated");
85 
86 
87  // Static data
88 
89  //- Max size of thread buffer size. This is the overall size of
90  // all files to be written. Starts blocking if not enough size.
91  // Read as float to enable easy specificiation of large sizes.
92  static float maxThreadFileBufferSize;
93 
94 
95  // Constructors
96 
97  //- Construct null
98  collatedFileOperation(const bool verbose);
99 
100 
101  //- Destructor
102  virtual ~collatedFileOperation();
103 
104 
105  // Member Functions
106 
107  // (reg)IOobject functionality
108 
109  //- Generate disk file name for object. Opposite of filePath.
110  virtual fileName objectPath
111  (
112  const IOobject& io,
113  const word& typeName
114  ) const;
115 
116  //- Writes a regIOobject (so header, contents and divider).
117  // Returns success state.
118  virtual bool writeObject
119  (
120  const regIOobject&,
124  const bool valid = true
125  ) const;
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace fileOperations
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
Threaded file writer.
A class for handling file names.
Definition: fileName.H:69
TypeName("collated")
Runtime type information.
collatedFileOperation(const bool verbose)
Construct null.
word format(conversionProperties.lookup("format"))
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
A class for handling words, derived from string.
Definition: word.H:59
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
static float maxThreadFileBufferSize
Max size of thread buffer size. This is the overall size of.
static const versionNumber currentVersion
Current version number.
Definition: IOstream.H:206
Version of masterUncollatedFileOperation that collates regIOobjects into a container in the processor...
Version number type.
Definition: IOstream.H:96
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.