Barycentric.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-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2020 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::Barycentric
29
30Description
31 Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of
32 which is redundant.
33
34SourceFiles
35 BarycentricI.H
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Barycentric_H
40#define Barycentric_H
41
42#include "contiguous.H"
43#include "VectorSpace.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class Barycentric Declaration
52\*---------------------------------------------------------------------------*/
53
54template<class Cmpt>
55class Barycentric
56:
57 public VectorSpace<Barycentric<Cmpt>, Cmpt, 4>
58{
59public:
60
61 // Typedefs
62
63 //- Equivalent type of labels used for valid component indexing
65
66
67 // Member Constants
68
69 //- Rank of Barycentric is 1
70 static constexpr direction rank = 1;
71
72
73 //- Component labeling enumeration
74 enum components { A, B, C, D };
75
76
77 // Generated Methods
78
79 //- Default construct
80 Barycentric() = default;
81
82
83 // Constructors
84
85 //- Construct initialized to zero
86 inline Barycentric(const Foam::zero);
87
88 //- Construct from components
89 inline Barycentric
90 (
91 const Cmpt& va,
92 const Cmpt& vb,
93 const Cmpt& vc,
94 const Cmpt& vd
95 );
96
97
98 // Member Functions
99
100 // Access
101
102 inline const Cmpt& a() const;
103 inline const Cmpt& b() const;
104 inline const Cmpt& c() const;
105 inline const Cmpt& d() const;
106
107 inline Cmpt& a();
108 inline Cmpt& b();
109 inline Cmpt& c();
110 inline Cmpt& d();
111};
112
113
114// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
115
116//- Data are contiguous if component type is contiguous
117template<class Cmpt>
118struct is_contiguous<Barycentric<Cmpt>> : is_contiguous<Cmpt> {};
119
120//- Data are contiguous label if component type is label
121template<class Cmpt>
123
124//- Data are contiguous scalar if component type is scalar
125template<class Cmpt>
127
128
129// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130
131} // End namespace Foam
132
133// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134
135#include "BarycentricI.H"
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139#endif
140
141// ************************************************************************* //
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition: Barycentric.H:57
const Cmpt & a() const
Definition: BarycentricI.H:56
components
Component labeling enumeration.
Definition: Barycentric.H:73
Barycentric()=default
Default construct.
static constexpr direction rank
Rank of Barycentric is 1.
Definition: Barycentric.H:69
const Cmpt & b() const
Definition: BarycentricI.H:63
Barycentric< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: Barycentric.H:63
const Cmpt & c() const
Definition: BarycentricI.H:70
const Cmpt & d() const
Definition: BarycentricI.H:77
Templated vector space.
Definition: VectorSpace.H:79
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:63
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:56
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:86
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:94
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78