symmTensorFieldField.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-2015 OpenFOAM Foundation
9  Copyright (C) 2019-2023 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 "symmTensorFieldField.H"
30 
31 #define TEMPLATE template<template<class> class Field>
32 #include "FieldFieldFunctionsM.C"
33 
34 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
35 
36 template<template<class> class Field, class Cmpt>
37 void Foam::zip
38 (
40  const FieldField<Field, Cmpt>& xx,
41  const FieldField<Field, Cmpt>& xy,
42  const FieldField<Field, Cmpt>& xz,
43  const FieldField<Field, Cmpt>& yy,
44  const FieldField<Field, Cmpt>& yz,
45  const FieldField<Field, Cmpt>& zz
46 )
47 {
48  forAll(result, i)
49  {
50  Foam::zip
51  (
52  result[i],
53  xx[i], xy[i], xz[i],
54  /*yx*/ yy[i], yz[i],
55  /*zx zy */ zz[i]
56  );
57  }
58 }
59 
60 
61 template<template<class> class Field, class Cmpt>
62 void Foam::unzip
63 (
64  const FieldField<Field, SymmTensor<Cmpt>>& input,
65  FieldField<Field, Cmpt>& xx,
66  FieldField<Field, Cmpt>& xy,
67  FieldField<Field, Cmpt>& xz,
68  FieldField<Field, Cmpt>& yy,
69  FieldField<Field, Cmpt>& yz,
70  FieldField<Field, Cmpt>& zz
71 )
72 {
73  forAll(input, i)
74  {
76  (
77  input[i],
78  xx[i], xy[i], xz[i],
79  /*yx*/ yy[i], yz[i],
80  /*zx zy */ zz[i]
81  );
82  }
83 }
84 
85 
86 template<template<class> class Field, class Cmpt>
87 void Foam::zipRows
88 (
89  FieldField<Field, SymmTensor<Cmpt>>& result,
90  const FieldField<Field, Vector<Cmpt>>& x,
91  const FieldField<Field, Vector<Cmpt>>& y,
92  const FieldField<Field, Vector<Cmpt>>& z
93 )
94 {
95  forAll(result, i)
96  {
97  Foam::zipRows(result[i], x[i], y[i], z[i]);
98  }
99 }
100 
101 
102 template<template<class> class Field, class Cmpt>
103 void Foam::zipCols
104 (
105  FieldField<Field, SymmTensor<Cmpt>>& result,
106  const FieldField<Field, Vector<Cmpt>>& x,
107  const FieldField<Field, Vector<Cmpt>>& y,
108  const FieldField<Field, Vector<Cmpt>>& z
109 )
110 {
111  forAll(result, i)
112  {
113  Foam::zipCols(result[i], x[i], y[i], z[i]);
114  }
115 }
116 
117 
118 template<template<class> class Field, class Cmpt>
119 void Foam::unzipRows
120 (
121  const FieldField<Field, SymmTensor<Cmpt>>& input,
122  FieldField<Field, Vector<Cmpt>>& x,
123  FieldField<Field, Vector<Cmpt>>& y,
124  FieldField<Field, Vector<Cmpt>>& z
125 )
126 {
127  forAll(input, i)
128  {
129  Foam::unzipRows(input[i], x[i], y[i], z[i]);
130  }
131 }
132 
133 
134 template<template<class> class Field, class Cmpt>
135 void Foam::unzipCols
136 (
137  const FieldField<Field, SymmTensor<Cmpt>>& input,
138  FieldField<Field, Vector<Cmpt>>& x,
139  FieldField<Field, Vector<Cmpt>>& y,
140  FieldField<Field, Vector<Cmpt>>& z
141 )
142 {
143  forAll(input, i)
144  {
145  Foam::unzipCols(input[i], x[i], y[i], z[i]);
146  }
147 }
148 
149 
150 template<template<class> class Field, class Cmpt>
151 void Foam::unzipRow
152 (
153  const FieldField<Field, SymmTensor<Cmpt>>& input,
154  const direction idx,
155  FieldField<Field, Vector<Cmpt>>& result
156 )
157 {
158  forAll(input, i)
159  {
160  Foam::unzipRow(input[i], idx, result[i]);
161  }
162 }
163 
164 
165 template<template<class> class Field, class Cmpt>
166 void Foam::unzipCol
167 (
168  const FieldField<Field, SymmTensor<Cmpt>>& input,
169  const direction idx,
170  FieldField<Field, Vector<Cmpt>>& result
171 )
172 {
173  forAll(input, i)
174  {
175  Foam::unzipCol(input[i], idx, result[i]);
176  }
177 }
178 
179 
180 template<template<class> class Field, class Cmpt>
181 void Foam::unzipDiag
182 (
183  const FieldField<Field, SymmTensor<Cmpt>>& input,
184  FieldField<Field, Vector<Cmpt>>& result
185 )
186 {
187  forAll(input, i)
188  {
189  Foam::unzipDiag(input[i], result[i]);
190  }
191 }
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 namespace Foam
197 {
198 
199 // * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
200 
203 
204 UNARY_FUNCTION(scalar, symmTensor, tr)
212 UNARY_FUNCTION(scalar, symmTensor, det)
215 
216 
217 // * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
218 
220 
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "undefFieldFunctionsM.H"
232 
233 // ************************************************************************* //
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
uint8_t direction
Definition: direction.H:46
A templated (3 x 3) symmetric tensor of objects of <T>, effectively containing 6 elements, derived from VectorSpace.
Definition: SymmTensor.H:50
Specialisation of FieldField<T> for symmTensor.
void unzipCols(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract symmTensor field field columns.
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
void zip(FieldField< Field, SphericalTensor< Cmpt >> &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
void zipCols(FieldField< Field, SymmTensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together symmTensor field from column components.
Tensor< scalar > tensor
Definition: symmTensor.H:57
void unzipRow(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field row (x,y,z) == (0,1,2)
SymmTensor< Cmpt > devSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of the symmetric part of a SymmTensor.
Definition: SymmTensorI.H:481
dimensionedScalar det(const dimensionedSphericalTensor &dt)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
Definition: DiagTensorI.H:110
void unzipRows(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract symmTensor field field rows.
void zipRows(FieldField< Field, SymmTensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together symmTensor field field from row components.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
void unzip(const FieldField< Field, SphericalTensor< Cmpt >> &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
void unzipDiag(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field diagonal.
scalar y
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Generic templated field type.
Definition: Field.H:62
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:55
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Vector< scalar > vector
Definition: vector.H:57
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
dimensionedSymmTensor innerSqr(const dimensionedSymmTensor &dt)
void unzipCol(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field column (x,y,z) == (0,1,2)
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
Namespace for OpenFOAM.
SymmTensor< Cmpt > devTwoSymm(const SymmTensor< Cmpt > &st)
Return the deviatoric part of twice the symmetric part of a SymmTensor.
Definition: SymmTensorI.H:491