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 "fvMesh.H"
43 #include "fvMeshSubsetProxy.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 //- Get the field and subset it, or return nullptr
51 template<class GeoField>
53 {
54  if (io)
55  {
56  auto tfield = tmp<GeoField>::New(*io, mesh);
57  return tfield;
58  }
59 
60  return nullptr;
61 }
62 
63 
64 //- Get internal field and make it a zero-gradient volume field with subsetting
65 template<class GeoField>
66 tmp<GeoField>
68 {
69  if (io)
70  {
71  auto tdimfield =
73 
74  auto tfield = fvMeshSubsetProxy::zeroGradientField(tdimfield());
75  tdimfield.clear();
76 
77  return tfield;
78  }
79 
80  return nullptr;
81 }
82 
83 
84 //- Check if fields are good to use (available at all times)
85 // ignore special fields (_0 fields),
86 // ignore fields that are not available for all time-steps
88 (
89  const fvMesh& mesh,
90  const instantList& timeDirs,
91  wordList& objectNames
92 );
93 
94 
95 } // End namespace Foam
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 #endif
100 
101 // ************************************************************************* //
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
IOobjectList.H
Foam::instantList
List< instant > instantList
List of instants.
Definition: instantList.H:44
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
Foam::fvMeshSubsetProxy::zeroGradientField
static tmp< GeometricField< Type, fvPatchField, volMesh > > zeroGradientField(const DimensionedField< Type, volMesh > &df)
Construct volField (with zeroGradient) from an internal field.
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::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fvMeshSubsetProxy.H
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.