writeDictionary.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::writeDictionary
26 
27 Description
28  Writes dictionaries on start-up and on change.
29 
30 SourceFiles
31  writeDictionary.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef functionObjects_writeDictionary_H
36 #define functionObjects_writeDictionary_H
37 
38 #include "functionObject.H"
39 #include "wordList.H"
40 #include "SHA1Digest.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class objectRegistry;
49 
50 namespace functionObjects
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class writeDictionary Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class writeDictionary
58 :
59  public functionObject
60 {
61  // Private data
62 
63  //- Reference to the database
64  const objectRegistry& obr_;
65 
66  //- Names of dictionaries to monitor
67  wordList dictNames_;
68 
69  //- List of changed dictionaries (only those registered to database)
70  List<SHA1Digest> digests_;
71 
72 
73  // Private Member Functions
74 
75  //- Helper function to write the dictionary if found at location
76  bool tryDirectory
77  (
78  const label dictI,
79  const word& location,
80  bool& firstDict
81  );
82 
83 
84 private:
85 
86  // Private member functions
87 
88  //- Disallow default bitwise copy construct
90 
91  //- Disallow default bitwise assignment
92  void operator=(const writeDictionary&);
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("writeDictionary");
99 
100 
101  // Constructors
102 
103  //- Construct from Time and dictionary
105  (
106  const word& name,
107  const Time& runTime,
108  const dictionary& dict
109  );
110 
111 
112  //- Destructor
113  virtual ~writeDictionary();
114 
115 
116  // Member Functions
117 
118  //- Read the writeDictionary data
119  virtual bool read(const dictionary&);
120 
121  //- Execute, currently does nothing
122  virtual bool execute();
123 
124  //- Write the selected dictionaries
125  virtual bool write();
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace functionObjects
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual bool read(const dictionary &)
Read the writeDictionary data.
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
engineTime & runTime
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
A class for handling words, derived from string.
Definition: word.H:59
TypeName("writeDictionary")
Runtime type information.
virtual bool write()
Write the selected dictionaries.
virtual bool execute()
Execute, currently does nothing.
Writes dictionaries on start-up and on change.
Registry of regIOobjects.
Namespace for OpenFOAM.