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 -------------------------------------------------------------------------------
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::surfZone
29 
30 Description
31  A surface zone on a MeshedSurface.
32 
33  Similar in concept to a faceZone, but the face list is contiguous.
34 
35 SourceFiles
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 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class surfZone Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class surfZone
58 :
59  public surfZoneIdentifier
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 
70 public:
71 
72  // Generated Methods
73 
74  //- Copy construct
75  surfZone(const surfZone&) = default;
76 
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
90  surfZone
91  (
92  const word& name,
93  const label size,
94  const label start,
95  const label index,
97  );
98 
99  //- Construct from dictionary
100  surfZone
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
111  autoPtr<surfZone> clone() const
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_;
132  }
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
154  {
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 
162 
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 
178 
179 // Global Operators
180 
181 //- Compare surfZones for equality
182 bool operator==(const surfZone& a, const surfZone& b);
183 
184 //- Compare surfZones for inequality
185 bool operator!=(const surfZone& a, const surfZone& b);
186 
187 
188 //- Read as dictionary
189 Istream& operator>>(Istream& is, surfZone& obj);
190 
191 //- Write as dictionary
192 Ostream& operator<<(Ostream&, const surfZone& obj);
193 
194 
195 // Global Functions
196 
197 //- The labelRange of a surfZone
198 template<>
199 struct labelRangeOp<surfZone>
200 {
201  labelRange operator()(const surfZone& zone) const
202  {
203  return zone.range();
204  }
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::surfZone::start
label start() const
The start label of this zone in the face list.
Definition: surfZone.H:128
Foam::surfZone::New
static autoPtr< surfZone > New(Istream &is)
Definition: surfZone.H:116
Foam::surfZone::surfZone
surfZone()
Default construct, with zero start, size, index.
Definition: surfZone.C:34
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfZone::range
labelRange range() const
The start/size range of this zone.
Definition: surfZone.H:152
Foam::zone
Base class for mesh zones.
Definition: zone.H:63
Foam::surfZone::size
label & size()
Modifiable size of this zone in the face list.
Definition: surfZone.H:146
Foam::surfZone::write
void write(Ostream &os) const
Write dictionary, includes surrounding braces.
Definition: surfZone.C:88
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
surfZoneIdentifier.H
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:59
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:445
Foam::labelRangeOp< surfZone >::operator()
labelRange operator()(const surfZone &zone) const
Definition: surfZone.H:200
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::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::surfZone::operator=
surfZone & operator=(const surfZone &)=default
Copy assignment.
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:55
Foam::surfZone::start
label & start()
Modifiable start label of this zone in the face list.
Definition: surfZone.H:134
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::labelRangeOp
Conversion/extraction to labelRange operation (functor).
Definition: labelRange.H:202
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::surfZone::size
label size() const
The size of this zone in the face list.
Definition: surfZone.H:140
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfZone::writeDict
void writeDict(Ostream &os) const
Deprecated(2020-01) Write dictionary.
Definition: surfZone.H:171
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::surfZone::clone
autoPtr< surfZone > clone() const
Return clone.
Definition: surfZone.H:110
Foam::surfZoneIdentifier::geometricType
const word & geometricType() const
The geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:153
labelRange.H
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:56
dictionary.H
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::FOAM_DEPRECATED_FOR
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:69
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
autoPtr.H