symmTransformField.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) 2011-2016 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
27 
28 #include "symmTransformField.H"
29 #include "FieldM.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
37 
38 template<class Type>
39 void transform
40 (
41  Field<Type>& rtf,
42  const symmTensorField& trf,
43  const Field<Type>& tf
44 )
45 {
46  if (trf.size() == 1)
47  {
48  return transform(rtf, trf[0], tf);
49  }
50  else
51  {
53  (
54  Type, rtf, =, transform, symmTensor, trf, Type, tf
55  )
56  }
57 }
58 
59 
60 template<class Type>
61 tmp<Field<Type>> transform
62 (
63  const symmTensorField& trf,
64  const Field<Type>& tf
65 )
66 {
67  auto tresult = tmp<Field<Type>>::New(tf.size());
68  transform(tresult.ref(), trf, tf);
69  return tresult;
70 }
71 
72 
73 template<class Type>
74 tmp<Field<Type>> transform
75 (
76  const symmTensorField& trf,
77  const tmp<Field<Type>>& ttf
78 )
79 {
80  tmp<Field<Type>> tresult = New(ttf);
81  transform(tresult.ref(), trf, ttf());
82  ttf.clear();
83  return tresult;
84 }
85 
86 
87 template<class Type>
88 tmp<Field<Type>> transform
89 (
90  const tmp<symmTensorField>& ttrf,
91  const Field<Type>& tf
92 )
93 {
94  auto tresult = tmp<Field<Type>>::New(tf.size());
95  transform(tresult.ref(), ttrf(), tf);
96  ttrf.clear();
97  return tresult;
98 }
99 
100 
101 template<class Type>
102 tmp<Field<Type>> transform
103 (
104  const tmp<symmTensorField>& ttrf,
105  const tmp<Field<Type>>& ttf
106 )
107 {
108  tmp<Field<Type>> tresult = New(ttf);
109  transform(tresult.ref(), ttrf(), ttf());
110  ttf.clear();
111  ttrf.clear();
112  return tresult;
113 }
114 
115 
116 template<class Type>
117 void transform
118 (
119  Field<Type>& rtf,
120  const symmTensor& t,
121  const Field<Type>& tf
122 )
123 {
124  TFOR_ALL_F_OP_FUNC_S_F(Type, rtf, =, transform, tensor, t, Type, tf)
125 }
126 
127 
128 template<class Type>
129 tmp<Field<Type>> transform
130 (
131  const symmTensor& t,
132  const Field<Type>& tf
133 )
134 {
135  auto tresult = tmp<Field<Type>>::New(tf.size());
136  transform(tresult.ref(), t, tf);
137  return tresult;
138 }
139 
140 
141 template<class Type>
142 tmp<Field<Type>> transform
143 (
144  const symmTensor& t,
145  const tmp<Field<Type>>& ttf
146 )
147 {
148  tmp<Field<Type>> tresult = New(ttf);
149  transform(tresult.ref(), t, ttf());
150  ttf.clear();
151  return tresult;
152 }
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements,...
Definition: SymmTensor.H:58
symmTransformField.H
Foam::tmp::clear
void clear() const noexcept
Definition: tmpI.H:287
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
FieldM.H
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::dimensionSet::clear
void clear()
Clear exponents - resets to be dimensionless.
Definition: dimensionSet.C:143
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
TFOR_ALL_F_OP_FUNC_S_F
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
Definition: FieldM.H:219
TFOR_ALL_F_OP_FUNC_F_F
#define TFOR_ALL_F_OP_FUNC_F_F(typeF1, f1, OP, FUNC, typeF2, f2, typeF3, f3)
Definition: FieldM.H:150