Loading...
Searching...
No Matches
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-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::Barycentric
29
30Description
31 Templated 3D Barycentric derived from VectorSpace.
32 Has 4 components, one of which is redundant.
33
34SourceFiles
35 BarycentricI.H
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_Barycentric_H
40#define Foam_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 };
76
77 // Generated Methods: copy construct/assignment
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 );
97 //- Construct from three components, calculate fourth component
98 inline Barycentric(const Cmpt& va, const Cmpt& vb, const Cmpt& vc);
99
100
101 // Member Functions
102
103 // Component Access
104
105 const Cmpt& a() const noexcept { return this->v_[A]; }
106 const Cmpt& b() const noexcept { return this->v_[B]; }
107 const Cmpt& c() const noexcept { return this->v_[C]; }
108 const Cmpt& d() const noexcept { return this->v_[D]; }
109
110 Cmpt& a() noexcept { return this->v_[A]; }
111 Cmpt& b() noexcept { return this->v_[B]; }
112 Cmpt& c() noexcept { return this->v_[C]; }
113 Cmpt& d() noexcept { return this->v_[D]; }
116 // Operations
118 //- Scalar-product of \c this with another Barycentric.
119 inline Cmpt inner(const Barycentric<Cmpt>& b2) const;
123// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
124
125//- Data are contiguous if component type is contiguous
126template<class Cmpt>
127struct is_contiguous<Barycentric<Cmpt>> : is_contiguous<Cmpt> {};
128
129//- Data are contiguous label if component type is label
130template<class Cmpt>
132
133//- Data are contiguous scalar if component type is scalar
134template<class Cmpt>
136
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140} // End namespace Foam
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144#include "BarycentricI.H"
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148#endif
149
150// ************************************************************************* //
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition Barycentric.H:53
Barycentric(const Foam::zero)
Construct initialized to zero.
Cmpt & a() noexcept
Cmpt & b() noexcept
Barycentric(const Cmpt &va, const Cmpt &vb, const Cmpt &vc)
Construct from three components, calculate fourth component.
Barycentric()=default
Default construct.
static constexpr direction rank
Definition Barycentric.H:69
Cmpt inner(const Barycentric< Cmpt > &b2) const
Scalar-product of this with another Barycentric.
Barycentric< label > labelType
Equivalent type of labels used for valid component indexing.
Definition Barycentric.H:61
const Cmpt & b() const noexcept
Cmpt & d() noexcept
Barycentric(const Cmpt &va, const Cmpt &vb, const Cmpt &vc, const Cmpt &vd)
Construct from components.
Cmpt & c() noexcept
const Cmpt & d() const noexcept
const Cmpt & a() const noexcept
const Cmpt & c() const noexcept
Cmpt v_[Ncmpts]
The components of this vector space.
Definition VectorSpace.H:81
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
const dimensionedScalar & D
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