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