readFields.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) 2011-2022 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::readFields
26 
27 Description
28  Reads fields from the time directories and adds them to the mesh database
29  for further post-processing.
30 
31  Example of function object specification:
32  \verbatim
33  readFields1
34  {
35  type readFields;
36  libs ("libfieldFunctionObjects.so");
37  ...
38  fields
39  (
40  U
41  p
42  );
43  }
44  \endverbatim
45 
46 Usage
47  \table
48  Property | Description | Required | Default value
49  type | type name: readFields | yes |
50  fields | list of fields to read | no |
51  \endtable
52 
53 See also
54  Foam::functionObjects::fvMeshFunctionObject
55 
56 SourceFiles
57  readFields.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef functionObjects_readFields_H
62 #define functionObjects_readFields_H
63 
64 #include "fvMeshFunctionObject.H"
65 #include "volFieldsFwd.H"
66 #include "surfaceFieldsFwd.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 namespace functionObjects
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class readFields Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class readFields
80 :
81  public fvMeshFunctionObject
82 {
83 protected:
84 
85  // Protected data
86 
87  //- Fields to load
89 
90  //- Loaded fields
91  PtrList<volScalarField> vsf_;
92  PtrList<volVectorField> vvf_;
96 
102 
103 
104  // Protected Member Functions
105 
106  template<class Type>
108  (
109  const word&,
112  ) const;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("readFields");
119 
120 
121  // Constructors
122 
123  //- Construct for given objectRegistry and dictionary.
124  // Allow the possibility to load fields from files
125  readFields
126  (
127  const word& name,
128  const Time& runTime,
129  const dictionary& dict
130  );
131 
132  //- Disallow default bitwise copy construction
133  readFields(const readFields&) = delete;
134 
135 
136  //- Destructor
137  virtual ~readFields();
138 
139 
140  // Member Functions
141 
142  //- Read the set of fields from dictionary
143  virtual bool read(const dictionary&);
144 
145  //- Return the list of fields required
146  virtual wordList fields() const;
147 
148  //- Read the fields
149  virtual bool execute();
150 
151  //- Do nothing
152  virtual bool write();
153 
154 
155  // Member Operators
156 
157  //- Disallow default bitwise assignment
158  void operator=(const readFields&) = delete;
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace functionObjects
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170  #include "readFieldsTemplates.C"
171 #endif
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Generic GeometricField class.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
Definition: readFields.H:96
PtrList< surfaceSphericalTensorField > sSpheretf_
Definition: readFields.H:113
virtual wordList fields() const
Return the list of fields required.
Definition: readFields.C:77
PtrList< volScalarField > vsf_
Loaded fields.
Definition: readFields.H:105
PtrList< surfaceSymmTensorField > sSymmtf_
Definition: readFields.H:114
void operator=(const readFields &)=delete
Disallow default bitwise assignment.
TypeName("readFields")
Runtime type information.
readFields(const word &name, const Time &runTime, const dictionary &dict)
Construct for given objectRegistry and dictionary.
Definition: readFields.C:46
void loadField(const word &, PtrList< VolField< Type >> &, PtrList< SurfaceField< Type >> &) const
wordList fields_
Fields to load.
Definition: readFields.H:102
PtrList< surfaceTensorField > stf_
Definition: readFields.H:115
PtrList< volTensorField > vtf_
Definition: readFields.H:109
PtrList< surfaceScalarField > ssf_
Definition: readFields.H:111
PtrList< volSymmTensorField > vSymmtf_
Definition: readFields.H:108
PtrList< surfaceVectorField > svf_
Definition: readFields.H:112
virtual ~readFields()
Destructor.
Definition: readFields.C:61
PtrList< volVectorField > vvf_
Definition: readFields.H:106
virtual bool execute()
Read the fields.
Definition: readFields.C:83
PtrList< volSphericalTensorField > vSpheretf_
Definition: readFields.H:107
virtual bool write()
Do nothing.
Definition: readFields.C:114
virtual bool read(const dictionary &)
Read the set of fields from dictionary.
Definition: readFields.C:67
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
Definition: ReadFields.C:244
dictionary dict