fieldCoordinateSystemTransformTemplates.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) 2011-2022 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 
27 #include "volFields.H"
28 #include "surfaceFields.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 template<class FieldType>
35 (
36  const FieldType& field
37 )
38 {
39  const word transFieldName(transformFieldName(field.name()));
40 
41  store
42  (
43  transFieldName,
45  );
46 }
47 
48 
49 template<class Type>
51 (
52  const word& fieldName
53 )
54 {
55  if (mesh_.foundObject<VolField<Type>>(fieldName))
56  {
57  DebugInfo << type() << ": Field " << fieldName << endl;
58 
59  transformField<VolField<Type>>
60  (
61  mesh_.lookupObject<VolField<Type>>(fieldName)
62  );
63  }
64  else if (mesh_.foundObject<SurfaceField<Type>>(fieldName))
65  {
66  DebugInfo << type() << ": Field " << fieldName << endl;
67 
68  transformField<SurfaceField<Type>>
69  (
70  mesh_.lookupObject<SurfaceField<Type>>(fieldName)
71  );
72  }
73 }
74 
75 
76 // ************************************************************************* //
Generic GeometricField class.
virtual const tensor & R() const =0
Return local-to-global transformation tensor.
const coordinateRotation & R() const
Return const reference to co-ordinate rotation.
void transform(const word &fieldName)
Transform the given field if has the specified element type.
coordinateSystem coordSys_
Co-ordinate system to transform to.
word transformFieldName(const word &fieldName) const
Return the name of the transformed field.
void transformField(const FieldType &field)
Transform the given field.
bool store(const tmp< ObjectType > &tfield)
Store the given field in the objectRegistry.
A class for handling words, derived from string.
Definition: word.H:62
#define DebugInfo
Report an information message using Foam::Info.
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:504
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Foam::surfaceFields.
Spatial transformation functions for FieldFields.