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-2019 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 "word.H"
44 #include "label.H"
45 #include "className.H"
46 #include "surfZoneIdentifier.H"
47 #include "labelRange.H"
48 #include "autoPtr.H"
49 #include "dictionary.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declarations
57 class surfZone;
58 
59 Istream& operator>>(Istream&, surfZone&);
60 Ostream& operator<<(Ostream&, const surfZone&);
61 
62 /*---------------------------------------------------------------------------*\
63  Class surfZone Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class surfZone
67 :
68  public surfZoneIdentifier
69 {
70  // Private data
71 
72  //- Size of this group in the face list
73  label size_;
74 
75  //- Start label of this group in the face list
76  label start_;
77 
78 
79 public:
80 
81  //- Runtime type information
82  ClassName("surfZone");
83 
84 
85  // Constructors
86 
87  //- Construct null with zero start, size, index
88  surfZone();
89 
90  //- Construct with name, size. With zero start, index
91  surfZone(const word& name, const label size);
92 
93  //- Construct from components
94  surfZone
95  (
96  const word& name,
97  const label size,
98  const label start,
99  const label index,
100  const word& geometricType = word::null
101  );
102 
103  //- Construct from Istream
104  surfZone(Istream& is, const label index);
105 
106  //- Construct from dictionary
107  surfZone
108  (
109  const word& name,
110  const dictionary& dict,
111  const label index
112  );
113 
114  //- Construct as copy
115  surfZone(const surfZone&);
116 
117  //- Construct from another zone, resetting the index
118  surfZone(const surfZone&, const label index);
119 
120  //- Return clone
121  autoPtr<surfZone> clone() const
122  {
124  return nullptr;
125  }
126 
127  static autoPtr<surfZone> New(Istream& is)
128  {
129  word name(is);
130  dictionary dict(is);
131 
132  return autoPtr<surfZone>::New(name, dict, 0);
133  }
134 
135 
136  // Member Functions
137 
138  //- Return start label of this zone in the face list
139  label start() const
140  {
141  return start_;
142  }
143 
144  //- Return start label of this zone in the face list
145  label& start()
146  {
147  return start_;
148  }
149 
150  //- Return size of this zone in the face list
151  label size() const
152  {
153  return size_;
154  }
155 
156  //- Return size of this zone in the face list
157  label& size()
158  {
159  return size_;
160  }
161 
162  //- Return start/size range of this zone
163  labelRange range() const
164  {
165  return labelRange(start_, size_);
166  }
167 
168  //- Write
169  void write(Ostream&) const;
170 
171  //- Write dictionary
172  void writeDict(Ostream&) const;
173 
174 
175  // Member Operators
176 
177  bool operator!=(const surfZone&) const;
178 
179  //- compare.
180  bool operator==(const surfZone&) const;
181 
182 
183  // IOstream Operators
184 
185  friend Istream& operator>>(Istream&, surfZone&);
186  friend Ostream& operator<<(Ostream&, const surfZone&);
187 };
188 
189 
190 // Global Functions
191 
192 //- The labelRange of a surfZone
193 template<>
194 struct labelRangeOp<surfZone>
195 {
196  labelRange operator()(const surfZone& zone) const
197  {
198  return zone.range();
199  }
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::surfZone::start
label start() const
Return start label of this zone in the face list.
Definition: surfZone.H:138
Foam::surfZone::New
static autoPtr< surfZone > New(Istream &is)
Definition: surfZone.H:126
Foam::surfZone::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: surfZone.C:124
Foam::surfZone::surfZone
surfZone()
Construct null with zero start, size, index.
Definition: surfZone.C:43
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfZone::write
void write(Ostream &) const
Write.
Definition: surfZone.C:118
Foam::surfZone::range
labelRange range() const
Return start/size range of this zone.
Definition: surfZone.H:162
Foam::surfZone::operator>>
friend Istream & operator>>(Istream &, surfZone &)
Foam::zone
Base class for mesh zones.
Definition: zone.H:63
Foam::surfZone::size
label & size()
Return size of this zone in the face list.
Definition: surfZone.H:156
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::surfZoneIdentifier::index
label index() const
Return the index of this patch/zone in the surface mesh.
Definition: surfZoneIdentifier.H:143
Foam::surfZone::operator<<
friend Ostream & operator<<(Ostream &, const surfZone &)
surfZoneIdentifier.H
Foam::surfZoneIdentifier
Identifies a surface patch/zone by name, patch index and geometricType.
Definition: surfZoneIdentifier.H:58
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:419
Foam::labelRangeOp< surfZone >::operator()
labelRange operator()(const surfZone &zone) const
Definition: surfZone.H:195
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:58
Foam::surfZone::start
label & start()
Return start label of this zone in the face list.
Definition: surfZone.H:144
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::labelRangeOp
Conversion/extraction to labelRange operation (functor).
Definition: labelRange.H:338
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
Return size of this zone in the face list.
Definition: surfZone.H:150
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfZone::ClassName
ClassName("surfZone")
Runtime type information.
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:120
Foam::surfZoneIdentifier::geometricType
const word & geometricType() const
Return the geometric type of the patch/zone.
Definition: surfZoneIdentifier.H:131
Foam::surfZone::operator!=
bool operator!=(const surfZone &) const
Definition: surfZone.C:138
Foam::surfZone::operator==
bool operator==(const surfZone &) const
compare.
Definition: surfZone.C:144
labelRange.H
label.H
Foam::surfZone
A surface zone on a MeshedSurface.
Definition: surfZone.H:65
dictionary.H
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::surfZoneIdentifier::name
const word & name() const
Return name.
Definition: surfZoneIdentifier.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
autoPtr.H