Loading...
Searching...
No Matches
SpatialTensor.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) 2016 OpenFOAM Foundation
9 Copyright (C) 2019 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::SpatialTensor
29
30Description
31 Templated 3D spatial tensor derived from MatrixSpace used to represent
32 transformations of spatial vectors and the angular and linear inertia of
33 rigid bodies.
34
35 Reference:
36 \verbatim
37 Featherstone, R. (2008).
38 Rigid body dynamics algorithms.
39 Springer.
40 \endverbatim
41
42SourceFiles
43 SpatialTensorI.H
44
45See also
46 Foam::MatrixSpace
47 Foam::Tensor
48 Foam::SpatialVector
49
50\*---------------------------------------------------------------------------*/
51
52#ifndef Foam_SpatialTensor_H
53#define Foam_SpatialTensor_H
54
55#include "Tensor.H"
56#include "SpatialVector.H"
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
62
63/*---------------------------------------------------------------------------*\
64 Class SpatialTensor Declaration
65\*---------------------------------------------------------------------------*/
66
67template<class Cmpt>
68class SpatialTensor
69:
70 public MatrixSpace<SpatialTensor<Cmpt>, Cmpt, 6, 6>
71{
72
73public:
74
75 // Member constants
76
77 //- Rank of Tensor is 2
78 static constexpr direction rank = 2;
79
80
81 // Static data members
82
83 //- Identity matrix for square matrices
84 static const SpatialTensor I;
85
86
87 // Constructors
88
89 //- Default Construct
90 SpatialTensor() = default;
92 //- Construct initialized to zero
93 inline SpatialTensor(const Foam::zero);
94
95 //- Construct given MatrixSpace of the same rank
96 inline SpatialTensor(const typename SpatialTensor::msType&);
97
98 //- Construct given 4 tensor blocks
99 inline SpatialTensor
100 (
101 const Tensor<Cmpt>& t00, const Tensor<Cmpt>& t01,
102 const Tensor<Cmpt>& t10, const Tensor<Cmpt>& t11
103 );
104
105 //- Construct given 36 components
107 (
108 const Cmpt& t00, const Cmpt& t01, const Cmpt& t02,
109 const Cmpt& t03, const Cmpt& t04, const Cmpt& t05,
110
111 const Cmpt& t10, const Cmpt& t11, const Cmpt& t12,
112 const Cmpt& t13, const Cmpt& t14, const Cmpt& t15,
113
114 const Cmpt& t20, const Cmpt& t21, const Cmpt& t22,
115 const Cmpt& t23, const Cmpt& t24, const Cmpt& t25,
116
117 const Cmpt& t30, const Cmpt& t31, const Cmpt& t32,
118 const Cmpt& t33, const Cmpt& t34, const Cmpt& t35,
119
120 const Cmpt& t40, const Cmpt& t41, const Cmpt& t42,
121 const Cmpt& t43, const Cmpt& t44, const Cmpt& t45,
122
123 const Cmpt& t50, const Cmpt& t51, const Cmpt& t52,
124 const Cmpt& t53, const Cmpt& t54, const Cmpt& t55
125 );
126
127 //- Construct from Istream
128 inline explicit SpatialTensor(Istream&);
129};
130
131
132// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
133
134//- Data are contiguous if component type is contiguous
135template<class Cmpt>
136struct is_contiguous<SpatialTensor<Cmpt>> : is_contiguous<Cmpt> {};
137
138//- Data are contiguous label if component type is label
139template<class Cmpt>
141:
143{};
144
145//- Data are contiguous scalar if component type is scalar
146template<class Cmpt>
148:
150{};
151
152
153template<class Cmpt>
154class typeOfTranspose<Cmpt, SpatialTensor<Cmpt>>
156public:
157
159};
160
161
162template<class Cmpt>
163class typeOfOuterProduct<Cmpt, SpatialVector<Cmpt>, SpatialVector<Cmpt>>
165public:
166
168};
169
170
171template<class Cmpt>
172class typeOfInnerProduct<Cmpt, SpatialTensor<Cmpt>, SpatialVector<Cmpt>>
173{
174public:
177};
178
179
180template<class Cmpt>
181class typeOfInnerProduct<Cmpt, SpatialTensor<Cmpt>, SpatialTensor<Cmpt>>
182{
183public:
186};
187
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#include "SpatialTensorI.H"
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199#endif
200
201// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
MatrixSpace< SpatialTensor< Cmpt >, Cmpt, Mrows, Ncols > msType
Definition MatrixSpace.H:65
Templated 3D spatial tensor derived from MatrixSpace used to represent transformations of spatial vec...
static constexpr direction rank
SpatialTensor(const typename SpatialTensor::msType &)
Construct given MatrixSpace of the same rank.
SpatialTensor(const Foam::zero)
Construct initialized to zero.
static const SpatialTensor I
SpatialTensor(const Cmpt &t00, const Cmpt &t01, const Cmpt &t02, const Cmpt &t03, const Cmpt &t04, const Cmpt &t05, const Cmpt &t10, const Cmpt &t11, const Cmpt &t12, const Cmpt &t13, const Cmpt &t14, const Cmpt &t15, const Cmpt &t20, const Cmpt &t21, const Cmpt &t22, const Cmpt &t23, const Cmpt &t24, const Cmpt &t25, const Cmpt &t30, const Cmpt &t31, const Cmpt &t32, const Cmpt &t33, const Cmpt &t34, const Cmpt &t35, const Cmpt &t40, const Cmpt &t41, const Cmpt &t42, const Cmpt &t43, const Cmpt &t44, const Cmpt &t45, const Cmpt &t50, const Cmpt &t51, const Cmpt &t52, const Cmpt &t53, const Cmpt &t54, const Cmpt &t55)
Construct given 36 components.
SpatialTensor()=default
Default Construct.
SpatialTensor(Istream &)
Construct from Istream.
SpatialTensor(const Tensor< Cmpt > &t00, const Tensor< Cmpt > &t01, const Tensor< Cmpt > &t10, const Tensor< Cmpt > &t11)
Construct given 4 tensor blocks.
Templated 3D spatial vector derived from VectorSpace used to represent the anglular and linear compon...
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition Tensor.H:60
Abstract template class to provide the form resulting from the inner-product of two forms.
Definition products.H:48
Abstract template class to provide the form resulting from the outer-product of two forms.
Definition products.H:56
Abstract template class to provide the transpose form of a form.
Definition products.H:63
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
uint8_t direction
Definition direction.H:49
A template class to specify if a data type is composed solely of Foam::label elements.
Definition contiguous.H:82
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition contiguous.H:87
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70