logFiles.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) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2016 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::functionObjects::logFiles
29
30Description
31 functionObject base class for creating, maintaining and writing log
32 files e.g. integrated or averaged field data vs time.
33
34See also
35 Foam::functionObject
36 Foam::functionObjects::writeFile
37
38SourceFiles
39 logFiles.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef functionObjects_logFiles_H
44#define functionObjects_logFiles_H
45
46#include "writeFile.H"
47#include "PtrList.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53namespace functionObjects
54{
55
56/*---------------------------------------------------------------------------*\
57 Class functionObjects::logFiles Declaration
58\*---------------------------------------------------------------------------*/
60class logFiles
61:
62 public writeFile
63{
64
65protected:
66
67 // Protected data
68
69 //- File names
71
72 //- File pointer
74
75
76 // Protected Member Functions
77
78 //- Create the output file
79 virtual void createFiles();
80
81 //- Reset the list of names from a wordList
82 virtual void resetNames(const wordList& names);
83
84 //- Reset the list of names to a single name entry
85 virtual void resetName(const word& name);
86
87
88private:
89
90 // Private Member Functions
91
92 //- No copy construct
93 logFiles(const logFiles&) = delete;
94
95 //- No copy assignment
96 void operator=(const logFiles&) = delete;
97
98
99public:
100
101 // Constructors
102
103 //- Construct from objectRegistry and prefix
105 (
106 const objectRegistry& obr,
107 const word& prefix
108 );
109
110
111 //- Construct from objectRegistry and prefix, and read options
112 // from dictionary
114 (
115 const objectRegistry& obr,
116 const word& prefix,
117 const dictionary& dict
118 );
119
120
121 //- Destructor
122 virtual ~logFiles() = default;
123
124
125 // Member Functions
126
127 //- Return const access to the names
128 const wordList& names() const;
129
130 //- Return access to the files
132
133 //- Return file 'i'
134 OFstream& files(const label i);
135
136 //- Write function
137 virtual bool write();
138};
139
140
141// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143} // End namespace functionObjects
144} // End namespace Foam
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148#endif
149
150// ************************************************************************* //
Output to file stream, using an OSstream.
Definition: OFstream.H:57
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
Definition: logFiles.H:62
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
Definition: logFiles.C:55
virtual void createFiles()
Create the output file.
Definition: logFiles.C:35
PtrList< OFstream > filePtrs_
File pointer.
Definition: logFiles.H:72
PtrList< OFstream > & files()
Return access to the files.
Definition: logFiles.C:116
virtual void resetName(const word &name)
Reset the list of names to a single name entry.
Definition: logFiles.C:70
wordList names_
File names.
Definition: logFiles.H:69
virtual ~logFiles()=default
Destructor.
const wordList & names() const
Return const access to the names.
Definition: logFiles.C:110
virtual bool write()
Write function.
Definition: logFiles.C:149
Base class for writing single files from the function objects.
Definition: writeFile.H:120
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
dictionary dict