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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Global
28  Foam::ReadFields
29 
30 Description
31  Field reading functions for post-processing utilities
32 
33 SourceFiles
34  ReadFields.C
35  ReadFieldsTemplates.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_ReadFields_H
40 #define Foam_ReadFields_H
41 
42 #include "PtrList.H"
43 #include "wordList.H"
44 #include "DynamicList.H"
45 #include "GeometricField.H"
46 #include "HashSet.H"
47 #include "LIFOStack.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class regIOobject;
55 class IOobjectList;
56 class objectRegistry;
57 
58 //- Read Geometric fields of templated type.
59 // \return sorted names of fields read.
60 // \note All processors guaranteed to read fields in same order.
61 template<class Type, template<class> class PatchField, class GeoMesh>
63 (
64  const typename GeoMesh::Mesh& mesh,
65  const IOobjectList& objects,
66  PtrList<GeometricField<Type, PatchField, GeoMesh>>& fields,
67  const bool syncPar = true,
68  const bool readOldTime = false
69 );
70 
71 
72 //- Read fields of the templated type.
73 // \return sorted names of fields read.
74 // \note All processors guaranteed to read fields in same order.
75 template<class GeoField, class Mesh>
77 (
78  const Mesh& mesh,
79  const IOobjectList& objects,
80  PtrList<GeoField>& fields,
81  const bool syncPar = true
82 );
83 
84 //- Read non-mesh fields (uniformDimensionedField like 'g').
85 // \return sorted names of fields read.
86 // \note All processors guaranteed to read fields in same order.
87 template<class GeoField>
89 (
90  const IOobjectList& objects,
91  PtrList<GeoField>& fields,
92  const bool syncPar = true
93 );
94 
95 //- Read all GeometricFields of the templated type.
96 // \param fieldsCache is an objectRegistry of all stored fields
97 template<class GeoField>
98 static void ReadFields
99 (
100  const word& fieldName,
101  const typename GeoField::Mesh& mesh,
102  const wordList& timeNames,
103  objectRegistry& fieldsCache
104 );
105 
106 //- Read all GeometricFields of the templated type.
107 // \param fieldsCache is the objectRegistry name where fields are stored
108 template<class GeoField>
109 static void ReadFields
110 (
111  const word& fieldName,
112  const typename GeoField::Mesh& mesh,
113  const wordList& timeNames,
114  const word& registryName = "fieldsCache"
115 );
116 
117 
118 //- Read the selected GeometricFields of the templated type
119 //- and store on the objectRegistry.
120 // Returns a list of field pointers for later cleanup
121 template<class GeoFieldType, class NameMatchPredicate>
122 void readFields
123 (
124  const typename GeoFieldType::Mesh& mesh,
125  const IOobjectList& objects,
127  const NameMatchPredicate& selectedFields,
129  DynamicList<regIOobject*>& storedObjects
130 );
131 
132 //- Read the selected UniformDimensionedFields of the templated type
133 //- and store on the objectRegistry.
134 // Returns a list of field pointers for later cleanup
135 template<class UniformFieldType, class NameMatchPredicate>
137 (
138  const IOobjectList& objects,
140  const NameMatchPredicate& selectedFields,
142  DynamicList<regIOobject*>& storedObjects,
143  const bool syncPar = true
144 );
145 
146 
147 // Housekeeping
148 
149 //- Read the selected GeometricFields of the templated type
150 //- and store on the objectRegistry.
151 // \deprecated(2023-07) - prefer the DynamicList version
152 // Returns a stack of field pointers for later cleanup
153 template<class GeoFieldType, class NameMatchPredicate>
154 FOAM_DEPRECATED_FOR(2023-07, "DynamicList version")
155 void readFields
156 (
157  const typename GeoFieldType::Mesh& mesh,
158  const IOobjectList& objects,
159  const NameMatchPredicate& selectedFields,
160  LIFOStack<regIOobject*>& storedObjects
161 );
162 
163 
164 //- Read the selected UniformDimensionedFields of the templated type
165 //- and store on the objectRegistry.
166 // \deprecated(2023-07) - prefer the DynamicList version
167 // Returns a stack of field pointers for later cleanup
168 template<class UniformFieldType, class NameMatchPredicate>
169 FOAM_DEPRECATED_FOR(2023-07, "DynamicList version")
171 (
172  const IOobjectList& objects,
173  const NameMatchPredicate& selectedFields,
174  LIFOStack<regIOobject*>& storedObjects,
175  const bool syncPar = true
176 );
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #ifdef NoRepository
186  #include "ReadFieldsTemplates.C"
187 #endif
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
dynamicFvMesh & mesh
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
void readUniformFields(const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects, const bool syncPar=true)
Read the selected UniformDimensionedFields of the templated type and store on the objectRegistry...
MESH Mesh
Definition: GeoMesh.H:58
List< word > wordList
List of word.
Definition: fileName.H:59
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
Namespace for OpenFOAM.