Loading...
Searching...
No Matches
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-2025 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 Foam_surfZoneIdentifier_H
43#define Foam_surfZoneIdentifier_H
44
45#include "word.H"
46#include "label.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53// Forward Declarations
54class dictionary;
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
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 //- Move construct
102
103 //- Copy assignment
106 //- Move assignment
108
109
110 // Constructors
111
112 //- Default construct. Uses name="", index=0
114
115 //- Construct with name="" and specified index
116 explicit surfZoneIdentifier(const label index);
117
118 //- Construct from mandatory components
119 surfZoneIdentifier(const word& name, const label index);
121 //- Construct from components
123 (
124 const word& name,
125 const label index,
126 const word& geometricType
127 );
128
129 //- Construct from dictionary
131 (
132 const word& name,
133 const dictionary& dict,
134 const label index
135 );
136
137 //- Copy construct, resetting the index (if non-negative)
139 (
140 const surfZoneIdentifier& ident,
141 const label newIndex
142 );
143
144 //- Move construct, resetting the index (if non-negative)
146 (
147 surfZoneIdentifier&& ident,
148 const label newIndex
149 );
150
151
152 // Member Functions
153
154 //- The patch/zone name
155 const word& name() const noexcept { return name_; }
156
157 //- Modifiable patch/zone name
158 word& name() noexcept { return name_; }
159
160 //- The (optional) geometric type of the patch/zone
161 const word& geometricType() const noexcept { return geometricType_; }
162
163 //- Modifiable (optional) geometric type of the patch/zone
164 word& geometricType() noexcept { return geometricType_; }
165
166 //- The index of this patch/zone in the surface mesh
167 label index() const noexcept { return index_; }
168
169 //- Modifiable index of this patch/zone in the surface mesh
170 label& index() noexcept { return index_; }
171
172 //- Write (geometricType) dictionary entry
173 //- (without surrounding braces)
174 void write(Ostream& os) const;
175};
176
177
178// Global Operators
179
180//- Compare zone indentifiers for equality
182
183//- Compare zone indentifiers for inequality
185
186
187//- Read name, geometricType
190//- Write name, geometricType. Entries are quoted to support empty words.
192
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196} // End namespace Foam
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200#endif
201
202// ************************************************************************* //
label n
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Identifies a surface patch/zone by name and index, with optional geometric type.
surfZoneIdentifier()
Default construct. Uses name="", index=0.
surfZoneIdentifier(surfZoneIdentifier &&)=default
Move construct.
word & name() noexcept
Modifiable patch/zone name.
const word & geometricType() const noexcept
The (optional) geometric type of the patch/zone.
static constexpr const char *const emptyType
The name for an 'empty' type.
label & index() noexcept
Modifiable index of this patch/zone in the surface mesh.
label index() const noexcept
The index of this patch/zone in the surface mesh.
const word & name() const noexcept
The patch/zone name.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
surfZoneIdentifier & operator=(surfZoneIdentifier &&)=default
Move assignment.
word & geometricType() noexcept
Modifiable (optional) geometric type of the patch/zone.
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:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
bool operator!=(const eddy &a, const eddy &b)
Definition eddy.H:297
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
const direction noexcept
Definition scalarImpl.H:265
runTime write()
dictionary dict
volScalarField & b