Loading...
Searching...
No Matches
writeObjects.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2020 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::writeObjects
29
30Group
31 grpUtilitiesFunctionObjects
32
33Description
34 Allows specification of different writing frequency of objects registered
35 to the database.
36
37Usage
38 Minimal example by using \c system/controlDict.functions:
39 \verbatim
40 writeObjectsFO
41 {
42 // Mandatory entries
43 type writeObjects;
44 libs (utilityFunctionObjects);
45
46 // Optional entries
47 writeOption <word>;
48
49 // Conditional entries
50
51 // Option-1
52 field <word>;
53
54 // Option-2
55 fields (<wordRes>);
56
57 // Option-3
58 objects (<wordRes>);
59
60 // Inherited entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Reqd | Deflt
68 type | Type name: writeObjects | word | yes | -
69 libs | Library name: utilityFunctionObjects | word | yes | -
70 writeOption | Select objects with the specified write mode | no | anyWrite
71 field | Name of field to write | word | no | -
72 fields | Names of fields to write | wordRes | no | -
73 objects | Names of objects to write | wordRes | no | -
74 \endtable
75
76 Options for the \c writeOption entry:
77 \vartable
78 autoWrite | Objects set to write at output time
79 noWrite | Objects set to not write by default
80 anyWrite | Any option of the previous two
81 log | Only report registered objects without writing objects
82 \endvartable
83
84 The inherited entries are elaborated in:
85 - \link functionObject.H \endlink
86
87SourceFiles
88 writeObjects.C
89
90\*---------------------------------------------------------------------------*/
91
92#ifndef Foam_functionObjects_writeObjects_H
93#define Foam_functionObjects_writeObjects_H
94
95#include "functionObject.H"
96#include "wordRes.H"
97#include "Enum.H"
98
99// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
101namespace Foam
102{
103
104// Forward declaration of classes
105class objectRegistry;
106
107namespace functionObjects
108{
109
110/*---------------------------------------------------------------------------*\
111 Class functionObjects::writeObjects Declaration
112\*---------------------------------------------------------------------------*/
113
114class writeObjects
115:
116 public functionObject
117{
118public:
119
120 // Public Data Types
121
122 //- Re-enumeration defining the write options,
123 //- Naming based on the IOobjectOption::writeOption
124 enum writeOption
125 {
126 NO_WRITE,
128 ANY_WRITE,
129 LOG
130 };
131
132 //- Names for writeOption
133 static const Enum<writeOption> writeOptionNames_;
134
135private:
136
137 // Private Data
138
139 //- Reference to registry
140 const objectRegistry& obr_;
141
142 //- To only write objects of defined writeOption
143 writeOption writeOption_;
144
145 //- Names of objects to control
146 wordRes objectNames_;
147
148
149 // Private Member Functions
150
151 //- No copy construct
152 writeObjects(const writeObjects&) = delete;
153
154 //- No copy assignment
155 void operator=(const writeObjects&) = delete;
156
157
158public:
159
160 //- Runtime type information
161 TypeName("writeObjects");
162
163
164 // Constructors
165
166 //- Construct from name, Time and dictionary
167 writeObjects
168 (
169 const word& name,
170 const Time& runTime,
171 const dictionary& dict
172 );
173
174
175 //- Destructor
176 virtual ~writeObjects() = default;
177
179 // Member Functions
181 //- Read the function-object dictionary
182 virtual bool read(const dictionary&);
184 //- Execute the function-object operations (no-op)
185 virtual bool execute();
186
187 //- Write the function-object results
188 virtual bool write();
190
191
192// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193
194} // End namespace functionObjects
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Allows specification of different writing frequency of objects registered to the database.
static const Enum< writeOption > writeOptionNames_
Names for writeOption.
virtual ~writeObjects()=default
Destructor.
TypeName("writeObjects")
Runtime type information.
writeOption
Re-enumeration defining the write options, Naming based on the IOobjectOption::writeOption.
virtual bool execute()
Execute the function-object operations (no-op).
virtual bool write()
Write the function-object results.
virtual bool read(const dictionary &)
Read the function-object dictionary.
Registry of regIOobjects.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68