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) 2018 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 InNamespace
27  Foam
28 
29 Description
30  Read fields from disk for foamToEnsight
31 
32 SourceFiles
33  readFields.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef readFields_H
38 #define readFields_H
39 
40 #include "instantList.H"
41 #include "IOobjectList.H"
42 #include "fvMeshSubsetProxy.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 //- Get the field and subset it, or return nullptr
50 template<class GeoField>
52 {
53  if (io)
54  {
55  auto tfield = tmp<GeoField>::New(*io, proxy.baseMesh());
56  return proxy.interpolate(tfield);
57  }
58 
59  return nullptr;
60 }
61 
62 
63 //- Get internal field and make it a zero-gradient volume field with subsetting
64 template<class GeoField>
65 tmp<GeoField>
67 {
68  if (io)
69  {
70  auto tfield =
72  return proxy.interpolateInternal(tfield);
73  }
74 
75  return nullptr;
76 }
77 
78 
79 //- Check if fields are good to use (available at all times)
80 // ignore special fields (_0 fields),
81 // ignore fields that are not available for all time-steps
83 (
84  const fvMesh& mesh,
85  const instantList& timeDirs,
86  wordList& objectNames
87 );
88 
89 
90 } // End namespace Foam
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 #endif
95 
96 // ************************************************************************* //
instantList.H
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::getField
tmp< GeoField > getField(const IOobject *io, const fvMeshSubsetProxy &proxy)
Get the field and subset it, or return nullptr.
Definition: readFields.H:51
Foam::fvMeshSubsetProxy::baseMesh
const fvMesh & baseMesh() const
The entire base mesh.
Definition: fvMeshSubsetProxy.H:145
IOobjectList.H
Foam::instantList
List< instant > instantList
List of instants.
Definition: instantList.H:44
Foam::fvMeshSubsetProxy::interpolateInternal
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolateInternal(const fvMeshSubset &subsetter, const DimensionedField< Type, volMesh > &df)
Convert an internal field to a volume field (with zeroGradient)
Foam::fvMeshSubsetProxy::interpolate
static tmp< GeoField > interpolate(const fvMeshSubset &subsetter, const GeoField &fld)
Wrapper for field or the subsetted field.
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
Foam::getZeroGradField
tmp< GeoField > getZeroGradField(const IOobject *io, const fvMeshSubsetProxy &proxy)
Get internal field and make it a zero-gradient volume field with subsetting.
Definition: readFields.H:66
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::checkData
label checkData(const fvMesh &mesh, const instantList &timeDirs, wordList &objectNames)
Check if fields are good to use (available at all times)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fvMeshSubsetProxy.H
Foam::fvMeshSubsetProxy
Simple proxy for holding a mesh, or mesh-subset. The subMeshes are currently limited to cellSet or ce...
Definition: fvMeshSubsetProxy.H:58
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.