geometricSurfacePatch.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 OpenFOAM Foundation
9  Copyright (C) 2017-2020 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::geometricSurfacePatch
29 
30 Description
31  The geometricSurfacePatch is like patchIdentifier but for surfaces.
32  Holds type, name and index.
33 
34 SourceFiles
35  geometricSurfacePatch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef geometricSurfacePatch_H
40 #define geometricSurfacePatch_H
41 
42 #include "surfZoneIdentifier.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class geometricSurfacePatch Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 {
55  // Private Data
56 
57  //- Name of patch
58  word name_;
59 
60  //- Index of patch in boundary
61  label index_;
62 
63  //- Type name of patch
64  word geometricType_;
65 
66 public:
67 
68  // Public Data
69 
70  //- The name for an 'empty' type
71  static constexpr const char* const emptyType = "empty";
72 
73 
74  // Static Member Functions
75 
76  //- Default patch name: "patch" or "patchN"
77  static word defaultName(const label n = -1)
78  {
79  return
80  (
81  n < 0
82  ? word("patch", false)
83  : word("patch" + std::to_string(n), false)
84  );
85  }
86 
87 
88  // Public Classes
89 
90  //- Helper to convert identifier types as an operation
91  struct fromIdentifier
92  {
94  operator()(const surfZoneIdentifier& ident) const
95  {
96  return geometricSurfacePatch(ident);
97  }
98  };
99 
100 
101  // Generated Methods
102 
103  //- Copy construct
105 
106  //- Copy assignment
108  operator=(const geometricSurfacePatch&) = default;
109 
110 
111  // Constructors
112 
113  //- Default construct, use index=0, name="patch"
115 
116  //- Construct null with specified index
117  explicit geometricSurfacePatch(const label index);
118 
119  //- Construct from mandatory components
120  geometricSurfacePatch(const word& name, const label index);
121 
122  //- Construct from components
124  (
125  const word& name,
126  const label index,
127  const word& geometricType
128  );
129 
130  //- Construct from dictionary
132  (
133  const word& name,
134  const dictionary& dict,
135  const label index
136  );
137 
138  //- Implicit conversion from surfZoneIdentifier
140 
141 
142  // Member Functions
143 
144  //- The patch/zone name
145  const word& name() const
146  {
147  return name_;
148  }
149 
150  //- Modifiable patch/zone name
151  word& name()
152  {
153  return name_;
154  }
155 
156  //- The geometric type of the patch/zone
157  const word& geometricType() const
158  {
159  return geometricType_;
160  }
161 
162  //- Modifiable geometric type of the patch/zone
164  {
165  return geometricType_;
166  }
167 
168  //- The index of this patch/zone in the surface mesh
169  label index() const
170  {
171  return index_;
172  }
173 
174  //- Modifiable index of this patch/zone in the surface mesh
175  label& index()
176  {
177  return index_;
178  }
179 
180  //- Write (geometricType) dictionary entry
181  //- (without surrounding braces)
182  // \warning Prior to 2020-01 was identical to operator<< output
183  void write(Ostream& os) const;
184 
185 
186  // Housekeeping
187 
188  //- Removed(2020-01) Construct from Istream
189  // \deprecated(2020-01) - unused, inconsistent
190  geometricSurfacePatch(Istream& is, const label index) = delete;
191 
192  //- Deprecated(2020-01) Construct from components
193  // \deprecated(2020-01) - order inconsistent with other identifiers
194  FOAM_DEPRECATED(2020-01)
196  (
197  const word& geometricType,
198  const word& name,
199  const label index
200  );
201 
202  //- Deprecated(2020-01) Write dictionary
203  // \deprecated(2020-01) - Write dictionary
204  FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
205  void writeDict(Ostream& os) const
206  {
207  write(os);
208  }
209 };
210 
211 
212 // Global Operators
213 
214 //- Compare patches for equality
215 bool operator==(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
216 
217 //- Compare patches for inequality
218 bool operator!=(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
219 
220 
221 //- Read name, geometricType
222 Istream& operator>>(Istream& is, geometricSurfacePatch& obj);
223 
224 //- Write name, geometricType. Entries are quoted to support empty words.
225 Ostream& operator<<(Ostream& os, const geometricSurfacePatch& obj);
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
Foam::geometricSurfacePatch::index
label index() const
The index of this patch/zone in the surface mesh.
Definition: geometricSurfacePatch.H:168
Foam::geometricSurfacePatch::name
word & name()
Modifiable patch/zone name.
Definition: geometricSurfacePatch.H:150
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::geometricSurfacePatch
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index.
Definition: geometricSurfacePatch.H:52
Foam::geometricSurfacePatch::geometricSurfacePatch
geometricSurfacePatch()
Default construct, use index=0, name="patch".
Definition: geometricSurfacePatch.C:57
Foam::geometricSurfacePatch::defaultName
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
Definition: geometricSurfacePatch.H:76
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
surfZoneIdentifier.H
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:59
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::geometricSurfacePatch::geometricType
const word & geometricType() const
The geometric type of the patch/zone.
Definition: geometricSurfacePatch.H:156
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::geometricSurfacePatch::write
void write(Ostream &os) const
Definition: geometricSurfacePatch.C:122
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::geometricSurfacePatch::fromIdentifier::operator()
geometricSurfacePatch operator()(const surfZoneIdentifier &ident) const
Definition: geometricSurfacePatch.H:93
Foam::geometricSurfacePatch::index
label & index()
Modifiable index of this patch/zone in the surface mesh.
Definition: geometricSurfacePatch.H:174
FOAM_DEPRECATED
#define FOAM_DEPRECATED(since)
Definition: stdFoam.H:65
Foam::geometricSurfacePatch::fromIdentifier
Helper to convert identifier types as an operation.
Definition: geometricSurfacePatch.H:90
Foam::geometricSurfacePatch::emptyType
static constexpr const char *const emptyType
The name for an 'empty' type.
Definition: geometricSurfacePatch.H:70
Foam::FOAM_DEPRECATED_FOR
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:69
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::geometricSurfacePatch::geometricType
word & geometricType()
Modifiable geometric type of the patch/zone.
Definition: geometricSurfacePatch.H:162
Foam::geometricSurfacePatch::writeDict
void writeDict(Ostream &os) const
Deprecated(2020-01) Write dictionary.
Definition: geometricSurfacePatch.H:204
Foam::geometricSurfacePatch::name
const word & name() const
The patch/zone name.
Definition: geometricSurfacePatch.H:144
Foam::geometricSurfacePatch::operator=
geometricSurfacePatch & operator=(const geometricSurfacePatch &)=default
Copy assignment.