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-2018 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 ReadFields_H
40 #define ReadFields_H
41 
42 #include "PtrList.H"
43 #include "wordList.H"
44 #include "GeometricField.H"
45 #include "HashSet.H"
46 #include "LIFOStack.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class regIOobject;
54 class IOobjectList;
55 class objectRegistry;
56 
57 //- Read Geometric fields of templated type.
58 // \return sorted names of fields read.
59 // \note All processors guaranteed to read fields in same order.
60 template<class Type, template<class> class PatchField, class GeoMesh>
62 (
63  const typename GeoMesh::Mesh& mesh,
64  const IOobjectList& objects,
65  PtrList<GeometricField<Type, PatchField, GeoMesh>>& fields,
66  const bool syncPar = true,
67  const bool readOldTime = false
68 );
69 
70 
71 //- Read fields of the templated type.
72 // \return sorted names of fields read.
73 // \note All processors guaranteed to read fields in same order.
74 template<class GeoField, class Mesh>
76 (
77  const Mesh& mesh,
78  const IOobjectList& objects,
79  PtrList<GeoField>& fields,
80  const bool syncPar = true
81 );
82 
83 //- Read non-mesh fields (uniformDimensionedField like 'g').
84 // \return sorted names of fields read.
85 // \note All processors guaranteed to read fields in same order.
86 template<class GeoField>
88 (
89  const IOobjectList& objects,
90  PtrList<GeoField>& fields,
91  const bool syncPar = true
92 );
93 
94 //- Read all GeometricFields of the templated type.
95 // \param fieldsCache is an objectRegistry of all stored fields
96 template<class GeoField>
97 static void ReadFields
98 (
99  const word& fieldName,
100  const typename GeoField::Mesh& mesh,
101  const wordList& timeNames,
102  objectRegistry& fieldsCache
103 );
104 
105 //- Read all GeometricFields of the templated type.
106 // \param fieldsCache is the objectRegistry name where fields are stored
107 template<class GeoField>
108 static void ReadFields
109 (
110  const word& fieldName,
111  const typename GeoField::Mesh& mesh,
112  const wordList& timeNames,
113  const word& registryName = "fieldsCache"
114 );
115 
116 //- Read the selected GeometricFields of the templated type.
117 // The fields are transferred to the objectRegistry and a list of them is
118 // returned as a stack for later cleanup
119 template<class GeoFieldType>
120 void readFields
121 (
122  const typename GeoFieldType::Mesh& mesh,
123  const IOobjectList& objects,
124  const wordHashSet& selectedFields,
125  LIFOStack<regIOobject*>& storedObjects
126 );
127 
128 
129 //- Read the selected UniformDimensionedFields of the templated type.
130 // The fields are transferred to the objectRegistry and a list of them is
131 // returned as a stack for later cleanup
132 template<class GeoFieldType>
134 (
135  const IOobjectList& objects,
136  const wordHashSet& selectedFields,
137  LIFOStack<regIOobject*>& storedObjects,
138  const bool syncPar = true
139 );
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #ifdef NoRepository
149  #include "ReadFieldsTemplates.C"
150 #endif
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Foam::ReadFields
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.
ReadFieldsTemplates.C
Foam::readUniformFields
void readUniformFields(const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects, const bool syncPar=true)
Read the selected UniformDimensionedFields of the templated type.
Definition: ReadFieldsTemplates.C:366
wordList.H
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
HashSet.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
GeometricField.H
Foam::wordHashSet
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
Definition: HashSet.H:77
PtrList.H
Foam::GeoMesh::Mesh
MESH Mesh
Definition: GeoMesh.H:62
LIFOStack.H
fields
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97