Loading...
Searching...
No Matches
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-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::geometricSurfacePatch
29
30Description
31 Identifies a surface patch/zone by name and index,
32 with geometric type.
33
34SourceFiles
35 geometricSurfacePatch.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_geometricSurfacePatch_H
40#define Foam_geometricSurfacePatch_H
41
42#include "surfZoneIdentifier.H"
43#include "stdFoam.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class geometricSurfacePatch Declaration
52\*---------------------------------------------------------------------------*/
53
55{
56 // Private Data
57
58 //- Patch/zone name
59 word name_;
60
61 //- Patch/zone index in meshed surface
62 label index_;
63
64 //- Patch/zone type
65 word geometricType_;
66
67public:
68
69 // Public Data
70
71 //- The name for an 'empty' type
72 static constexpr const char* const emptyType = "empty";
73
74
75 // Static Member Functions
76
77 //- Default patch name: "patch" or "patchN"
78 static word defaultName(const label n = -1)
79 {
80 return
81 (
82 n < 0
83 ? word("patch", false)
84 : word("patch" + std::to_string(n), false)
85 );
86 }
87
88
89 // Public Classes
90
91 //- Helper to convert identifier types as an operation
92 struct fromIdentifier
93 {
94 geometricSurfacePatch operator()
95 (
96 const surfZoneIdentifier& ident
97 ) const
98 {
99 return geometricSurfacePatch(ident);
100 }
101 };
102
103
104 // Generated Methods
105
106 //- Copy construct
108
109 //- Move construct
111
112 //- Copy assignment
114 operator=(const geometricSurfacePatch&) = default;
115
116 //- Move assignment
118 operator=(geometricSurfacePatch&&) = default;
119
120
121 // Constructors
122
123 //- Default construct.
124 //- Uses name="patch", index=0, type=""
126
127 //- Construct null with specified index.
128 //- Uses name="patch", type=""
129 explicit geometricSurfacePatch(const label index);
130
131 //- Construct from mandatory components, type=""
132 geometricSurfacePatch(const word& name, const label index);
134 //- Construct from components
136 (
137 const word& name,
138 const label index,
139 const word& geometricType
140 );
141
142 //- Construct from dictionary
144 (
145 const word& name,
146 const dictionary& dict,
147 const label index
148 );
149
150 //- Implicit conversion from surfZoneIdentifier
152
153
154 // Member Functions
155
156 //- The patch/zone name
157 const word& name() const noexcept { return name_; }
158
159 //- Modifiable patch/zone name
160 word& name() noexcept { return name_; }
161
162 //- The index of this patch/zone in the surface mesh
163 label index() const noexcept { return index_; }
164
165 //- Modifiable index of this patch/zone in the surface mesh
166 label& index() noexcept { return index_; }
167
168 //- The geometric type of the patch/zone
169 const word& geometricType() const noexcept { return geometricType_; }
170
171 //- Modifiable geometric type of the patch/zone
172 word& geometricType() noexcept { return geometricType_; }
173
174 //- Write (geometricType) dictionary entry
175 //- (without surrounding braces)
176 // \warning Prior to 2020-01 was identical to operator<< output
177 void write(Ostream& os) const;
178
179
180 // Housekeeping
181
182 //- Removed(2020-01) Construct from Istream
183 // \deprecated(2020-01) - unused, inconsistent
184 geometricSurfacePatch(Istream& is, const label index) = delete;
185
186 //- Deprecated(2020-01) Construct from components
187 // \deprecated(2020-01) - order inconsistent with other identifiers
188 FOAM_DEPRECATED_FOR(2020-01, "construct name/index/type")
190 (
192 const word& name,
193 const label index
194 )
195 :
197 {}
198
199 //- Deprecated(2020-01) Write dictionary
200 // \deprecated(2020-01) - Write dictionary
201 FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
202 void writeDict(Ostream& os) const
203 {
204 write(os);
205 }
207
208
209// Global Operators
210
211//- Compare patches for equality
213
214//- Compare patches for inequality
216
217
218//- Read name, geometricType
220
221//- Write name, geometricType. Entries are quoted to support empty words.
223
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227} // End namespace Foam
228
229// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230
231#endif
232
233// ************************************************************************* //
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 geometric type.
word & name() noexcept
Modifiable patch/zone name.
geometricSurfacePatch()
Default construct. Uses name="patch", index=0, type="".
const word & geometricType() const noexcept
The geometric type of the patch/zone.
geometricSurfacePatch(Istream &is, const label index)=delete
Removed(2020-01) Construct from Istream.
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.
geometricSurfacePatch(geometricSurfacePatch &&)=default
Move construct.
geometricSurfacePatch & operator=(geometricSurfacePatch &&)=default
Move assignment.
const word & name() const noexcept
The patch/zone name.
void writeDict(Ostream &os) const
Deprecated(2020-01) Write dictionary.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
word & geometricType() noexcept
Modifiable geometric type of the patch/zone.
geometricSurfacePatch & operator=(const geometricSurfacePatch &)=default
Copy assignment.
geometricSurfacePatch(const geometricSurfacePatch &)=default
Copy construct.
Identifies a surface patch/zone by name and index, with optional geometric type.
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
Includes some common C++ headers, defines global macros and templates used in multiple places by Open...
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43
Helper to convert identifier types as an operation.