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 | Copyright (C) 2013-2014 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::writeDictionary
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  This function object writes dictionaries on start-up, and on change
32 
33 SourceFiles
34  writeDictionary.C
35  IOwriteDictionary.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef writeDictionary_H
40 #define writeDictionary_H
41 
42 #include "wordList.H"
43 #include "runTimeSelectionTables.H"
44 #include "SHA1Digest.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 class objectRegistry;
53 class dictionary;
54 class polyMesh;
55 class mapPolyMesh;
56 
57 /*---------------------------------------------------------------------------*\
58  Class writeDictionary Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class writeDictionary
62 {
63 protected:
64 
65  // Private data
66 
67  //- Name of this set of writeDictionary
68  word name_;
69 
70  //- Reference to the database
71  const objectRegistry& obr_;
72 
73  //- Names of dictionaries to monitor
75 
76  //- List of changed dictionaries (only those registered to database)
78 
79 
80  // Private Member Functions
81 
82  //- Helper function to write the dictionary if found at location
83  bool tryDirectory
84  (
85  const label dictI,
86  const word& location,
87  bool& firstDict
88  );
89 
90  //- Disallow default bitwise copy construct
92 
93  //- Disallow default bitwise assignment
94  void operator=(const writeDictionary&);
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("writeDictionary");
101 
102 
103  // Constructors
104 
105  //- Construct for given objectRegistry and dictionary.
106  // Allow the possibility to load fields from files
108  (
109  const word& name,
110  const objectRegistry&,
111  const dictionary&,
112  const bool loadFromFiles = false
113  );
114 
115 
116  //- Destructor
117  virtual ~writeDictionary();
118 
119 
120  // Member Functions
121 
122  //- Return name of the writeDictionary
123  virtual const word& name() const
124  {
125  return name_;
126  }
127 
128  //- Read the writeDictionary data
129  virtual void read(const dictionary&);
130 
131  //- Execute, currently does nothing
132  virtual void execute();
133 
134  //- Execute at the final time-loop, currently does nothing
135  virtual void end();
136 
137  //- Called when time was set at the end of the Time::operator++
138  virtual void timeSet();
139 
140  //- Write the writeDictionary
141  virtual void write();
142 
143  //- Update for changes of mesh
144  virtual void updateMesh(const mapPolyMesh&)
145  {}
146 
147  //- Update for changes of mesh
148  virtual void movePoints(const polyMesh&)
149  {}
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::writeDictionary::read
virtual void read(const dictionary &)
Read the writeDictionary data.
Definition: writeDictionary.C:116
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::writeDictionary
This function object writes dictionaries on start-up, and on change.
Definition: writeDictionary.H:60
Foam::writeDictionary::digests_
List< SHA1Digest > digests_
List of changed dictionaries (only those registered to database)
Definition: writeDictionary.H:76
Foam::writeDictionary::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: writeDictionary.H:147
Foam::writeDictionary::writeDictionary
writeDictionary(const writeDictionary &)
Disallow default bitwise copy construct.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
wordList.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
SHA1Digest.H
Foam::writeDictionary::TypeName
TypeName("writeDictionary")
Runtime type information.
Foam::label
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
Foam::writeDictionary::operator=
void operator=(const writeDictionary &)
Disallow default bitwise assignment.
Foam::writeDictionary::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: writeDictionary.C:196
Foam::writeDictionary::obr_
const objectRegistry & obr_
Reference to the database.
Definition: writeDictionary.H:70
Foam::writeDictionary::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: writeDictionary.C:202
Foam::writeDictionary::execute
virtual void execute()
Execute, currently does nothing.
Definition: writeDictionary.C:140
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::writeDictionary::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: writeDictionary.H:143
Foam::writeDictionary::name_
word name_
Name of this set of writeDictionary.
Definition: writeDictionary.H:67
Foam::writeDictionary::dictNames_
wordList dictNames_
Names of dictionaries to monitor.
Definition: writeDictionary.H:73
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::writeDictionary::write
virtual void write()
Write the writeDictionary.
Definition: writeDictionary.C:208
Foam::writeDictionary::tryDirectory
bool tryDirectory(const label dictI, const word &location, bool &firstDict)
Helper function to write the dictionary if found at location.
Definition: writeDictionary.C:42
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::writeDictionary::~writeDictionary
virtual ~writeDictionary()
Destructor.
Definition: writeDictionary.C:110
Foam::writeDictionary::name
virtual const word & name() const
Return name of the writeDictionary.
Definition: writeDictionary.H:122
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158