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
36SourceFiles
37 writeDictionary.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_functionObjects_writeDictionary_H
42#define Foam_functionObjects_writeDictionary_H
43
45#include "wordList.H"
46#include "SHA1Digest.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52namespace functionObjects
53{
54
55/*---------------------------------------------------------------------------*\
56 Class writeDictionary Declaration
57\*---------------------------------------------------------------------------*/
60:
62{
63 // Private Data
64
65 //- Names of dictionaries to monitor
66 wordList dictNames_;
67
68 //- Digest of dictionary contents
69 List<SHA1Digest> digests_;
70
71 //- First time that checking has been called (per execution cycle)
72 bool firstChange_;
73
74
75 // Private Member Functions
76
77 //- Write the output header
78 void writeHeader();
79
80 //- Helper to check and write the dictionary if its sha1 has changed
81 void checkDictionary(const dictionary& dict, const label dicti);
82
83 //- Attempt read dictionary at location
84 bool tryDirectory(const word& location, const label dicti);
85
86 //- Check all dictionaries
87 bool performCheck();
88
89 //- No copy construct
90 writeDictionary(const writeDictionary&) = delete;
91
92 //- No copy assignment
93 void operator=(const writeDictionary&) = delete;
94
95
96public:
97
98 //- Runtime type information
99 TypeName("writeDictionary");
100
101
102 // Constructors
103
104 //- Construct from Time and dictionary
106 (
107 const word& name,
108 const Time& runTime,
109 const dictionary& dict
110 );
111
112
113 //- Destructor
114 virtual ~writeDictionary() = default;
115
116
117 // Member Functions
118
119 //- Read the writeDictionary data
120 virtual bool read(const dictionary&);
121
122 //- Execute, currently does nothing
123 virtual bool execute();
124
125 //- Write the selected dictionaries
126 virtual bool write();
127};
128
129
130// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131
132} // End namespace functionObjects
133} // End namespace Foam
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137#endif
138
139// ************************************************************************* //
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
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, currently does nothing.
TypeName("writeDictionary")
Runtime type information.
virtual bool write()
Write the selected dictionaries.
virtual bool read(const dictionary &)
Read the writeDictionary data.
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