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 | Copyright (C) 2011-2016 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::writeObjects
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  Allows specification of different writing frequency of objects registered to
32  the database.
33 
34  It has similar functionality as the main time database through the
35  writeControl setting:
36  - timeStep
37  - writeTime
38  - adjustableRunTime
39  - runTime
40  - clockTime
41  - cpuTime
42 
43  Example of function object specification:
44  \verbatim
45  writeObjects1
46  {
47  type writeObjects;
48  libs ("libutilityFunctionObjects.so");
49  exclusiveWriting true;
50  ...
51  objects (obj1 obj2);
52  }
53  \endverbatim
54 
55 Usage
56  \table
57  Property | Description | Required | Default value
58  type | type name: writeObjects | yes |
59  objects | objects to write | yes |
60  exclusiveWriting | Takes over object writing | no | yes
61  \endtable
62 
63  \c exclusiveWriting disables automatic writing (i.e through database) of the
64  objects to avoid duplicate writing.
65 
66 See also
67  Foam::functionObject
68  Foam::functionObjects::timeControl
69 
70 SourceFiles
71  writeObjects.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef functionObjects_writeObjects_H
76 #define functionObjects_writeObjects_H
77 
78 #include "functionObject.H"
79 #include "wordReList.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 // Forward declaration of classes
87 class objectRegistry;
88 
89 namespace functionObjects
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class writeObjects Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class writeObjects
97 :
98  public functionObject
99 {
100  // Private data
101 
102  //- Refererence to Db
103  const objectRegistry& obr_;
104 
105  //- Takes over the writing from Db
106  bool exclusiveWriting_;
107 
108  //- Names of objects to control
109  wordReList objectNames_;
110 
111 
112  // Private Member Functions
113 
114  //- Disallow default bitwise copy construct
116 
117  //- Disallow default bitwise assignment
118  void operator=(const writeObjects&);
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("writeObjects");
125 
126 
127  // Constructors
128 
129  //- Construct from Time and dictionary
131  (
132  const word& name,
133  const Time& runTime,
134  const dictionary& dict
135  );
136 
137 
138  //- Destructor
139  virtual ~writeObjects();
140 
141 
142  // Member Functions
143 
144  //- Read the writeObjects data
145  virtual bool read(const dictionary&);
146 
147  //- Do nothing
148  virtual bool execute();
149 
150  //- Write the registered objects
151  virtual bool write();
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace functionObjects
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
dictionary dict
virtual bool write()
Write the registered objects.
Definition: writeObjects.C:109
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
TypeName("writeObjects")
Runtime type information.
const word & name() const
Return the name of this functionObject.
A class for handling words, derived from string.
Definition: word.H:59
Allows specification of different writing frequency of objects registered to the database.
Definition: writeObjects.H:115
List< wordRe > wordReList
A List of wordRe (word or regular expression)
Definition: wordReList.H:50
virtual bool execute()
Do nothing.
Definition: writeObjects.C:103
virtual ~writeObjects()
Destructor.
Definition: writeObjects.C:75
virtual bool read(const dictionary &)
Read the writeObjects data.
Definition: writeObjects.C:81
Namespace for OpenFOAM.