tensorFieldField.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 OpenFOAM Foundation
9  Copyright (C) 2019-2021 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 Description
28  Specialisation of FieldField<T> for tensor.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "tensorFieldField.H"
33 
34 #define TEMPLATE template<template<class> class Field>
35 #include "FieldFieldFunctionsM.C"
36 
37 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
38 
39 template<template<class> class Field, class Cmpt>
40 void Foam::zip
41 (
42  FieldField<Field, Tensor<Cmpt>>& result,
43  const FieldField<Field, Cmpt>& xx,
44  const FieldField<Field, Cmpt>& xy,
45  const FieldField<Field, Cmpt>& xz,
46  const FieldField<Field, Cmpt>& yx,
47  const FieldField<Field, Cmpt>& yy,
48  const FieldField<Field, Cmpt>& yz,
49  const FieldField<Field, Cmpt>& zx,
50  const FieldField<Field, Cmpt>& zy,
51  const FieldField<Field, Cmpt>& zz
52 )
53 {
54  forAll(result, i)
55  {
56  Foam::zip
57  (
58  result[i],
59  xx[i], xy[i], xz[i],
60  yx[i], yy[i], yz[i],
61  zx[i], zy[i], zz[i]
62  );
63  }
64 }
65 
66 
67 template<template<class> class Field, class Cmpt>
68 void Foam::unzip
69 (
80 )
81 {
82  forAll(input, i)
83  {
85  (
86  input[i],
87  xx[i], xy[i], xz[i],
88  yx[i], yy[i], yz[i],
89  zx[i], zy[i], zz[i]
90  );
91  }
92 }
93 
94 
95 template<template<class> class Field, class Cmpt>
96 void Foam::zipRows
97 (
98  FieldField<Field, Tensor<Cmpt>>& result,
99  const FieldField<Field, Vector<Cmpt>>& x,
100  const FieldField<Field, Vector<Cmpt>>& y,
101  const FieldField<Field, Vector<Cmpt>>& z
102 )
103 {
104  forAll(result, i)
105  {
106  Foam::zipRows(result[i], x[i], y[i], z[i]);
107  }
108 }
109 
110 
111 template<template<class> class Field, class Cmpt>
112 void Foam::zipCols
113 (
114  FieldField<Field, Tensor<Cmpt>>& result,
115  const FieldField<Field, Vector<Cmpt>>& x,
116  const FieldField<Field, Vector<Cmpt>>& y,
117  const FieldField<Field, Vector<Cmpt>>& z
118 )
119 {
120  forAll(result, i)
121  {
122  Foam::zipCols(result[i], x[i], y[i], z[i]);
123  }
124 }
125 
126 
127 template<template<class> class Field, class Cmpt>
128 void Foam::unzipRows
129 (
134 )
135 {
136  forAll(input, i)
137  {
138  Foam::unzipRows(input[i], x[i], y[i], z[i]);
139  }
140 }
141 
142 
143 template<template<class> class Field, class Cmpt>
144 void Foam::unzipCols
145 (
150 )
151 {
152  forAll(input, i)
153  {
154  Foam::unzipCols(input[i], x[i], y[i], z[i]);
155  }
156 }
157 
158 
159 template<template<class> class Field, class Cmpt>
160 void Foam::unzipRow
161 (
163  const vector::components cmpt,
164  FieldField<Field, Vector<Cmpt>>& result
165 )
166 {
167  forAll(input, i)
168  {
169  Foam::unzipRow(input[i], cmpt, result[i]);
170  }
171 }
172 
173 
174 template<template<class> class Field, class Cmpt>
175 void Foam::unzipCol
176 (
178  const vector::components cmpt,
179  FieldField<Field, Vector<Cmpt>>& result
180 )
181 {
182  forAll(input, i)
183  {
184  Foam::unzipCol(input[i], cmpt, result[i]);
185  }
186 }
187 
188 
189 template<template<class> class Field, class Cmpt>
190 void Foam::unzipDiag
191 (
193  FieldField<Field, Vector<Cmpt>>& result
194 )
195 {
196  forAll(input, i)
197  {
198  Foam::unzipDiag(input[i], result[i]);
199  }
200 }
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 namespace Foam
206 {
207 
208 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
209 
210 UNARY_FUNCTION(scalar, tensor, tr)
217 UNARY_FUNCTION(scalar, tensor, det)
220 
223 
224 
225 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
226 
229 
232 
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 } // End namespace Foam
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #include "undefFieldFunctionsM.H"
241 
242 // ************************************************************************* //
BINARY_OPERATOR
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:412
Foam::Tensor
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:275
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:84
Foam::sphericalTensor
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Definition: sphericalTensor.H:54
Foam::zipCols
void zipCols(FieldField< Field, Tensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together tensor field from column components.
Definition: tensorFieldField.C:113
UNARY_FUNCTION
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
Definition: DimensionedFieldFunctionsM.C:33
Foam::unzipRows
void unzipRows(const FieldField< Field, Tensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract tensor field field rows.
Definition: tensorFieldField.C:129
Foam::unzip
void unzip(const FieldField< Field, SphericalTensor< Cmpt >> &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
Definition: sphericalTensorFieldField.C:55
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
Foam::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:138
Foam::eigenValues
dimensionedVector eigenValues(const dimensionedSymmTensor &dt)
Definition: dimensionedTensor.C:149
Foam::eigenVectors
dimensionedTensor eigenVectors(const dimensionedSymmTensor &dt)
Definition: dimensionedTensor.C:160
BINARY_TYPE_OPERATOR
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:674
undefFieldFunctionsM.H
tensorFieldField.H
Specialisation of FieldField<T> for tensor.
Foam::unzipRow
void unzipRow(const FieldField< Field, Tensor< Cmpt >> &input, const vector::components cmpt, FieldField< Field, Vector< Cmpt >> &result)
Extract a tensor field field row (x,y,z) == (0,1,2)
Definition: tensorFieldField.C:161
Foam::zipRows
void zipRows(FieldField< Field, Tensor< Cmpt >> &result, const FieldField< Field, Vector< Cmpt >> &x, const FieldField< Field, Vector< Cmpt >> &y, const FieldField< Field, Vector< Cmpt >> &z)
Zip together tensor field field from row components.
Definition: tensorFieldField.C:97
Foam::unzipCols
void unzipCols(const FieldField< Field, Tensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &x, FieldField< Field, Vector< Cmpt >> &y, FieldField< Field, Vector< Cmpt >> &z)
Extract tensor field field columns.
Definition: tensorFieldField.C:145
Foam::dev2
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:117
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::divide
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:73
Foam::symmTensor
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:59
Foam::sph
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
Definition: DiagTensorI.H:130
FieldFieldFunctionsM.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cof
dimensionedSymmTensor cof(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:139
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::unzipCol
void unzipCol(const FieldField< Field, Tensor< Cmpt >> &input, const vector::components cmpt, FieldField< Field, Vector< Cmpt >> &result)
Extract a tensor field field column (x,y,z) == (0,1,2)
Definition: tensorFieldField.C:176
UNARY_OPERATOR
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
Definition: DimensionedFieldFunctionsM.C:87
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::input
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:55
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::zip
void zip(FieldField< Field, SphericalTensor< Cmpt >> &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
Definition: sphericalTensorFieldField.C:41
Foam::unzipDiag
void unzipDiag(const FieldField< Field, SymmTensor< Cmpt >> &input, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field diagonal.
Definition: symmTensorFieldField.C:91
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:62
Foam::hdual
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
Definition: pointPatchFieldFunctions.H:273
Foam::twoSymm
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:95
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::dev
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:106