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-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::labelledTri
29 
30 Description
31  Triangle with additional region number.
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 Istream& operator>>(Istream&, labelledTri&);
52 Ostream& operator<<(Ostream&, const labelledTri&);
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class labelledTri Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class labelledTri
60 :
61  public triFace
62 {
63  // Private data
64 
65  label region_;
66 
67 
68  // Private Member Functions
69 
70  //- Assign from a list of 3 or 4 labels.
71  // Default region is 0.
72  inline void assign(const labelUList&);
73 
74 public:
75 
76  // Constructors
77 
78  //- Construct null with invalid point labels and region (-1).
79  inline labelledTri();
80 
81  //- Construct from triFace and region label.
82  // Default region is 0 if not specified.
83  inline labelledTri
84  (
85  const triFace&,
86  const label region = 0
87  );
88 
89  //- Construct from three point labels and a region label.
90  // Default region is 0 if not specified.
91  inline labelledTri
92  (
93  const label a,
94  const label b,
95  const label c,
96  const label region = 0
97  );
98 
99  //- Construct from a list of 3 or 4 labels.
100  // Default region is 0.
101  inline explicit labelledTri(const labelUList&);
102 
103  //- Construct from an initializer list of 3 or 4 labels.
104  inline explicit labelledTri(std::initializer_list<label>);
105 
106  //- Construct from Istream
107  inline labelledTri(Istream&);
108 
109 
110  // Member Functions
111 
112  // Access
113 
114  //- Return region label
115  inline label region() const;
116 
117  //- Return region label
118  inline label& region();
119 
120 
121  // IOstream Operators
122 
123  inline friend Istream& operator>>(Istream&, labelledTri&);
124  inline friend Ostream& operator<<(Ostream&, const labelledTri&);
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
129 
130 //- Contiguous data for labelledTri
131 template<> struct is_contiguous<labelledTri> : std::true_type {};
132 
133 //- Contiguous label data for labelledTri
134 template<> struct is_contiguous_label<labelledTri> : std::true_type {};
135 
136 
137 //- Specialization to offset faces, used in ListListOps::combineOffset
138 template<>
139 struct offsetOp<labelledTri>
140 {
141  inline labelledTri operator()
142  (
143  const labelledTri& x,
144  const label offset
145  ) const
146  {
147  labelledTri result(x);
148 
149  forAll(x, xI)
150  {
151  result[xI] = x[xI] + offset;
152  }
153  return result;
154  }
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #include "labelledTriI.H"
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
ListListOps.H
Foam::labelledTri::operator>>
friend Istream & operator>>(Istream &, labelledTri &)
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
triFace.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
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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::labelledTri::region
label region() const
Return region label.
Definition: labelledTriI.H:113
Foam::labelledTri::labelledTri
labelledTri()
Construct null with invalid point labels and region (-1).
Definition: labelledTriI.H:56
Foam::offsetOp
Offset operator for ListListOps::combineOffset()
Definition: ListListOps.H:101
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
labelledTriI.H
Foam::triFace
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:70
Foam::UList< label >
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::labelledTri
Triangle with additional region number.
Definition: labelledTri.H:58
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::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75