partialWrite.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-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::partialWrite
26 
27 Group
28  grpIOFunctionObjects
29 
30 Description
31  This function object allows user-selected fields/registered objects to be
32  written at a custom write interval. The interval is given in terms of
33  number of overall dumps
34 
35  Example of function object specification:
36  \verbatim
37  partialWrite1
38  {
39  type partialWrite;
40  functionObjectLibs ("libIOFunctionObjects.so");
41  ...
42  objectNames (p U T);
43  writeInterval 100;
44  }
45  \endverbatim
46 
47  \heading Function object usage
48  \table
49  Property | Description | Required | Default value
50  type | type name: partialWrite | yes |
51  objectNames | objects to write | yes |
52  writeInterval | write interval | yes |
53  log | Log to standard output | no | yes
54  \endtable
55 
56 SeeAlso
57  Foam::functionObject
58  Foam::OutputFilterFunctionObject
59 
60 SourceFiles
61  partialWrite.C
62  IOpartialWrite.H
63 
64 \*---------------------------------------------------------------------------*/
65 
66 #ifndef partialWrite_H
67 #define partialWrite_H
68 
69 #include "HashSet.H"
70 #include "runTimeSelectionTables.H"
71 #include "volFields.H"
72 #include "surfaceFields.H"
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 
79 // Forward declaration of classes
80 class objectRegistry;
81 class dictionary;
82 class polyMesh;
83 class mapPolyMesh;
84 
85 /*---------------------------------------------------------------------------*\
86  Class partialWrite Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class partialWrite
90 {
91 protected:
92 
93  // Private data
94 
95  //- Name of this set of partialWrite object
96  word name_;
97 
98  //- Refefence to the database
99  const objectRegistry& obr_;
100 
101  //- Switch to send output to Info as well as to file
102  Switch log_;
103 
104  //- Loaded fields
105  UPtrList<volScalarField> vsf_;
106  UPtrList<volVectorField> vvf_;
107  UPtrList<volSphericalTensorField> vSpheretf_;
108  UPtrList<volSymmTensorField> vSymmtf_;
109  UPtrList<volTensorField> vtf_;
110 
111  UPtrList<surfaceScalarField> ssf_;
112  UPtrList<surfaceVectorField> svf_;
116 
117  // Read from dictionary
118 
119  //- Names of objects to dump always
121 
122  //- Write interval for restart dump
124 
125 
126 
127  //- Current dump instance. If reaches writeInterval do a full write.
129 
130 
131  // Private Member Functions
132 
133  //- Disallow default bitwise copy construct
134  partialWrite(const partialWrite&);
135 
136  //- Disallow default bitwise assignment
137  void operator=(const partialWrite&);
138 
139 
140  //- Load objects in the objectNames
141  template<class Type>
142  void loadField
143  (
144  const word&,
147  ) const;
148 
149  template<class Type>
150  void changeWriteOptions
151  (
155  ) const;
156 
157 
158 public:
159 
160  //- Runtime type information
161  TypeName("partialWrite");
162 
163 
164  // Constructors
165 
166  //- Construct for given objectRegistry and dictionary.
167  // Allow the possibility to load fields from files
169  (
170  const word& name,
171  const objectRegistry&,
172  const dictionary&,
173  const bool loadFromFiles = false
174  );
175 
176 
177  //- Destructor
178  virtual ~partialWrite();
179 
180 
181  // Member Functions
182 
183  //- Return name of the partialWrite
184  virtual const word& name() const
185  {
186  return name_;
187  }
188 
189  //- Read the partialWrite data
190  virtual void read(const dictionary&);
191 
192  //- Execute
193  virtual void execute();
194 
195  //- Execute at the final time-loop, currently does nothing
196  virtual void end();
197 
198  //- Called when time was set at the end of the Time::operator++
199  virtual void timeSet();
200 
201  //- Write the partialWrite
202  virtual void write();
203 
204  //- Update for changes of mesh
205  virtual void updateMesh(const mapPolyMesh&)
206  {}
207 
208  //- Update for changes of mesh
209  virtual void movePoints(const polyMesh&)
210  {}
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #ifdef NoRepository
221 # include "partialWriteTemplates.C"
222 #endif
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
volFields.H
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::partialWrite::vSpheretf_
UPtrList< volSphericalTensorField > vSpheretf_
Definition: partialWrite.H:131
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::partialWrite::write
virtual void write()
Write the partialWrite.
Definition: partialWrite.C:198
Foam::partialWrite::execute
virtual void execute()
Execute.
Definition: partialWrite.C:136
Foam::partialWrite::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: partialWrite.H:233
Foam::partialWrite::obr_
const objectRegistry & obr_
Refefence to the database.
Definition: partialWrite.H:123
Foam::partialWrite::stf_
UPtrList< surfaceTensorField > stf_
Definition: partialWrite.H:139
Foam::partialWrite::name
virtual const word & name() const
Return name of the partialWrite.
Definition: partialWrite.H:208
Foam::partialWrite::svf_
UPtrList< surfaceVectorField > svf_
Definition: partialWrite.H:136
surfaceFields.H
Foam::surfaceFields.
Foam::partialWrite::partialWrite
partialWrite(const partialWrite &)
Disallow default bitwise copy construct.
Foam::partialWrite::~partialWrite
virtual ~partialWrite()
Destructor.
Definition: partialWrite.C:61
Foam::HashSet
A HashTable with keys but without contents.
Definition: HashSet.H:59
Foam::partialWrite::sSpheretf_
UPtrList< surfaceSphericalTensorField > sSpheretf_
Definition: partialWrite.H:137
Foam::partialWrite::ssf_
UPtrList< surfaceScalarField > ssf_
Definition: partialWrite.H:135
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::partialWrite::loadField
void loadField(const word &, UPtrList< GeometricField< Type, fvPatchField, volMesh > > &, UPtrList< GeometricField< Type, fvsPatchField, surfaceMesh > > &) const
Load objects in the objectNames.
Definition: partialWriteTemplates.C:35
Foam::partialWrite::operator=
void operator=(const partialWrite &)
Disallow default bitwise assignment.
Foam::partialWrite::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: partialWrite.H:229
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
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::partialWrite::vsf_
UPtrList< volScalarField > vsf_
Loaded fields.
Definition: partialWrite.H:129
Foam::partialWrite
This function object allows user-selected fields/registered objects to be written at a custom write i...
Definition: partialWrite.H:113
Foam::IOobject::writeOption
writeOption
Enumeration defining the write options.
Definition: IOobject.H:115
Foam::UPtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:53
Foam::partialWrite::objectNames_
HashSet< word > objectNames_
Names of objects to dump always.
Definition: partialWrite.H:144
Foam::partialWrite::sSymmtf_
UPtrList< surfaceSymmTensorField > sSymmtf_
Definition: partialWrite.H:138
Foam::partialWrite::changeWriteOptions
void changeWriteOptions(UPtrList< GeometricField< Type, fvPatchField, volMesh > > &, UPtrList< GeometricField< Type, fvsPatchField, surfaceMesh > > &, const IOobject::writeOption) const
Definition: partialWriteTemplates.C:87
Foam::partialWrite::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: partialWrite.H:126
HashSet.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::partialWrite::writeInterval_
label writeInterval_
Write interval for restart dump.
Definition: partialWrite.H:147
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::partialWrite::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: partialWrite.C:142
Foam::partialWrite::TypeName
TypeName("partialWrite")
Runtime type information.
Foam::partialWrite::vvf_
UPtrList< volVectorField > vvf_
Definition: partialWrite.H:130
Foam::partialWrite::name_
word name_
Name of this set of partialWrite object.
Definition: partialWrite.H:120
Foam::partialWrite::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: partialWrite.C:148
Foam::partialWrite::vtf_
UPtrList< volTensorField > vtf_
Definition: partialWrite.H:133
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::partialWrite::vSymmtf_
UPtrList< volSymmTensorField > vSymmtf_
Definition: partialWrite.H:132
Foam::partialWrite::read
virtual void read(const dictionary &)
Read the partialWrite data.
Definition: partialWrite.C:67
partialWriteTemplates.C
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::partialWrite::writeInstance_
label writeInstance_
Current dump instance. If reaches writeInterval do a full write.
Definition: partialWrite.H:152