Barycentric2D.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::Barycentric2D
29 
30 Description
31  Templated 2D Barycentric derived from VectorSpace.
32  Has 3 components, one of which is redundant.
33 
34 SourceFiles
35  Barycentric2DI.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Barycentric2D_H
40 #define Barycentric2D_H
41 
42 #include "contiguous.H"
43 #include "VectorSpace.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class Barycentric2D Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Cmpt>
55 class Barycentric2D
56 :
57  public VectorSpace<Barycentric2D<Cmpt>, Cmpt, 3>
58 {
59 public:
60 
61  //- Equivalent type of labels used for valid component indexing
63 
64 
65  // Member constants
66 
67  //- Rank of Barycentric2D is 1
68  static constexpr direction rank = 1;
69 
70 
71  //- Component labeling enumeration
72  enum components { A, B, C };
73 
74 
75  // Constructors
76 
77  //- Construct null
78  inline Barycentric2D();
79 
80  //- Construct initialized to zero
81  inline Barycentric2D(const Foam::zero);
82 
83  //- Construct given four components
84  inline Barycentric2D
85  (
86  const Cmpt& va,
87  const Cmpt& vb,
88  const Cmpt& vc
89  );
90 
91 
92  // Member Functions
93 
94  // Access
95 
96  inline const Cmpt& a() const;
97  inline const Cmpt& b() const;
98  inline const Cmpt& c() const;
99 
100 
101  // Edit
102 
103  inline Cmpt& a();
104  inline Cmpt& b();
105  inline Cmpt& c();
106 
107 
108  // Tests
109 
110  //- True if any coordinates are negative
111  inline bool outside() const;
112 
113 };
114 
115 
116 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
117 
118 //- Data are contiguous if component type is contiguous
119 template<class Cmpt>
120 struct is_contiguous<Barycentric2D<Cmpt>> : is_contiguous<Cmpt> {};
121 
122 //- Data are contiguous label if component type is label
123 template<class Cmpt>
124 struct is_contiguous_label<Barycentric2D<Cmpt>> : is_contiguous_label<Cmpt> {};
125 
126 //- Data are contiguous scalar if component type is scalar
127 template<class Cmpt>
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 #include "Barycentric2DI.H"
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
Foam::Barycentric2D::rank
static constexpr direction rank
Rank of Barycentric2D is 1.
Definition: Barycentric2D.H:67
VectorSpace.H
Foam::Barycentric2D::b
const Cmpt & b() const
Definition: Barycentric2DI.H:67
Foam::Barycentric2D
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant.
Definition: Barycentric2D.H:54
Foam::Barycentric2D::Barycentric2D
Barycentric2D()
Construct null.
Definition: Barycentric2DI.H:32
Barycentric2DI.H
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::Barycentric2D::c
const Cmpt & c() const
Definition: Barycentric2DI.H:74
Foam::Barycentric2D::B
Definition: Barycentric2D.H:71
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::Barycentric2D::outside
bool outside() const
True if any coordinates are negative.
Definition: Barycentric2DI.H:102
Foam::Barycentric2D::labelType
Barycentric2D< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: Barycentric2D.H:61
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
contiguous.H
Foam::direction
uint8_t direction
Definition: direction.H:47
Foam::Barycentric2D::A
Definition: Barycentric2D.H:71
Foam::C
Graphite solid properties.
Definition: C.H:50
Foam::Barycentric2D::a
const Cmpt & a() const
Definition: Barycentric2DI.H:60
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::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61
Foam::Barycentric2D::components
components
Component labeling enumeration.
Definition: Barycentric2D.H:71