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 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  //- Equivalent type of labels used for valid component indexing
65  typedef Tensor<label> labelType;
66 
67 
68  // Member constants
69 
70  //- Rank of BarycentricTensor is 2
71  static constexpr direction rank = 2;
72 
73 
74  //- Component labeling enumeration
75  enum components { XA, XB, XC, XD, YA, YB, YC, YD, ZA, ZB, ZC, ZD };
76 
77 
78  // Constructors
79 
80  //- Construct null
82 
83  //- Construct initialised to zero
85 
86  //- Construct given three barycentric components (rows)
88  (
89  const Barycentric<Cmpt>& x,
90  const Barycentric<Cmpt>& y,
91  const Barycentric<Cmpt>& z
92  );
93 
94  //- Construct given four vector components (columns)
96  (
97  const Vector<Cmpt>& a,
98  const Vector<Cmpt>& b,
99  const Vector<Cmpt>& c,
100  const Vector<Cmpt>& d
101  );
102 
103 
104  // Member Functions
105 
106  // Row-barycentric access
107 
108  inline Barycentric<Cmpt> x() const;
109  inline Barycentric<Cmpt> y() const;
110  inline Barycentric<Cmpt> z() const;
111 
112  // Column-vector access
113 
114  inline Vector<Cmpt> a() const;
115  inline Vector<Cmpt> b() const;
116  inline Vector<Cmpt> c() const;
117  inline Vector<Cmpt> d() const;
118 };
119 
120 
121 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
122 
123 //- Data are contiguous if component type is contiguous
124 template<class Cmpt>
125 struct is_contiguous<BarycentricTensor<Cmpt>> : is_contiguous<Cmpt> {};
126 
127 //- Data are contiguous label if component type is label
128 template<class Cmpt>
130 :
131  is_contiguous_label<Cmpt>
132 {};
133 
134 //- Data are contiguous scalar if component type is scalar
135 template<class Cmpt>
137 :
139 {};
140 
141 
142 template<class Cmpt>
143 class typeOfTranspose<Cmpt, BarycentricTensor<Cmpt>>
144 {
145 public:
146 
147  typedef void type;
148 };
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #include "BarycentricTensorI.H"
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
Foam::BarycentricTensor::ZB
Definition: BarycentricTensor.H:74
Foam::Tensor
Templated 3D tensor derived from MatrixSpace adding construction from 9 components,...
Definition: complexI.H:282
Foam::BarycentricTensor::XD
Definition: BarycentricTensor.H:74
Foam::BarycentricTensor::YA
Definition: BarycentricTensor.H:74
Foam::BarycentricTensor::labelType
Tensor< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: BarycentricTensor.H:64
Foam::BarycentricTensor::b
Vector< Cmpt > b() const
Definition: BarycentricTensorI.H:145
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:70
Foam::BarycentricTensor::x
Barycentric< Cmpt > x() const
Definition: BarycentricTensorI.H:96
Foam::BarycentricTensor::components
components
Component labeling enumeration.
Definition: BarycentricTensor.H:74
Vector.H
Foam::BarycentricTensor::BarycentricTensor
BarycentricTensor()
Construct null.
Definition: BarycentricTensorI.H:31
Foam::BarycentricTensor::a
Vector< Cmpt > a() const
Definition: BarycentricTensorI.H:138
Foam::BarycentricTensor::ZD
Definition: BarycentricTensor.H:74
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:74
Foam::BarycentricTensor::YD
Definition: BarycentricTensor.H:74
Foam::BarycentricTensor::XA
Definition: BarycentricTensor.H:74
Foam::Barycentric
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition: Barycentric.H:54
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:74
Tensor.H
Foam::typeOfTranspose< Cmpt, BarycentricTensor< Cmpt > >::type
void type
Definition: BarycentricTensor.H:146
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:124
Foam::BarycentricTensor::XB
Definition: BarycentricTensor.H:74
Foam::BarycentricTensor::c
Vector< Cmpt > c() const
Definition: BarycentricTensorI.H:152
Foam::direction
uint8_t direction
Definition: direction.H:47
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:74
Foam::BarycentricTensor::d
Vector< Cmpt > d() const
Definition: BarycentricTensorI.H:159
Foam::BarycentricTensor::YB
Definition: BarycentricTensor.H:74
Foam::BarycentricTensor::YC
Definition: BarycentricTensor.H:74
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:110
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61