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 -------------------------------------------------------------------------------
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 Class
28  Foam::functionObjects::logFiles
29 
30 Description
31  functionObject base class for creating, maintaining and writing log
32  files e.g. integrated or averaged field data vs time.
33 
34 See also
35  Foam::functionObject
36  Foam::functionObjects::writeFile
37 
38 SourceFiles
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 
51 namespace Foam
52 {
53 namespace functionObjects
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class functionObjects::logFiles Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class logFiles
61 :
62  public writeFile
63 {
64 
65 protected:
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 
88 private:
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 
99 public:
100 
101  // Constructors
102 
103  //- Construct from objectRegistry and prefix
104  logFiles
105  (
106  const objectRegistry& obr,
107  const word& prefix
108  );
109 
110 
111  //- Construct from objectRegistry and prefix, and read options
112  // from dictionary
113  logFiles
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 // ************************************************************************* //
writeFile.H
Foam::functionObjects::logFiles::filePtrs_
PtrList< OFstream > filePtrs_
File pointer.
Definition: logFiles.H:72
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::logFiles::files
PtrList< OFstream > & files()
Return access to the files.
Definition: logFiles.C:116
Foam::functionObjects::logFiles::names_
wordList names_
File names.
Definition: logFiles.H:69
Foam::functionObjects::logFiles::resetName
virtual void resetName(const word &name)
Reset the list of names to a single name entry.
Definition: logFiles.C:70
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::functionObjects::logFiles::~logFiles
virtual ~logFiles()=default
Destructor.
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::logFiles
functionObject base class for creating, maintaining and writing log files e.g. integrated or averaged...
Definition: logFiles.H:59
Foam::functionObjects::logFiles::resetNames
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
Definition: logFiles.C:55
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Foam::List< word >
Foam::functionObjects::logFiles::names
const wordList & names() const
Return const access to the names.
Definition: logFiles.C:110
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
PtrList.H
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::functionObjects::logFiles::write
virtual bool write()
Write function.
Definition: logFiles.C:149
Foam::functionObjects::logFiles::createFiles
virtual void createFiles()
Create the output file.
Definition: logFiles.C:35