symmTransformField.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-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 "symmTransformField.H"
27 #include "FieldM.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
35 
36 template<class Type>
37 void transform
38 (
39  Field<Type>& rtf,
40  const symmTensorField& trf,
41  const Field<Type>& tf
42 )
43 {
44  if (trf.size() == 1)
45  {
46  return transform(rtf, trf[0], tf);
47  }
48  else
49  {
51  (
52  Type, rtf, =, transform, symmTensor, trf, Type, tf
53  )
54  }
55 }
56 
57 
58 template<class Type>
60 (
61  const symmTensorField& trf,
62  const Field<Type>& tf
63 )
64 {
65  tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
66  transform(tranf.ref(), trf, tf);
67  return tranf;
68 }
69 
70 
71 template<class Type>
73 (
74  const symmTensorField& trf,
75  const tmp<Field<Type>>& ttf
76 )
77 {
78  tmp<Field<Type>> tranf = New(ttf);
79  transform(tranf.ref(), trf, ttf());
80  ttf.clear();
81  return tranf;
82 }
83 
84 
85 template<class Type>
87 (
88  const tmp<symmTensorField>& ttrf,
89  const Field<Type>& tf
90 )
91 {
92  tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
93  transform(tranf.ref(), ttrf(), tf);
94  ttrf.clear();
95  return tranf;
96 }
97 
98 
99 template<class Type>
101 (
102  const tmp<symmTensorField>& ttrf,
103  const tmp<Field<Type>>& ttf
104 )
105 {
106  tmp<Field<Type>> tranf = New(ttf);
107  transform(tranf.ref(), ttrf(), ttf());
108  ttf.clear();
109  ttrf.clear();
110  return tranf;
111 }
112 
113 
114 template<class Type>
115 void transform
116 (
117  Field<Type>& rtf,
118  const symmTensor& t,
119  const Field<Type>& tf
120 )
121 {
122  TFOR_ALL_F_OP_FUNC_S_F(Type, rtf, =, transform, tensor, t, Type, tf)
123 }
124 
125 
126 template<class Type>
128 (
129  const symmTensor& t,
130  const Field<Type>& tf
131 )
132 {
133  tmp<Field<Type>> tranf(new Field<Type>(tf.size()));
134  transform(tranf.ref(), t, tf);
135  return tranf;
136 }
137 
138 
139 template<class Type>
141 (
142  const symmTensor& t,
143  const tmp<Field<Type>>& ttf
144 )
145 {
146  tmp<Field<Type>> tranf = New(ttf);
147  transform(tranf.ref(), t, ttf());
148  ttf.clear();
149  return tranf;
150 }
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // ************************************************************************* //
#define TFOR_ALL_F_OP_FUNC_F_F(typeF1, f1, OP, FUNC, typeF2, f2, typeF3, f3)
Definition: FieldM.H:144
void clear() const
If object pointer points to valid object:
Definition: tmpI.H:237
Templated 3D symmetric tensor derived from VectorSpace adding construction from 6 components...
Definition: SymmTensor.H:53
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
const tensorField & tf
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Pre-declare SubField and related Field type.
Definition: Field.H:56
#define TFOR_ALL_F_OP_FUNC_S_F(typeF1, f1, OP, FUNC, typeS, s, typeF2, f2)
Definition: FieldM.H:210
A class for managing temporary objects.
Definition: PtrList.H:53
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:477