All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SpatialTensor.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::SpatialTensor
26 
27 Description
28  Templated 3D spatial tensor derived from MatrixSpace used to represent
29  transformations of spatial vectors and the angular and linear inertia of
30  rigid bodies.
31 
32  Reference:
33  \verbatim
34  Featherstone, R. (2008).
35  Rigid body dynamics algorithms.
36  Springer.
37  \endverbatim
38 
39 SourceFiles
40  SpatialTensorI.H
41 
42 See also
43  Foam::MatrixSpace
44  Foam::Tensor
45  Foam::SpatialVector
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef SpatialTensor_H
50 #define SpatialTensor_H
51 
52 #include "Tensor.H"
53 #include "SpatialVector.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class SpatialTensor Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Cmpt>
65 class SpatialTensor
66 :
67  public MatrixSpace<SpatialTensor<Cmpt>, Cmpt, 6, 6>
68 {
69 
70 public:
71 
72  // Member constants
73 
74  //- Rank of Tensor is 2
75  static const direction rank = 2;
76 
77 
78  // Static Data Members
79 
80  //- Identity matrix for square matrices
81  static const SpatialTensor I;
82 
83 
84  // Constructors
85 
86  //- Construct null
87  inline SpatialTensor();
88 
89  //- Construct initialized to zero
90  inline SpatialTensor(const Foam::zero);
91 
92  //- Construct given MatrixSpace of the same rank
93  inline SpatialTensor(const typename SpatialTensor::msType&);
94 
95  //- Construct given 4 tensor blocks
96  inline SpatialTensor
97  (
98  const Tensor<Cmpt>& t00, const Tensor<Cmpt>& t01,
99  const Tensor<Cmpt>& t10, const Tensor<Cmpt>& t11
100  );
101 
102  //- Construct given 36 components
103  inline SpatialTensor
104  (
105  const Cmpt& t00, const Cmpt& t01, const Cmpt& t02,
106  const Cmpt& t03, const Cmpt& t04, const Cmpt& t05,
107 
108  const Cmpt& t10, const Cmpt& t11, const Cmpt& t12,
109  const Cmpt& t13, const Cmpt& t14, const Cmpt& t15,
110 
111  const Cmpt& t20, const Cmpt& t21, const Cmpt& t22,
112  const Cmpt& t23, const Cmpt& t24, const Cmpt& t25,
113 
114  const Cmpt& t30, const Cmpt& t31, const Cmpt& t32,
115  const Cmpt& t33, const Cmpt& t34, const Cmpt& t35,
116 
117  const Cmpt& t40, const Cmpt& t41, const Cmpt& t42,
118  const Cmpt& t43, const Cmpt& t44, const Cmpt& t45,
119 
120  const Cmpt& t50, const Cmpt& t51, const Cmpt& t52,
121  const Cmpt& t53, const Cmpt& t54, const Cmpt& t55
122  );
123 
124  //- Construct from Istream
125  inline SpatialTensor(Istream&);
126 };
127 
128 
129 template<class Cmpt>
130 class typeOfTranspose<Cmpt, SpatialTensor<Cmpt>>
131 {
132 public:
134  typedef SpatialTensor<Cmpt> type;
135 };
136 
137 
138 template<class Cmpt>
139 class typeOfOuterProduct<Cmpt, SpatialVector<Cmpt>, SpatialVector<Cmpt>>
140 {
141 public:
143  typedef SpatialTensor<Cmpt> type;
144 };
145 
146 
147 template<class Cmpt>
148 class typeOfInnerProduct<Cmpt, SpatialTensor<Cmpt>, SpatialVector<Cmpt>>
149 {
150 public:
152  typedef SpatialVector<Cmpt> type;
153 };
154 
155 
156 template<class Cmpt>
157 class typeOfInnerProduct<Cmpt, SpatialTensor<Cmpt>, SpatialTensor<Cmpt>>
158 {
159 public:
161  typedef SpatialTensor<Cmpt> type;
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 // Include inline implementations
172 #include "SpatialTensorI.H"
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Abstract template class to provide the form resulting from.
Definition: products.H:53
Templated 3D spatial tensor derived from MatrixSpace used to represent transformations of spatial vec...
Definition: SpatialTensor.H:64
Abstract template class to provide the form resulting from.
Definition: products.H:47
uint8_t direction
Definition: direction.H:45
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
MatrixSpace< SpatialTensor< Cmpt >, Cmpt, Mrows, Ncols > msType
MatrixSpace type.
Definition: MatrixSpace.H:63
static const SpatialTensor I
Identity matrix for square matrices.
Definition: SpatialTensor.H:80
SpatialTensor()
Construct null.
Templated matrix space.
Definition: MatrixSpace.H:55
static const direction rank
Rank of Tensor is 2.
Definition: SpatialTensor.H:74
Abstract template class to provide the transpose form of a form.
Definition: products.H:58
Templated 3D spatial vector derived from VectorSpace used to represent the anglular and linear compon...
Definition: SpatialVector.H:62
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Templated 3D tensor derived from MatrixSpace adding construction from 9 components, element access using xx(), xy() etc. member functions and the inner-product (dot-product) and outer-product of two Vectors (tensor-product) operators.
Definition: complexI.H:215
Namespace for OpenFOAM.