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-------------------------------------------------------------------------------
10License
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
33namespace Foam
34{
35
36// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
37
38template<class Type>
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
60template<class Type>
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
73template<class Type>
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
87template<class Type>
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
101template<class Type>
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
116template<class Type>
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
128template<class Type>
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
141template<class Type>
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// ************************************************************************* //
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
#define TFOR_ALL_F_OP_FUNC_F_F(typeF1, f1, OP, FUNC, typeF2, f2, typeF3, f3)
Definition: FieldM.H:150
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
Definition: FieldM.H:219
Generic templated field type.
Definition: Field.H:82
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A class for managing temporary objects.
Definition: tmp.H:65
void clear() const noexcept
Definition: tmpI.H:287
T & ref() const
Definition: tmpI.H:227
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.