surfZoneIdentifier.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) 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::surfZoneIdentifier
29 
30 Description
31  Identifies a surface patch/zone by name and index,
32  with optional geometric type.
33 
34 SeeAlso
35  patchIdentifier
36 
37 SourceFiles
38  surfZoneIdentifier.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef surfZoneIdentifier_H
43 #define surfZoneIdentifier_H
44 
45 #include "word.H"
46 #include "label.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class dictionary;
55 
56 /*---------------------------------------------------------------------------*\
57  Class surfZoneIdentifier Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62  // Private Data
63 
64  //- Patch/zone name
65  word name_;
66 
67  //- Patch/zone index in meshed surface
68  label index_;
69 
70  //- Patch/zone type (optional)
71  word geometricType_;
72 
73 public:
74 
75  // Public Data
76 
77  //- The name for an 'empty' type
78  static constexpr const char* const emptyType = "empty";
79 
80 
81  // Static Member Functions
82 
83  //- Default zone name: "zone" or "zoneN"
84  static word defaultName(const label n = -1)
85  {
86  return
87  (
88  n < 0
89  ? word("zone", false)
90  : word("zone" + std::to_string(n), false)
91  );
92  }
93 
94 
95  // Generated Methods
96 
97  //- Copy construct
98  surfZoneIdentifier(const surfZoneIdentifier&) = default;
99 
100  //- Copy assignment
102 
103 
104  // Constructors
105 
106  //- Default construct. Uses name="", index=0
108 
109  //- Construct null with specified index
110  explicit surfZoneIdentifier(const label index);
111 
112  //- Construct from mandatory components
113  surfZoneIdentifier(const word& name, const label index);
114 
115  //- Construct from components
117  (
118  const word& name,
119  const label index,
120  const word& geometricType
121  );
122 
123  //- Construct from dictionary
125  (
126  const word& name,
127  const dictionary& dict,
128  const label index
129  );
130 
131  //- Copy construct, resetting the index
133  (
134  const surfZoneIdentifier& ident,
135  const label index
136  );
137 
138 
139  // Member Functions
140 
141  //- The patch/zone name
142  const word& name() const
143  {
144  return name_;
145  }
146 
147  //- Modifiable patch/zone name
148  word& name()
149  {
150  return name_;
151  }
152 
153  //- The geometric type of the patch/zone
154  const word& geometricType() const
155  {
156  return geometricType_;
157  }
158 
159  //- Modifiable geometric type of the patch/zone
161  {
162  return geometricType_;
163  }
164 
165  //- The index of this patch/zone in the surface mesh
166  label index() const
167  {
168  return index_;
169  }
170 
171  //- Modifiable index of this patch/zone in the surface mesh
172  label& index()
173  {
174  return index_;
175  }
176 
177  //- Write (geometricType) dictionary entry
178  //- (without surrounding braces)
179  void write(Ostream& os) const;
180 };
181 
182 
183 // Global Operators
184 
185 //- Compare zone indentifiers for equality
186 bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
187 
188 //- Compare zone indentifiers for inequality
189 bool operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
190 
191 
192 //- Read name, geometricType
193 Istream& operator>>(Istream& is, surfZoneIdentifier& obj);
194 
195 //- Write name, geometricType. Entries are quoted to support empty words.
196 Ostream& operator<<(Ostream& os, const surfZoneIdentifier& obj);
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
Foam::surfZoneIdentifier::write
void write(Ostream &os) const
Definition: surfZoneIdentifier.C:102
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::surfZoneIdentifier::operator=
surfZoneIdentifier & operator=(const surfZoneIdentifier &)=default
Copy assignment.
Foam::surfZoneIdentifier::name
word & name()
Modifiable patch/zone name.
Definition: surfZoneIdentifier.H:147
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::surfZoneIdentifier::index
label index() const
The index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:165
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name and index, with optional geometric type.
Definition: surfZoneIdentifier.H:59
Foam::surfZoneIdentifier::geometricType
word & geometricType()
Modifiable geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:159
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
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::surfZoneIdentifier::index
label & index()
Modifiable index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:171
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:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfZoneIdentifier::surfZoneIdentifier
surfZoneIdentifier()
Default construct. Uses name="", index=0.
Definition: surfZoneIdentifier.C:34
Foam::surfZoneIdentifier::defaultName
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
Definition: surfZoneIdentifier.H:83
Foam::surfZoneIdentifier::geometricType
const word & geometricType() const
The geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:153
label.H
Foam::surfZoneIdentifier::name
const word & name() const
The patch/zone name.
Definition: surfZoneIdentifier.H:141
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::surfZoneIdentifier::emptyType
static constexpr const char *const emptyType
The name for an 'empty' type.
Definition: surfZoneIdentifier.H:77