fieldsExpressionTemplates.C
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) 2016 OpenFOAM Foundation
9  Copyright (C) 2016-2019 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 \*---------------------------------------------------------------------------*/
28 
29 #include "volFields.H"
30 #include "surfaceFields.H"
31 #include "polySurfaceFields.H"
32 
33 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
34 
35 template<class Type, class FOType>
37 {
39  typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
40  typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
41 
42  if (foundObject<VolFieldType>(fieldNames_[0]))
43  {
44  return store
45  (
47  fo.template calcFieldType<VolFieldType>()
48  );
49  }
50  else if (foundObject<SurfaceFieldType>(fieldNames_[0]))
51  {
52  return store
53  (
55  fo.template calcFieldType<SurfaceFieldType>()
56  );
57  }
58  else if (foundObject<SurfFieldType>(fieldNames_[0]))
59  {
60  return store
61  (
63  fo.template calcFieldType<SurfFieldType>()
64  );
65  }
66 
67  return false;
68 }
69 
70 
71 template<class Type, class FOType>
73 {
74  return calcFieldTypes<Type>(fo);
75 }
76 
77 
78 template<class FOType>
80 {
81  bool processed = false;
82 
83  processed = processed || fo.template calcType<scalar>(fo);
84  processed = processed || fo.template calcType<vector>(fo);
85  processed = processed || fo.template calcType<sphericalTensor>(fo);
86  processed = processed || fo.template calcType<symmTensor>(fo);
87  processed = processed || fo.template calcType<tensor>(fo);
88 
89  return processed;
90 }
91 
92 
93 // ************************************************************************* //
volFields.H
Foam::functionObjects::fieldsExpression::calcFieldTypes
bool calcFieldTypes(FOType &fo)
Call 'calcFieldType' for the given functionObject.
Definition: fieldsExpressionTemplates.C:36
polySurfaceFields.H
Fields for polySurface.
surfaceFields.H
Foam::surfaceFields.
Foam::functionObjects::regionFunctionObject::store
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
Definition: regionFunctionObjectTemplates.C:107
Foam::functionObjects::fieldsExpression::calcAllTypes
bool calcAllTypes(FOType &fo)
Call 'calcType' for the given functionObject.
Definition: fieldsExpressionTemplates.C:79
Foam::functionObjects::fieldsExpression::calcType
bool calcType(FOType &fo)
Call 'calcFieldTypes' for the given 'Type' and functionObject.
Definition: fieldsExpressionTemplates.C:72
Foam::functionObjects::fieldsExpression::fieldNames_
wordList fieldNames_
Names of fields to process.
Definition: fieldsExpression.H:112
Foam::functionObjects::fieldsExpression::resultName_
word resultName_
Name of result fields.
Definition: fieldsExpression.H:115
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54