Loading...
Searching...
No Matches
transformField.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-2016 OpenFOAM Foundation
9 Copyright (C) 2018 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
27InNamespace
28 Foam
29
30Description
31 Spatial transformation functions for primitive fields.
32
33SourceFiles
34 transformField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_transformField_H
39#define Foam_transformField_H
40
41#include "transform.H"
42#include "quaternion.H"
43#include "septernion.H"
44#include "vectorField.H"
45#include "tensorField.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54// transform()
55
56template<class Type>
57void transform
58(
59 Field<Type>& result,
60 const tensor& rot,
61 const Field<Type>& fld
62);
63
64template<class Type>
65void transform
66(
67 Field<Type>& result,
68 const tensorField& rot,
69 const Field<Type>& fld
70);
71
72
73template<class Type>
75(
76 const tensorField& rot,
78);
79
80template<class Type>
82(
83 const tensorField& rot,
84 const tmp<Field<Type>>& tfld
85);
86
87template<class Type>
89(
90 const tmp<tensorField>& trot,
92);
93
94template<class Type>
96(
97 const tmp<tensorField>& trot,
98 const tmp<Field<Type>>& tfld
99);
100
101
102template<class Type>
104(
105 const tensor& rot,
107);
108
109template<class Type>
111(
112 const tensor& rot,
113 const tmp<Field<Type>>& tfld
114);
115
116
117// invTransform()
118
119template<class Type>
120void invTransform
121(
122 Field<Type>& result,
123 const tensor& rot,
124 const Field<Type>& fld
125);
126
127template<class Type>
128void invTransform
129(
130 Field<Type>& result,
131 const tensorField& rot,
132 const Field<Type>& fld
134
135
136template<class Type>
138(
139 const tensorField& rot,
141);
142
143template<class Type>
145(
146 const tensorField& rot,
147 const tmp<Field<Type>>& tfld
148);
149
150template<class Type>
152(
153 const tmp<tensorField>& trot,
155);
156
157template<class Type>
159(
160 const tmp<tensorField>& trot,
161 const tmp<Field<Type>>& tfld
163
164
165template<class Type>
167(
168 const tensor& rot,
170);
171
172template<class Type>
174(
175 const tensor& rot,
176 const tmp<Field<Type>>& tfld
177);
178
180// transformFieldMask()
181
182template<class Type1, class Type2>
184
185template<class Type1, class Type2>
187
188
189// Specializations
190
191template<>
194
195template<>
198
199template<>
202
203template<>
206
207
208//- Rotate given vectorField with the given quaternion
209void transform(vectorField&, const quaternion&, const vectorField&);
210
211//- Rotate given vectorField with the given quaternion
213
214//- Rotate given tmp<vectorField> with the given quaternion
216
217
218//- Transform given vectorField of coordinates with the given septernion
220
221//- Transform given vectorField of coordinates with the given septernion
223
224//- Transform given tmp<vectorField> of coordinates with the given septernion
226
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230} // End namespace Foam
231
232// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233
234#ifdef NoRepository
236#endif
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240#endif
241
242// ************************************************************************* //
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
Quaternion class used to perform rotations in 3D space.
Definition quaternion.H:54
Septernion class used to perform translations and rotations in 3D space.
Definition septernion.H:63
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
dimensionSet invTransform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
tmp< Field< sphericalTensor > > transformFieldMask< sphericalTensor >(const tensorField &tf)
tmp< Field< Type1 > > transformFieldMask(const Field< Type2 > &fld)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Tensor< scalar > tensor
Definition symmTensor.H:57
tmp< Field< symmTensor > > transformFieldMask< symmTensor >(const tensorField &tf)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
void transformPoints(vectorField &, const septernion &, const vectorField &)
Transform given vectorField of coordinates with the given septernion.
3D tensor transformation operations.