magTemplates.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) 2012-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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 
35 template<class Type>
36 bool Foam::functionObjects::mag::calcMag()
37 {
38  typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
39  typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
40  typedef DimensionedField<Type, polySurfaceGeoMesh> SurfFieldType;
41 
42  if (foundObject<VolFieldType>(fieldName_, false))
43  {
44  return store
45  (
47  Foam::mag(lookupObject<VolFieldType>(fieldName_))
48  );
49  }
50  else if (foundObject<SurfaceFieldType>(fieldName_, false))
51  {
52  return store
53  (
55  Foam::mag(lookupObject<SurfaceFieldType>(fieldName_))
56  );
57  }
58  else if (foundObject<SurfFieldType>(fieldName_, false))
59  {
60  return store
61  (
63  Foam::mag(lookupObject<SurfFieldType>(fieldName_))
64  );
65  }
66 
67  return false;
68 }
69 
70 
71 // ************************************************************************* //
volFields.H
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::fieldExpression::fieldName_
word fieldName_
Name of field to process.
Definition: fieldExpression.H:112
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::functionObjects::fieldExpression::resultName_
word resultName_
Name of result field.
Definition: fieldExpression.H:115