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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::surfZoneIdentifier
29
30Description
31 Identifies a surface patch/zone by name and index,
32 with optional geometric type.
33
34SeeAlso
35 patchIdentifier
36
37SourceFiles
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
50namespace Foam
51{
52
53// Forward Declarations
54class dictionary;
55
56/*---------------------------------------------------------------------------*\
57 Class surfZoneIdentifier Declaration
58\*---------------------------------------------------------------------------*/
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
73public:
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
186bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
187
188//- Compare zone indentifiers for inequality
189bool operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
190
191
192//- Read name, geometricType
193Istream& operator>>(Istream& is, surfZoneIdentifier& obj);
194
195//- Write name, geometricType. Entries are quoted to support empty words.
196Ostream& operator<<(Ostream& os, const surfZoneIdentifier& obj);
197
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201} // End namespace Foam
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#endif
206
207// ************************************************************************* //
label n
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Identifies a surface patch/zone by name and index, with optional geometric type.
surfZoneIdentifier()
Default construct. Uses name="", index=0.
word & name()
Modifiable patch/zone name.
label index() const
The index of this patch/zone in the surface mesh.
const word & name() const
The patch/zone name.
static constexpr const char *const emptyType
The name for an 'empty' type.
word & geometricType()
Modifiable geometric type of the patch/zone.
label & index()
Modifiable index of this patch/zone in the surface mesh.
const word & geometricType() const
The geometric type of the patch/zone.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
surfZoneIdentifier & operator=(const surfZoneIdentifier &)=default
Copy assignment.
surfZoneIdentifier(const surfZoneIdentifier &)=default
Copy construct.
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:239
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
runTime write()
dictionary dict
volScalarField & b
Definition: createFields.H:27