tensorField.H
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-2020 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 Typedef
28  Foam::tensorField
29 
30 Description
31  Specialisation of Field<T> for tensor.
32 
33 SourceFiles
34  tensorField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef tensorField_H
39 #define tensorField_H
40 
41 #include "scalarField.H"
42 #include "vectorField.H"
43 #include "sphericalTensorField.H"
44 #include "symmTensorField.H"
45 #include "tensor.H"
46 
47 #define TEMPLATE
48 #include "FieldFunctionsM.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 typedef Field<tensor> tensorField;
56 
57 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
58 
59 //- Zip together tensor field from components
60 template<class Cmpt>
61 void zip
62 (
63  Field<Tensor<Cmpt>>& result,
64  const UList<Cmpt>& xx, const UList<Cmpt>& xy, const UList<Cmpt>& xz,
65  const UList<Cmpt>& yx, const UList<Cmpt>& yy, const UList<Cmpt>& yz,
66  const UList<Cmpt>& zx, const UList<Cmpt>& zy, const UList<Cmpt>& zz
67 );
68 
69 //- Unzip tensor field into components
70 template<class Cmpt>
71 void unzip
72 (
73  const UList<Tensor<Cmpt>>& input,
74  Field<Cmpt>& xx, Field<Cmpt>& xy, Field<Cmpt>& xz,
75  Field<Cmpt>& yx, Field<Cmpt>& yy, Field<Cmpt>& yz,
76  Field<Cmpt>& zx, Field<Cmpt>& zy, Field<Cmpt>& zz
77 );
78 
79 //- Zip together tensor field from components
80 template<class Cmpt>
81 tmp<Field<Tensor<Cmpt>>> zip
82 (
83  const Field<Cmpt>& xx, const Field<Cmpt>& xy, const Field<Cmpt>& xz,
84  const Field<Cmpt>& yx, const Field<Cmpt>& yy, const Field<Cmpt>& yz,
85  const Field<Cmpt>& zx, const Field<Cmpt>& zy, const Field<Cmpt>& zz
86 );
87 
88 
89 //- Zip together tensor field from row components
90 template<class Cmpt>
91 void zipRows
92 (
93  Field<Tensor<Cmpt>>& result,
94  const UList<Vector<Cmpt>>& x,
95  const UList<Vector<Cmpt>>& y,
96  const UList<Vector<Cmpt>>& z
97 );
98 
99 //- Zip together tensor field from column components
100 template<class Cmpt>
101 void zipCols
102 (
103  Field<Tensor<Cmpt>>& result,
104  const UList<Vector<Cmpt>>& x,
105  const UList<Vector<Cmpt>>& y,
106  const UList<Vector<Cmpt>>& z
107 );
108 
109 
110 //- Extract tensor field rows
111 template<class Cmpt>
112 void unzipRows
113 (
114  const UList<Tensor<Cmpt>>& input,
115  Field<Vector<Cmpt>>& x,
116  Field<Vector<Cmpt>>& y,
117  Field<Vector<Cmpt>>& z
118 );
119 
120 //- Extract tensor field columns
121 template<class Cmpt>
122 void unzipCols
123 (
124  const UList<Tensor<Cmpt>>& input,
125  Field<Vector<Cmpt>>& x,
126  Field<Vector<Cmpt>>& y,
127  Field<Vector<Cmpt>>& z
128 );
129 
130 
131 //- Extract a tensor field row (x,y,z) == (0,1,2)
132 template<class Cmpt>
133 void unzipRow
134 (
135  const UList<Tensor<Cmpt>>& input,
136  const vector::components cmpt,
137  Field<Vector<Cmpt>>& result
138 );
139 
140 //- Extract a tensor field column (x,y,z) == (0,1,2)
141 template<class Cmpt>
142 void unzipCol
143 (
144  const UList<Tensor<Cmpt>>& input,
145  const vector::components cmpt,
146  Field<Vector<Cmpt>>& result
147 );
148 
149 //- Extract a tensor field diagonal
150 template<class Cmpt>
151 void unzipDiag
152 (
153  const UList<Tensor<Cmpt>>& input,
154  Field<Vector<Cmpt>>& result
155 );
156 
157 //- Extract a tensor field row (x,y,z) == (0,1,2)
158 template<class Cmpt>
159 tmp<Field<Vector<Cmpt>>> unzipRow
160 (
161  const Field<Tensor<Cmpt>>& input,
162  const vector::components cmpt
163 );
164 
165 //- Extract a tensor field column (x,y,z) == (0,1,2)
166 template<class Cmpt>
167 tmp<Field<Vector<Cmpt>>> unzipCol
168 (
169  const Field<Tensor<Cmpt>>& input,
170  const vector::components cmpt
171 );
172 
173 //- Extract a tensor field diagonal
174 template<class Cmpt>
175 tmp<Field<Vector<Cmpt>>> unzipDiag
176 (
177  const Field<Tensor<Cmpt>>& input
178 );
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 UNARY_FUNCTION(scalar, tensor, tr)
190 UNARY_FUNCTION(scalar, tensor, det)
193 
196 
197 
198 // * * * * * * * * * * * * * * * global operators * * * * * * * * * * * * * //
199 
202 
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #include "undefFieldFunctionsM.H"
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
218  #include "tensorFieldTemplates.C"
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
BINARY_OPERATOR
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
Definition: DimensionedFieldFunctionsM.C:412
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:84
sphericalTensorField.H
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::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:138
scalarField.H
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
Foam::tensorField
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Definition: primitiveFieldsFwd.H:57
undefFieldFunctionsM.H
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
tensor.H
Foam::Vector< scalar >::components
components
Component labeling enumeration.
Definition: Vector.H:81
Foam::divide
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
tensorFieldTemplates.C
FieldFunctionsM.H
High performance macro functions for Field<Type> algebra. These expand using either array element acc...
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
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
symmTensorField.H
vectorField.H
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