Loading...
Searching...
No Matches
labelledTri.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2021 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::labelledTri
29
30Description
31 A triFace with additional (region) index.
32
33SourceFiles
34 labelledTriI.H
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_labelledTri_H
39#define Foam_labelledTri_H
40
41#include "triFace.H"
42#include "ListListOps.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50class labelledTri;
52inline Ostream& operator<<(Ostream&, const labelledTri&);
54/*---------------------------------------------------------------------------*\
55 Class labelledTri Declaration
56\*---------------------------------------------------------------------------*/
57
58class labelledTri
59:
60 public triFace
61{
62 // Private Data
63
64 //- The object index (region)
65 label index_;
66
67
68 // Private Member Functions
69
70 //- Assign from 3 or 4 labels, default region is 0.
71 template<class ListType>
72 inline void assignList(const ListType& list);
73
74
75public:
76
77 // Constructors
78
79 //- Default construct, with invalid point labels and region (-1).
80 inline labelledTri();
81
82 //- Construct from triFace
83 //- and optional region index (0 if unspecified)
84 inline labelledTri
85 (
86 const triFace& tri,
87 const label region = 0
88 );
89
90 //- Construct from three point labels
91 //- and optional region index (0 if unspecified)
92 inline labelledTri
93 (
94 const label p0,
95 const label p1,
96 const label p2,
97 const label region = 0
98 );
99
100 //- Construct from a list of 3 or 4 labels. Default region is 0.
101 inline explicit labelledTri(const labelUList& list);
102
103 //- Construct from a list of 3 or 4 labels. Default region is 0.
104 inline explicit labelledTri(std::initializer_list<label>);
105
106 //- Copy construct from a subset of point labels
107 //- and optional region index (0 if unspecified)
108 inline labelledTri
109 (
110 const labelUList& list,
111 const FixedList<label, 3>& triIndices,
112 const label region = 0
113 );
114
115 //- Copy construct from a subset of point labels
116 //- with region index from input labelledTri
117 inline labelledTri
118 (
119 const labelUList& list,
120 const labelledTri& triIndices
121 );
122
123 //- Construct from Istream
124 inline labelledTri(Istream& is);
125
126
127 // Member Functions
128
129 //- Return the index (eg, the region)
130 label index() const noexcept
131 {
132 return index_;
133 }
134
135 //- Non-const access to the index (eg, the region)
136 label& index() noexcept
137 {
138 return index_;
139 }
140
141 //- Set the index (eg, the region)
142 void setIndex(const label idx) noexcept
143 {
144 index_ = idx;
145 }
146
147 //- Return the region index
148 label region() const noexcept
149 {
150 return index_;
151 }
152
153 //- Non-const access to the region index
154 label& region() noexcept
156 return index_;
157 }
158
159
160 // IOstream Operators
161
164};
165
166
167// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
168
169//- Contiguous data for labelledTri
170template<> struct is_contiguous<labelledTri> : std::true_type {};
172//- Contiguous label data for labelledTri
173template<> struct is_contiguous_label<labelledTri> : std::true_type {};
174
175
176//- Specialization to offset faces, used in ListListOps::combineOffset
177template<>
178struct offsetOp<labelledTri>
180 labelledTri operator()(const labelledTri& x, const label offset) const
181 {
182 labelledTri f(x);
183 f += offset;
184 return f;
185 }
186};
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#include "labelledTriI.H"
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#endif
200
201// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition FixedList.H:73
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A triFace with additional (region) index.
Definition labelledTri.H:56
labelledTri()
Default construct, with invalid point labels and region (-1).
friend Istream & operator>>(Istream &, labelledTri &)
void setIndex(const label idx) noexcept
Set the index (eg, the region).
label & index() noexcept
Non-const access to the index (eg, the region).
label index() const noexcept
Return the index (eg, the region).
friend Ostream & operator<<(Ostream &, const labelledTri &)
label region() const noexcept
Return the region index.
label & region() noexcept
Non-const access to the region index.
triFace()
Default construct, with invalid vertex labels (-1).
Definition triFaceI.H:56
triPointRef tri(const UList< point > &points) const
Return the triangle.
Definition triFaceI.H:167
const volScalarField & p0
Definition EEqn.H:36
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
labelList f(nPoints)
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 that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70
labelledTri operator()(const labelledTri &x, const label offset) const
Offset operator for ListListOps::combineOffset().
T operator()(const T &x, const label offset) const