logFiles.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 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::functionObjects::logFiles
26 
27 Description
28  functionObject base class for creating, maintaining and writing log
29  files e.g. integrated of averaged field data vs time.
30 
31 See also
32  Foam::functionObject
33  Foam::functionObjects::writeFile
34 
35 SourceFiles
36  logFiles.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef functionObjects_logFiles_H
41 #define functionObjects_logFiles_H
42 
43 #include "writeFile.H"
44 #include "OFstream.H"
45 #include "PtrList.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace functionObjects
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class logFiles Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class logFiles
59 :
60  public writeFile
61 {
62 
63 protected:
64 
65  // Protected data
66 
67  //- File names
69 
70  //- File pointer
72 
73 
74  // Protected Member Functions
75 
76  //- Create the output file
77  virtual void createFiles();
78 
79  //- Reset the list of names from a wordList
80  virtual void resetNames(const wordList& names);
81 
82  //- Reset the list of names to a single name entry
83  virtual void resetName(const word& name);
84 
85  //- File header information
86  virtual void writeFileHeader(const label i = 0) = 0;
87 
88 
89 private:
90 
91  // Private Member Functions
92 
93  //- Disallow default bitwise copy construct
94  logFiles(const logFiles&);
95 
96  //- Disallow default bitwise assignment
97  void operator=(const logFiles&);
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct from objectRegistry and prefix
105  logFiles
106  (
107  const objectRegistry& obr,
108  const word& prefix
109  );
110 
111 
112  //- Destructor
113  virtual ~logFiles();
114 
115 
116  // Member Functions
117 
118  //- Return const access to the names
119  const wordList& names() const;
120 
121  //- Return access to the files
123 
124  //- Return access to the file (if only 1)
125  OFstream& file();
126 
127  //- Return file 'i'
128  OFstream& file(const label i);
129 
130  //- Write function
131  virtual bool write();
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace functionObjects
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
virtual bool write()
Write function.
Definition: logFiles.C:180
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual void createFiles()
Create the output file.
Definition: logFiles.C:32
wordList names_
File names.
Definition: logFiles.H:67
Output to file stream.
Definition: OFstream.H:82
virtual void writeFileHeader(const label i=0)=0
File header information.
PtrList< OFstream > & files()
Return access to the files.
Definition: logFiles.C:147
A class for handling words, derived from string.
Definition: word.H:59
virtual void resetName(const word &name)
Reset the list of names to a single name entry.
Definition: logFiles.C:79
const wordList & names() const
Return const access to the names.
Definition: logFiles.C:114
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:63
OFstream & file()
Return access to the file (if only 1)
Definition: logFiles.C:120
Registry of regIOobjects.
functionObject base class for writing single files
Definition: writeFile.H:55
PtrList< OFstream > filePtrs_
File pointer.
Definition: logFiles.H:70
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
Definition: logFiles.C:66
Namespace for OpenFOAM.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57
virtual ~logFiles()
Destructor.
Definition: logFiles.C:108