BarycentricTensor.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) 2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::BarycentricTensor
29 
30 Description
31  Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can
32  represent a barycentric transformation as a matrix-barycentric inner-
33  product. Can alternatively represent an inverse barycentric transformation
34  as a vector-matrix inner-product.
35 
36 SourceFiles
37  BarycentricTensorI.H
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef BarycentricTensor_H
42 #define BarycentricTensor_H
43 
44 #include "Barycentric.H"
45 #include "Tensor.H"
46 #include "Vector.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class BarycentricTensor Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Cmpt>
59 :
60  public MatrixSpace<BarycentricTensor<Cmpt>, Cmpt, 4, 3>
61 {
62 public:
63 
64  // Typedefs
65 
66  //- Equivalent type of labels used for valid component indexing
67  typedef Tensor<label> labelType;
68 
69 
70  // Member Constants
71 
72  //- Rank of BarycentricTensor is 2
73  static constexpr direction rank = 2;
74 
75 
76  //- Component labeling enumeration
77  enum components { XA, XB, XC, XD, YA, YB, YC, YD, ZA, ZB, ZC, ZD };
78 
79 
80  // Generated Methods
81 
82  //- Default construct
83  BarycentricTensor() = default;
84 
85 
86  // Constructors
87 
88  //- Construct initialised to zero
89  inline BarycentricTensor(const Foam::zero);
90 
91  //- Construct given three barycentric components (rows)
92  inline BarycentricTensor
93  (
94  const Barycentric<Cmpt>& x,
95  const Barycentric<Cmpt>& y,
96  const Barycentric<Cmpt>& z
97  );
98 
99  //- Construct given four vector components (columns)
100  inline BarycentricTensor
101  (
102  const Vector<Cmpt>& a,
103  const Vector<Cmpt>& b,
104  const Vector<Cmpt>& c,
105  const Vector<Cmpt>& d
106  );
107 
108 
109  // Member Functions
110 
111  // Row-barycentric access
112 
113  inline Barycentric<Cmpt> x() const;
114  inline Barycentric<Cmpt> y() const;
115  inline Barycentric<Cmpt> z() const;
116 
117  // Column-vector access
118 
119  inline Vector<Cmpt> a() const;
120  inline Vector<Cmpt> b() const;
121  inline Vector<Cmpt> c() const;
122  inline Vector<Cmpt> d() const;
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
127 
128 //- Data are contiguous if component type is contiguous
129 template<class Cmpt>
130 struct is_contiguous<BarycentricTensor<Cmpt>> : is_contiguous<Cmpt> {};
131 
132 //- Data are contiguous label if component type is label
133 template<class Cmpt>
135 :
136  is_contiguous_label<Cmpt>
137 {};
138 
139 //- Data are contiguous scalar if component type is scalar
140 template<class Cmpt>
142 :
144 {};
145 
146 
147 template<class Cmpt>
148 class typeOfTranspose<Cmpt, BarycentricTensor<Cmpt>>
149 {
150 public:
151 
152  typedef void type;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #include "BarycentricTensorI.H"
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::BarycentricTensor::ZB
Definition: BarycentricTensor.H:76
Foam::Tensor
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:275
Foam::BarycentricTensor::XD
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::YA
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::labelType
Tensor< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: BarycentricTensor.H:66
Foam::BarycentricTensor::b
Vector< Cmpt > b() const
Definition: BarycentricTensorI.H:140
Foam::typeOfTranspose
Abstract template class to provide the transpose form of a form.
Definition: products.H:62
Foam::BarycentricTensor::rank
static constexpr direction rank
Rank of BarycentricTensor is 2.
Definition: BarycentricTensor.H:72
Foam::BarycentricTensor::x
Barycentric< Cmpt > x() const
Definition: BarycentricTensorI.H:91
Foam::BarycentricTensor::components
components
Component labeling enumeration.
Definition: BarycentricTensor.H:76
Vector.H
Foam::BarycentricTensor::a
Vector< Cmpt > a() const
Definition: BarycentricTensorI.H:133
Foam::BarycentricTensor::ZD
Definition: BarycentricTensor.H:76
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::MatrixSpace
Templated matrix space.
Definition: MatrixSpace.H:58
Foam::BarycentricTensor::ZA
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::YD
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::XA
Definition: BarycentricTensor.H:76
Foam::Barycentric
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition: Barycentric.H:54
Foam::BarycentricTensor::BarycentricTensor
BarycentricTensor()=default
Default construct.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::BarycentricTensor::ZC
Definition: BarycentricTensor.H:76
Tensor.H
Foam::typeOfTranspose< Cmpt, BarycentricTensor< Cmpt > >::type
void type
Definition: BarycentricTensor.H:151
Barycentric.H
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::BarycentricTensor::z
Barycentric< Cmpt > z() const
Definition: BarycentricTensorI.H:119
Foam::BarycentricTensor::XB
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::c
Vector< Cmpt > c() const
Definition: BarycentricTensorI.H:147
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::BarycentricTensor
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can represent a barycentric transfo...
Definition: BarycentricTensor.H:57
Foam::BarycentricTensor::XC
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::d
Vector< Cmpt > d() const
Definition: BarycentricTensorI.H:154
Foam::BarycentricTensor::YB
Definition: BarycentricTensor.H:76
Foam::BarycentricTensor::YC
Definition: BarycentricTensor.H:76
BarycentricTensorI.H
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::BarycentricTensor::y
Barycentric< Cmpt > y() const
Definition: BarycentricTensorI.H:105
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62