readFields.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 | Copyright (C) 2015 OpenCFD Ltd.
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::readFields
26 
27 Group
28  grpFieldFunctionObjects
29 
30 Description
31  This function object reads fields from the time directories and adds them
32  to the mesh database for further post-processing.
33 
34  Example of function object specification:
35  \verbatim
36  readFields1
37  {
38  type readFields;
39  functionObjectLibs ("libfieldFunctionObjects.so");
40  ...
41  fields (U p);
42  }
43  \endverbatim
44 
45  \heading Function object usage
46  \table
47  Property | Description | Required | Default value
48  type | type name: readFields | yes |
49  fields | list of fields to read | no |
50  log | Log to standard output | no | yes
51  \endtable
52 
53 SeeAlso
54  Foam::functionObject
55  Foam::OutputFilterFunctionObject
56 
57 SourceFiles
58  readFields.C
59  IOreadFields.H
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef readFields_H
64 #define readFields_H
65 
66 #include "OFstream.H"
67 #include "pointFieldFwd.H"
68 #include "volFields.H"
69 #include "surfaceFields.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 // Forward declaration of classes
77 class objectRegistry;
78 class dictionary;
79 class mapPolyMesh;
80 
81 /*---------------------------------------------------------------------------*\
82  Class readFields Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class readFields
86 {
87 protected:
88 
89  // Protected data
90 
91  //- Name of this set of readFields object
92  word name_;
93 
94  const objectRegistry& obr_;
95 
96  //- on/off switch
97  bool active_;
98 
99  //- Fields to load
101 
102  //- Switch to send output to Info as well as to file
103  Switch log_;
104 
105 
106  // Protected Member Functions
107 
108  //- Disallow default bitwise copy construct
109  readFields(const readFields&);
110 
111  //- Disallow default bitwise assignment
112  void operator=(const readFields&);
113 
114  template<class Type>
115  void loadField(const word&) const;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("readFields");
122 
123 
124  // Constructors
125 
126  //- Construct for given objectRegistry and dictionary.
127  // Allow the possibility to load fields from files
128  readFields
129  (
130  const word& name,
131  const objectRegistry&,
132  const dictionary&,
133  const bool loadFromFiles = false
134  );
135 
136 
137  //- Destructor
138  virtual ~readFields();
139 
140 
141  // Member Functions
142 
143  //- Return name of the readFields object
144  virtual const word& name() const
145  {
146  return name_;
147  }
148 
149  //- Read the field min/max data
150  virtual void read(const dictionary&);
151 
152  //- Execute, currently does nothing
153  virtual void execute();
154 
155  //- Execute at the final time-loop, currently does nothing
156  virtual void end();
157 
158  //- Called when time was set at the end of the Time::operator++
159  virtual void timeSet();
160 
161  //- Write
162  virtual void write();
163 
164  //- Update for changes of mesh
165  virtual void updateMesh(const mapPolyMesh&)
166  {}
167 
168  //- Update for changes of mesh
169  virtual void movePoints(const polyMesh&)
170  {}
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #ifdef NoRepository
181 # include "readFieldsTemplates.C"
182 #endif
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
volFields.H
Foam::readFields::name
virtual const word & name() const
Return name of the readFields object.
Definition: readFields.H:163
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::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::readFields::readFields
readFields(const readFields &)
Disallow default bitwise copy construct.
surfaceFields.H
Foam::surfaceFields.
Foam::readFields
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:104
Foam::readFields::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: readFields.C:111
Foam::readFields::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: readFields.H:188
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
OFstream.H
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:54
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::readFields::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: readFields.H:122
Foam::readFields::active_
bool active_
on/off switch
Definition: readFields.H:116
Foam::readFields::name_
word name_
Name of this set of readFields object.
Definition: readFields.H:111
pointFieldFwd.H
Foam::readFields::read
virtual void read(const dictionary &)
Read the field min/max data.
Definition: readFields.C:76
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::readFields::operator=
void operator=(const readFields &)
Disallow default bitwise assignment.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::readFields::~readFields
virtual ~readFields()
Destructor.
Definition: readFields.C:70
Foam::readFields::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: readFields.H:184
Foam::readFields::write
virtual void write()
Write.
Definition: readFields.C:117
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::readFields::fieldSet_
wordList fieldSet_
Fields to load.
Definition: readFields.H:119
Foam::readFields::loadField
void loadField(const word &) const
Definition: readFieldsTemplates.C:34
Foam::readFields::execute
virtual void execute()
Execute, currently does nothing.
Definition: readFields.C:86
Foam::readFields::TypeName
TypeName("readFields")
Runtime type information.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::readFields::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: readFields.C:105
readFieldsTemplates.C
Foam::readFields
void readFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, const bool readOldTime)
Definition: readFields.C:33
Foam::readFields::obr_
const objectRegistry & obr_
Definition: readFields.H:113