Loading...
Searching...
No Matches
writeDictionary.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) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2022 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::writeDictionary
29
30Group
31 grpUtilitiesFunctionObjects
32
33Description
34 Reports dictionary contents on change.
35
36Usage
37 Minimal example by using \c system/controlDict.functions:
38 \verbatim
39 writeDictionaryFO
40 {
41 // Mandatory entries
42 type writeDictionary;
43 libs (utilityFunctionObjects);
44 dictNames <wordList>;
45
46 // Inherited entries
47 ...
48 }
49 \endverbatim
50
51 where the entries mean:
52 \table
53 Property | Description | Type | Reqd | Deflt
54 type | Type name: writeDictionary | word | yes | -
55 libs | Library name: fieldFunctionObjects | word | yes | -
56 dictNames | Names of dictionaries to monitor | wordList | yes | -
57 \endtable
58
59 The inherited entries are elaborated in:
60 - \link regionFunctionObject.H \endlink
61
62SourceFiles
63 writeDictionary.C
64
65\*---------------------------------------------------------------------------*/
66
67#ifndef Foam_functionObjects_writeDictionary_H
68#define Foam_functionObjects_writeDictionary_H
69
71#include "wordList.H"
72#include "SHA1Digest.H"
73
74// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75
76namespace Foam
77{
78namespace functionObjects
79{
80
81/*---------------------------------------------------------------------------*\
82 Class writeDictionary Declaration
83\*---------------------------------------------------------------------------*/
84
86:
87 public functionObjects::regionFunctionObject
88{
89 // Private Data
90
91 //- Names of dictionaries to monitor
92 wordList dictNames_;
93
94 //- Digest of dictionary contents
95 List<SHA1Digest> digests_;
96
97 //- First time that checking has been called (per execution cycle)
98 bool firstChange_;
99
100
101 // Private Member Functions
102
103 //- Write the output header
104 void writeHeader();
105
106 //- Helper to check and write the dictionary if its sha1 has changed
107 void checkDictionary(const dictionary& dict, const label dicti);
108
109 //- Attempt read dictionary at location
110 bool tryDirectory(const word& location, const label dicti);
111
112 //- Check all dictionaries
113 bool performCheck();
114
115 //- No copy construct
116 writeDictionary(const writeDictionary&) = delete;
117
118 //- No copy assignment
119 void operator=(const writeDictionary&) = delete;
120
121
122public:
123
124 //- Runtime type information
125 TypeName("writeDictionary");
126
127
128 // Constructors
129
130 //- Construct from name, Time and dictionary
131 writeDictionary
132 (
133 const word& name,
134 const Time& runTime,
135 const dictionary& dict
136 );
137
138
139 //- Destructor
140 virtual ~writeDictionary() = default;
141
142
143 // Member Functions
144
145 //- Read the function-object dictionary
146 virtual bool read(const dictionary&);
147
148 //- Execute the function-object operations (no-op)
149 virtual bool execute();
150
151 //- Write the function-object results
152 virtual bool write();
153};
154
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158} // End namespace functionObjects
159} // End namespace Foam
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163#endif
165// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
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.
Specialization of Foam::functionObject for a region and providing a reference to the region Foam::obj...
Reports dictionary contents on change.
virtual ~writeDictionary()=default
Destructor.
virtual bool execute()
Execute the function-object operations (no-op).
TypeName("writeDictionary")
Runtime type information.
virtual bool write()
Write the function-object results.
virtual bool read(const dictionary &)
Read the function-object dictionary.
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.
List< word > wordList
List of word.
Definition fileName.H:60
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68