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
37 It has similar functionality as the main time database through the
38 \c writeControl setting:
39 - timeStep
40 - writeTime
41 - adjustableRunTime
42 - runTime
43 - clockTime
44 - cpuTime
45
46 It also has the ability to write the selected objects that were defined
47 with the respective write mode for the requested \c writeOption, namely:
48 \vartable
49 autoWrite | objects set to write at output time
50 noWrite | objects set to not write by default
51 anyWrite | any option of the previous two
52 \endvartable
53
54Usage
55 Example of function object specification:
56 \verbatim
57 writeObjects1
58 {
59 type writeObjects;
60 libs (utilityFunctionObjects);
61 ...
62 objects (obj1 obj2);
63 writeOption anyWrite;
64 }
65 \endverbatim
66
67 Where the entries comprise:
68 \table
69 Property | Description | Required | Default value
70 type | type name: writeObjects | yes |
71 objects | objects to write | yes |
72 writeOption | only those with this write option | no | anyWrite
73 \endtable
74
75 Note: Regular expressions can also be used in \c objects.
76
77See also
78 Foam::functionObject
79 Foam::functionObjects::timeControl
80
81SourceFiles
82 writeObjects.C
83
84\*---------------------------------------------------------------------------*/
85
86#ifndef functionObjects_writeObjects_H
87#define functionObjects_writeObjects_H
88
89#include "functionObject.H"
90#include "wordRes.H"
91#include "Enum.H"
92
93// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
95namespace Foam
96{
97
98// Forward declaration of classes
99class objectRegistry;
100
101namespace functionObjects
102{
103
104/*---------------------------------------------------------------------------*\
105 Class functionObjects::writeObjects Declaration
106\*---------------------------------------------------------------------------*/
107
108class writeObjects
109:
110 public functionObject
111{
112public:
113
114 // Public data types
115
116 //- Re-enumeration defining the write options, based on the original
117 // ones at IOobject::writeOption
118 enum writeOption
119 {
121 NO_WRITE,
123 };
124
125 static const Enum<writeOption> writeOptionNames_;
126
127private:
128
129 // Private data
130
131 //- Reference to registry
132 const objectRegistry& obr_;
133
134 //- To only write objects of defined writeOption
135 writeOption writeOption_;
136
137 //- Names of objects to control
138 wordRes objectNames_;
140
141 // Private Member Functions
142
143 //- No copy construct
144 writeObjects(const writeObjects&) = delete;
145
146 //- No copy assignment
147 void operator=(const writeObjects&) = delete;
148
150public:
152 //- Runtime type information
153 TypeName("writeObjects");
155
156 // Constructors
157
158 //- Construct from Time and dictionary
160 (
161 const word& name,
162 const Time& runTime,
163 const dictionary& dict
164 );
165
166
167 //- Destructor
168 virtual ~writeObjects() = default;
169
170
171 // Member Functions
172
173 //- Read the writeObjects data
174 virtual bool read(const dictionary&);
175
176 //- Do nothing
177 virtual bool execute();
178
179 //- Write the registered objects
180 virtual bool write();
181};
182
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace functionObjects
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
Allows specification of different writing frequency of objects registered to the database.
Definition: writeObjects.H:142
static const Enum< writeOption > writeOptionNames_
Definition: writeObjects.H:156
virtual ~writeObjects()=default
Destructor.
TypeName("writeObjects")
Runtime type information.
writeOption
Re-enumeration defining the write options, based on the original.
Definition: writeObjects.H:150
virtual bool execute()
Do nothing.
Definition: writeObjects.C:129
virtual bool write()
Write the registered objects.
Definition: writeObjects.C:135
virtual bool read(const dictionary &)
Read the writeObjects data.
Definition: writeObjects.C:100
Registry of regIOobjects.
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73