fieldsExpressionTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 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 \*---------------------------------------------------------------------------*/
25 
26 #include "volFields.H"
27 #include "surfaceFields.H"
28 
29 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
30 
31 template<class Type, class FOType>
33 {
35  typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
36 
37  if (foundObject<VolFieldType>(fieldNames_[0]))
38  {
39  return store
40  (
42  fo.template calcFieldType<VolFieldType>()
43  );
44  }
45  else if (foundObject<SurfaceFieldType>(fieldNames_[0]))
46  {
47  return store
48  (
50  fo.template calcFieldType<SurfaceFieldType>()
51  );
52  }
53  else
54  {
55  return false;
56  }
57 }
58 
59 
60 template<class Type, class FOType>
62 {
63  return calcFieldTypes<Type>(fo);
64 }
65 
66 
67 template<class FOType>
69 {
70  bool processed = false;
71 
72  processed = processed || fo.template calcType<scalar>(fo);
73  processed = processed || fo.template calcType<vector>(fo);
74  processed = processed || fo.template calcType<sphericalTensor>(fo);
75  processed = processed || fo.template calcType<symmTensor>(fo);
76  processed = processed || fo.template calcType<tensor>(fo);
77 
78  return processed;
79 }
80 
81 
82 // ************************************************************************* //
Foam::surfaceFields.
bool calcAllTypes(FOType &fo)
Call &#39;calcType&#39; for the given functionObject.
Generic GeometricField class.
wordList fieldNames_
Names of fields to process.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
bool calcFieldTypes(FOType &fo)
Call &#39;calcFieldType&#39; for the given functionObject.
word resultName_
Name of result fields.
bool calcType(FOType &fo)
Call &#39;calcFieldTypes&#39; for the given &#39;Type&#39; and functionObject.