Loading...
Searching...
No Matches
surfZone.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-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2020 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::surfZone
29
30Description
31 A surface zone on a MeshedSurface.
32
33 Similar in concept to a faceZone, but the face list is contiguous.
34
35SourceFiles
36 surfZone.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef surfZone_H
41#define surfZone_H
42
43#include "surfZoneIdentifier.H"
44#include "labelRange.H"
45#include "autoPtr.H"
46#include "dictionary.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
53/*---------------------------------------------------------------------------*\
54 Class surfZone Declaration
55\*---------------------------------------------------------------------------*/
56
57class surfZone
58:
60{
61 // Private Data
62
63 //- Size of this group in the face list
64 label size_;
65
66 //- Start label of this group in the face list
67 label start_;
68
69
70public:
71
72 // Generated Methods
73
74 //- Copy construct
75 surfZone(const surfZone&) = default;
77 //- Copy assignment
78 surfZone& operator=(const surfZone&) = default;
79
80
81 // Constructors
82
83 //- Default construct, with zero start, size, index
84 surfZone();
85
86 //- Construct with name, size. With zero start, index
87 surfZone(const word& name, const label size);
88
89 //- Construct from components
91 (
92 const word& name,
93 const label size,
94 const label start,
95 const label index,
97 );
98
99 //- Construct from dictionary
101 (
102 const word& name,
103 const dictionary& dict,
104 const label index
105 );
106
107 //- Copy construct, resetting the index
108 surfZone(const surfZone&, const label index);
109
110 //- Return clone
112 {
114 return nullptr;
115 }
116
117 static autoPtr<surfZone> New(Istream& is)
118 {
119 const word name(is);
120 const dictionary dict(is);
121
122 return autoPtr<surfZone>::New(name, dict, 0);
123 }
124
125
126 // Member Functions
127
128 //- The start label of this zone in the face list
129 label start() const
130 {
131 return start_;
133
134 //- Modifiable start label of this zone in the face list
135 label& start()
136 {
137 return start_;
138 }
139
140 //- The size of this zone in the face list
141 label size() const
142 {
143 return size_;
144 }
145
146 //- Modifiable size of this zone in the face list
147 label& size()
148 {
149 return size_;
150 }
151
152 //- The start/size range of this zone
153 labelRange range() const
155 return labelRange(start_, size_);
156 }
157
158 //- Write dictionary, includes surrounding braces
159 // \warning Prior to 2020-01 was identical to operator<< output
160 void write(Ostream& os) const;
161
163 // Housekeeping
164
165 //- Removed(2020-01) Construct from Istream
166 // \deprecated(2020-01) - unused, inconsistent
167 surfZone(Istream& is, const label index) = delete;
168
169 //- Deprecated(2020-01) Write dictionary
170 // \deprecated(2020-01) - Write dictionary
171 FOAM_DEPRECATED_FOR(2020-01, "write() or operator<<")
172 void writeDict(Ostream& os) const
173 {
174 write(os);
175 }
176};
177
179// Global Operators
180
181//- Compare surfZones for equality
182bool operator==(const surfZone& a, const surfZone& b);
183
184//- Compare surfZones for inequality
185bool operator!=(const surfZone& a, const surfZone& b);
186
187
188//- Read as dictionary
190
191//- Write as dictionary
192Ostream& operator<<(Ostream&, const surfZone& obj);
193
194
195// Global Functions
196
197//- The labelRange of a surfZone
198template<>
200{
201 labelRange operator()(const surfZone& zone) const
202 {
203 return zone.range();
204 }
205};
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210} // End namespace Foam
211
212// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213
214#endif
215
216// ************************************************************************* //
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
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition autoPtr.H:178
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A range or interval of labels defined by a start and a size.
Definition labelRange.H:66
const word & geometricType() const noexcept
The (optional) geometric type of the patch/zone.
label index() const noexcept
The index of this patch/zone in the surface mesh.
const word & name() const noexcept
The patch/zone name.
surfZoneIdentifier(const surfZoneIdentifier &)=default
Copy construct.
A surface zone on a MeshedSurface.
Definition surfZone.H:55
autoPtr< surfZone > clone() const
Return clone.
Definition surfZone.H:126
surfZone()
Default construct, with zero start, size, index.
Definition surfZone.C:27
static autoPtr< surfZone > New(Istream &is)
Definition surfZone.H:132
surfZone & operator=(const surfZone &)=default
Copy assignment.
surfZone(Istream &is, const label index)=delete
Removed(2020-01) Construct from Istream.
label start() const
The start label of this zone in the face list.
Definition surfZone.H:146
label & start()
Modifiable start label of this zone in the face list.
Definition surfZone.H:154
label size() const
The size of this zone in the face list.
Definition surfZone.H:162
labelRange range() const
The start/size range of this zone.
Definition surfZone.H:178
surfZone(const surfZone &)=default
Copy construct.
void writeDict(Ostream &os) const
Deprecated(2020-01) Write dictionary.
Definition surfZone.H:206
label & size()
Modifiable size of this zone in the face list.
Definition surfZone.H:170
A class for handling words, derived from Foam::string.
Definition word.H:66
static const word null
An empty word.
Definition word.H:84
Base class for mesh zones.
Definition zone.H:63
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
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 &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
runTime write()
dictionary dict
volScalarField & b
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43
labelRange operator()(const surfZone &zone) const
Definition surfZone.H:245
Conversion/extraction to labelRange operation (functor).
Definition labelRange.H:300