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 -------------------------------------------------------------------------------
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::labelledTri
29 
30 Description
31  A triFace with additional (region) index.
32 
33 SourceFiles
34  labelledTriI.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef labelledTri_H
39 #define labelledTri_H
40 
41 #include "triFace.H"
42 #include "ListListOps.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class labelledTri;
51 inline Istream& operator>>(Istream&, labelledTri&);
52 inline Ostream& operator<<(Ostream&, const labelledTri&);
53 
54 /*---------------------------------------------------------------------------*\
55  Class labelledTri Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class 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 
75 public:
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 a,
95  const label b,
96  const label c,
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  //- Construct from Istream
107  inline labelledTri(Istream& is);
108 
109 
110  // Member Functions
111 
112  //- Return the index (eg, the region)
113  label index() const noexcept
114  {
115  return index_;
116  }
117 
118  //- Non-const access to the index (eg, the region)
119  label& index() noexcept
120  {
121  return index_;
122  }
123 
124  //- Set the index (eg, the region)
125  void setIndex(const label idx) noexcept
126  {
127  index_ = idx;
128  }
129 
130  //- Return the region index
131  label region() const noexcept
132  {
133  return index_;
134  }
135 
136  //- Non-const access to the region index
137  label& region() noexcept
138  {
139  return index_;
140  }
141 
142 
143  // IOstream Operators
144 
146  friend Ostream& operator<<(Ostream&, const labelledTri&);
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
151 
152 //- Contiguous data for labelledTri
153 template<> struct is_contiguous<labelledTri> : std::true_type {};
154 
155 //- Contiguous label data for labelledTri
156 template<> struct is_contiguous_label<labelledTri> : std::true_type {};
157 
158 
159 //- Specialization to offset faces, used in ListListOps::combineOffset
160 template<>
161 struct offsetOp<labelledTri>
162 {
163  labelledTri operator()(const labelledTri& x, const label offset) const
164  {
165  labelledTri result(x);
166 
167  forAll(x, xi)
168  {
169  result[xi] = x[xi] + offset;
170  }
171  return result;
172  }
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #include "labelledTriI.H"
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
Foam::labelledTri::region
label & region() noexcept
Non-const access to the region index.
Definition: labelledTri.H:136
Foam::labelledTri::setIndex
void setIndex(const label idx) noexcept
Set the index (eg, the region)
Definition: labelledTri.H:124
Foam::offsetOp< labelledTri >::operator()
labelledTri operator()(const labelledTri &x, const label offset) const
Definition: labelledTri.H:162
ListListOps.H
Foam::labelledTri::operator>>
friend Istream & operator>>(Istream &, labelledTri &)
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
triFace.H
Foam::triFace::tri
triPointRef tri(const UList< point > &points) const
Return the triangle.
Definition: triFaceI.H:165
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::offsetOp::operator()
T operator()(const T &x, const label offset) const
Definition: ListListOps.H:103
Foam::labelledTri::index
label index() const noexcept
Return the index (eg, the region)
Definition: labelledTri.H:112
Foam::labelledTri::labelledTri
labelledTri()
Default construct, with invalid point labels and region (-1).
Definition: labelledTriI.H:60
Foam::offsetOp
Offset operator for ListListOps::combineOffset()
Definition: ListListOps.H:101
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::labelledTri::index
label & index() noexcept
Non-const access to the index (eg, the region)
Definition: labelledTri.H:118
labelledTriI.H
Foam::triFace
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:69
Foam::UList< label >
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::labelledTri
A triFace with additional (region) index.
Definition: labelledTri.H:57
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::labelledTri::operator<<
friend Ostream & operator<<(Ostream &, const labelledTri &)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
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::labelledTri::region
label region() const noexcept
Return the region index.
Definition: labelledTri.H:130