vectorTensorTransform.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) 2020 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
27Class
28 Foam::vectorTensorTransform
29
30Description
31 Vector-tensor class used to perform translations and rotations in
32 3D space.
33
34SourceFiles
35 vectorTensorTransformI.H
36 vectorTensorTransform.C
37 vectorTensorTransformTemplates.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef vectorTensorTransform_H
42#define vectorTensorTransform_H
43
44#include "tensor.H"
45#include "word.H"
46#include "contiguous.H"
47#include "pointField.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class vectorTensorTransform;
56Istream& operator>>(Istream& is, vectorTensorTransform&);
57Ostream& operator<<(Ostream& os, const vectorTensorTransform& C);
58
59
60/*---------------------------------------------------------------------------*\
61 Class vectorTensorTransform Declaration
62\*---------------------------------------------------------------------------*/
65{
66 // Private Data
67
68 //- Translation vector
69 vector t_;
70
71 //- Rotation tensor
72 tensor R_;
73
74 //- Recording if the transform has non-identity transform to
75 // allow its calculation to be skipped, which is the majority
76 // of the expected cases
77 bool hasR_;
78
79
80public:
81
82 // Static Data
84 static const char* const typeName;
86 static const vectorTensorTransform zero;
88 static const vectorTensorTransform I;
89
90
91 // Generated Methods
92
93 //- Copy construct
95
96 //- Copy assignment
98 operator=(const vectorTensorTransform&) = default;
99
100
101 // Constructors
102
103 //- Default construct - no translation, identity rotation.
104 inline vectorTensorTransform();
105
106 //- Construct given a translation vector, rotation tensor and
107 //- hasR bool
109 (
110 const vector& t,
111 const tensor& R,
112 bool hasR = true
113 );
114
115 //- Construct a pure translation vectorTensorTransform given a
116 //- translation vector
117 inline explicit vectorTensorTransform(const vector& t);
118
119 //- Construct a pure rotation vectorTensorTransform given a
120 //- rotation tensor
121 inline explicit vectorTensorTransform(const tensor& R);
122
123 //- Construct from Istream
125
126
127 // Member Functions
128
129 // Access
130
131 inline const vector& t() const;
132
133 inline const tensor& R() const;
134
135 inline bool hasR() const;
136
137
138 // Edit
139
140 inline vector& t();
141
142 inline tensor& R();
143
144
145 // Transform
146
147 //- Transform the given position
148 inline vector transformPosition(const vector& v) const;
149
150 //- Transform the given pointField
151 inline pointField transformPosition(const pointField& pts) const;
152
153 //- Inverse transform the given position
154 inline vector invTransformPosition(const vector& v) const;
155
156 //- Inverse transform the given pointField
157 inline pointField invTransformPosition(const pointField& pts) const;
158
159 //- Transform the given field
160 template<class Type>
162
163
164 // Member Operators
165
166 inline void operator&=(const vectorTensorTransform&);
167
168 //- Assign translation
169 inline void operator=(const vector&);
170 inline void operator+=(const vector&);
171 inline void operator-=(const vector&);
172
173 inline void operator=(const tensor&);
174 inline void operator&=(const tensor&);
175
176
177 // IOstream Operators
182};
183
184
185// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
186
187//- Contiguous data for vectorTensorTransform
188template<> struct is_contiguous<vectorTensorTransform> : std::true_type {};
189
190
191// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
192
193//- Return the inverse of the given vectorTensorTransform
195
196//- Return a string representation of a vectorTensorTransform
198
199//- Template specialisations
200template<>
202
203template<>
205
206template<>
208const;
209
210
211// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
212
213inline bool operator==
214(
215 const vectorTensorTransform& tr1,
216 const vectorTensorTransform& tr2
217);
218
219
220inline bool operator!=
221(
222 const vectorTensorTransform& tr1,
223 const vectorTensorTransform& tr2
224
225);
226
227
228inline vectorTensorTransform operator+
229(
231 const vector& t
232);
233
234
235inline vectorTensorTransform operator+
236(
237 const vector& t,
239);
240
241
242inline vectorTensorTransform operator-
243(
245 const vector& t
246);
247
248
249inline vectorTensorTransform operator&
250(
251 const vectorTensorTransform& tr1,
252 const vectorTensorTransform& tr2
253);
254
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258} // End namespace Foam
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
263
264#ifdef NoRepository
266#endif
267
268// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269
270#endif
271
272// ************************************************************************* //
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Default transformation behaviour.
A class for managing temporary objects.
Definition: tmp.H:65
Vector-tensor class used to perform translations and rotations in 3D space.
friend Istream & operator>>(Istream &is, vectorTensorTransform &)
vectorTensorTransform & operator=(const vectorTensorTransform &)=default
Copy assignment.
tmp< Field< Type > > transform(const Field< Type > &) const
Transform the given field.
static const vectorTensorTransform I
static const vectorTensorTransform zero
vectorTensorTransform(const vectorTensorTransform &)=default
Copy construct.
vector invTransformPosition(const vector &v) const
Inverse transform the given position.
vectorTensorTransform()
Default construct - no translation, identity rotation.
friend Ostream & operator<<(Ostream &os, const vectorTensorTransform &)
vector transformPosition(const vector &v) const
Transform the given position.
static const char *const typeName
void operator&=(const vectorTensorTransform &)
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78