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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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 "tensorFieldField.H"
30
31#define TEMPLATE template<template<class> class Field>
33
34// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
35
36template<template<class> class Field, class Cmpt>
38(
49)
50{
51 forAll(result, i)
52 {
54 (
55 result[i],
56 xx[i], xy[i], xz[i],
57 yx[i], yy[i], yz[i],
58 zx[i], zy[i], zz[i]
59 );
60 }
61}
62
63
64template<template<class> class Field, class Cmpt>
66(
67 const FieldField<Field, Tensor<Cmpt>>& input,
77)
78{
79 forAll(input, i)
80 {
82 (
83 input[i],
84 xx[i], xy[i], xz[i],
85 yx[i], yy[i], yz[i],
86 zx[i], zy[i], zz[i]
87 );
88 }
89}
90
91
92template<template<class> class Field, class Cmpt>
94(
99)
100{
101 forAll(result, i)
102 {
103 Foam::zipRows(result[i], x[i], y[i], z[i]);
104 }
105}
106
107
108template<template<class> class Field, class Cmpt>
110(
111 FieldField<Field, Tensor<Cmpt>>& result,
114 const FieldField<Field, Vector<Cmpt>>& z
115)
116{
117 forAll(result, i)
118 {
119 Foam::zipCols(result[i], x[i], y[i], z[i]);
120 }
121}
122
123
124template<template<class> class Field, class Cmpt>
126(
127 const FieldField<Field, Tensor<Cmpt>>& input,
131)
132{
133 forAll(input, i)
134 {
135 Foam::unzipRows(input[i], x[i], y[i], z[i]);
136 }
137}
138
139
140template<template<class> class Field, class Cmpt>
142(
143 const FieldField<Field, Tensor<Cmpt>>& input,
147)
148{
149 forAll(input, i)
150 {
151 Foam::unzipCols(input[i], x[i], y[i], z[i]);
152 }
153}
154
155
156template<template<class> class Field, class Cmpt>
158(
159 const FieldField<Field, Tensor<Cmpt>>& input,
160 const direction idx,
162)
163{
164 forAll(input, i)
165 {
166 Foam::unzipRow(input[i], idx, result[i]);
167 }
168}
169
170
171template<template<class> class Field, class Cmpt>
173(
174 const FieldField<Field, Tensor<Cmpt>>& input,
175 const direction idx,
177)
178{
179 forAll(input, i)
180 {
181 Foam::unzipCol(input[i], idx, result[i]);
182 }
183}
184
185
186template<template<class> class Field, class Cmpt>
188(
189 const FieldField<Field, Tensor<Cmpt>>& input,
191)
192{
193 forAll(input, i)
194 {
195 Foam::unzipDiag(input[i], result[i]);
196 }
197}
198
199
200// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201
202namespace Foam
203{
204
205// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
206
207UNARY_FUNCTION(scalar, tensor, tr)
214UNARY_FUNCTION(scalar, tensor, det)
217
220
221
222// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
223
226
229
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233} // End namespace Foam
234
235// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236
237#include "undefFieldFunctionsM.H"
238
239// ************************************************************************* //
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
scalar y
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
Generic templated field type.
Definition: Field.H:82
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: Tensor.H:64
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:65
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
dimensionedSymmTensor dev2(const dimensionedSymmTensor &dt)
dimensionedSymmTensor dev(const dimensionedSymmTensor &dt)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
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.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
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.
void unzipDiag(const FieldField< Field, SymmTensor< Cmpt > > &input, FieldField< Field, Vector< Cmpt > > &result)
Extract a symmTensor field field diagonal.
dimensionedTensor eigenVectors(const dimensionedSymmTensor &dt)
dimensionedVector eigenValues(const dimensionedSymmTensor &dt)
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition: symmTensor.H:59
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 cof(const dimensionedSymmTensor &dt)
void hdual(pointPatchField< vector > &, const pointPatchField< tensor > &)
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a DiagTensor as a SphericalTensor.
Definition: DiagTensorI.H:130
uint8_t direction
Definition: direction.H:56
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 unzip(const FieldField< Field, SphericalTensor< Cmpt > > &input, FieldField< Field, Cmpt > &ii)
Unzip sphericalTensor field field into components.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
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)
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.
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
dimensionedTensor skew(const dimensionedTensor &dt)
void zip(FieldField< Field, SphericalTensor< Cmpt > > &result, const FieldField< Field, Cmpt > &ii)
Zip together sphericalTensor field field from components.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333
Specialisation of FieldField<T> for tensor.