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-2015 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 Global
25  Foam::ReadFields
26 
27 Description
28  Helper routine to read fields
29 
30 SourceFiles
31  ReadFields.C
32  ReadFieldsTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef ReadFields_H
37 #define ReadFields_H
38 
39 #include "PtrList.H"
40 #include "wordList.H"
41 #include "GeometricField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class IOobjectList;
49 
50 
51 //- Get sorted names of fields of type. If syncPar and running in parallel
52 // check for identical names
53 wordList fieldNames(const IOobjectList& objects, const bool syncPar);
54 
55 //- Helper routine to read Geometric fields
56 template<class Type, template<class> class PatchField, class GeoMesh>
58 (
59  const typename GeoMesh::Mesh& mesh,
60  const IOobjectList& objects,
61  PtrList<GeometricField<Type, PatchField, GeoMesh> >& fields,
62  const bool syncPar = true,
63  const bool readOldTime = false
64 );
65 
66 //- Helper routine to read other mesh fields
67 template<class GeoField, class Mesh>
69 (
70  const Mesh& mesh,
71  const IOobjectList& objects,
72  PtrList<GeoField>& fields,
73  const bool syncPar = true
74 );
75 
76 //- Helper routine to read non-mesh fields (e.g. uniformDimensionedField like
77 // 'g')
78 template<class GeoField>
80 (
81  const IOobjectList& objects,
82  PtrList<GeoField>& fields,
83  const bool syncPar = true
84 );
85 
86 //- Helper routine to read GeometricFields. The fieldsCache is per time
87 // an objectRegistry of all stored fields
88 template<class GeoField>
89 static void ReadFields
90 (
91  const word& fieldName,
92  const typename GeoField::Mesh& mesh,
93  const wordList& timeNames,
94  objectRegistry& fieldsCache
95 );
96 
97 //- Helper routine to read GeometricFields. The fieldsCache is per time
98 // an objectRegistry of all stored fields
99 template<class GeoField>
100 static void ReadFields
101 (
102  const word& fieldName,
103  const typename GeoField::Mesh& mesh,
104  const wordList& timeNames,
105  const word& registryName = "fieldsCache"
106 );
107 
108 } // End namespace Foam
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #ifdef NoRepository
113 # include "ReadFieldsTemplates.C"
114 #endif
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
ReadFieldsTemplates.C
fields
Info<< "Creating field dpdt\n"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar("dpdt", p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\n"<< endl;volScalarField K("K", 0.5 *magSqr(U));volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);p_rgh=p - rho *gh;mesh.setFluxRequired(p_rgh.name());multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:127
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)
Helper routine to read Geometric fields.
wordList.H
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:54
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
GeometricField.H
Foam::fieldNames
wordList fieldNames(const IOobjectList &objects, const bool syncPar)
Get sorted names of fields of type. If syncPar and running in parallel.
Definition: ReadFields.C:36
PtrList.H
Foam::GeoMesh::Mesh
MESH Mesh
Definition: GeoMesh.H:61