Loading...
Searching...
No Matches
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-2022 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::BarycentricTensor
29
30Description
31 Templated 4x3 tensor derived from VectorSpace. Has 12 components.
32 Can represent a barycentric transformation as a matrix-barycentric
33 inner-product.
34
35SourceFiles
36 BarycentricTensorI.H
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_BarycentricTensor_H
41#define Foam_BarycentricTensor_H
42
43#include "Barycentric.H"
44#include "Tensor.H"
45#include "Vector.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class BarycentricTensor Declaration
54\*---------------------------------------------------------------------------*/
55
56template<class Cmpt>
58:
59 public MatrixSpace<BarycentricTensor<Cmpt>, Cmpt, 4, 3>
60{
61public:
62
63 // Typedefs
65 //- Equivalent type of labels used for valid component indexing
66 //- (unused)
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 };
79
80 // Generated Methods: copy construct/assignment
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)
93 (
95 const Barycentric<Cmpt>& y,
96 const Barycentric<Cmpt>& z
97 );
98
99 //- Construct given four vector components (columns)
100 // Eg, the corners of a tetrahedron
101 inline BarycentricTensor
102 (
103 const Vector<Cmpt>& a,
104 const Vector<Cmpt>& b,
105 const Vector<Cmpt>& c,
106 const Vector<Cmpt>& d
107 );
108
109
110 // Member Functions
112 // Component Access
113
114 const Cmpt& xa() const noexcept { return this->v_[XA]; }
115 const Cmpt& xb() const noexcept { return this->v_[XB]; }
116 const Cmpt& xc() const noexcept { return this->v_[XC]; }
117 const Cmpt& xd() const noexcept { return this->v_[XD]; }
118
119 const Cmpt& ya() const noexcept { return this->v_[YA]; }
120 const Cmpt& yb() const noexcept { return this->v_[YB]; }
121 const Cmpt& yc() const noexcept { return this->v_[YC]; }
122 const Cmpt& yd() const noexcept { return this->v_[YD]; }
123
124 const Cmpt& za() const noexcept { return this->v_[ZA]; }
125 const Cmpt& zb() const noexcept { return this->v_[ZB]; }
126 const Cmpt& zc() const noexcept { return this->v_[ZC]; }
127 const Cmpt& zd() const noexcept { return this->v_[ZD]; }
128
130 // Row-barycentric access
132 inline Barycentric<Cmpt> x() const;
133 inline Barycentric<Cmpt> y() const;
134 inline Barycentric<Cmpt> z() const;
137 // Column-vector access
138
139 inline Vector<Cmpt> a() const;
140 inline Vector<Cmpt> b() const;
141 inline Vector<Cmpt> c() const;
142 inline Vector<Cmpt> d() const;
145 // Operations
146
147 //- Tensor/barycentric inner product
148 // (transforms barycentric coordinates to vector)
149 inline Vector<Cmpt> inner(const Barycentric<Cmpt>& bry) const;
153// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
154
155//- Data are contiguous if component type is contiguous
156template<class Cmpt>
157struct is_contiguous<BarycentricTensor<Cmpt>> : is_contiguous<Cmpt> {};
158
159//- Data are contiguous label if component type is label
160template<class Cmpt>
164{};
165
166//- Data are contiguous scalar if component type is scalar
167template<class Cmpt>
169:
171{};
173
174template<class Cmpt>
175class typeOfTranspose<Cmpt, BarycentricTensor<Cmpt>>
176{
177public:
179 typedef void type;
180};
181
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185} // End namespace Foam
186
187// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188
189#include "BarycentricTensorI.H"
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193#endif
195// ************************************************************************* //
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can represent a barycentric transfo...
const Cmpt & ya() const noexcept
const Cmpt & xc() const noexcept
const Cmpt & zd() const noexcept
BarycentricTensor(const Barycentric< Cmpt > &x, const Barycentric< Cmpt > &y, const Barycentric< Cmpt > &z)
Construct given three barycentric components (rows).
Barycentric< label > y() const
BarycentricTensor(const Vector< Cmpt > &a, const Vector< Cmpt > &b, const Vector< Cmpt > &c, const Vector< Cmpt > &d)
Construct given four vector components (columns).
BarycentricTensor< label > labelType
Equivalent type of labels used for valid component indexing (unused).
components
Component labeling enumeration.
Vector< label > d() const
const Cmpt & xb() const noexcept
Vector< label > b() const
Vector< label > c() const
static constexpr direction rank
BarycentricTensor(const Foam::zero)
Construct initialised to zero.
const Cmpt & xa() const noexcept
Barycentric< label > z() const
BarycentricTensor()=default
Default construct.
const Cmpt & yc() const noexcept
Vector< Cmpt > inner(const Barycentric< Cmpt > &bry) const
Tensor/barycentric inner product.
const Cmpt & zc() const noexcept
const Cmpt & zb() const noexcept
const Cmpt & yd() const noexcept
const Cmpt & za() const noexcept
const Cmpt & xd() const noexcept
const Cmpt & yb() const noexcept
Barycentric< label > x() const
Vector< label > a() const
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition Barycentric.H:53
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition Vector.H:61
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
const direction noexcept
Definition scalarImpl.H:265
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