surfZone.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::surfZone
26 
27 Description
28  A surface zone on a MeshedSurface.
29 
30  Similar in concept to a faceZone, but the face list is contiguous.
31 
32 SourceFiles
33  surfZone.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef surfZone_H
38 #define surfZone_H
39 
40 #include "word.H"
41 #include "label.H"
42 #include "className.H"
43 #include "surfZoneIdentifier.H"
44 #include "autoPtr.H"
45 #include "dictionary.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of friend functions and operators
53 
54 class surfZone;
55 
56 Istream& operator>>(Istream&, surfZone&);
57 Ostream& operator<<(Ostream&, const surfZone&);
58 
59 /*---------------------------------------------------------------------------*\
60  Class surfZone Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class surfZone
64 :
65  public surfZoneIdentifier
66 {
67  // Private Data
68 
69  //- Size of this group in the face list
70  label size_;
71 
72  //- Start label of this group in the face list
73  label start_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  ClassName("surfZone");
80 
81 
82  // Constructors
83 
84  //- Construct null
85  surfZone();
86 
87  //- Construct from components
88  surfZone
89  (
90  const word& name,
91  const label size,
92  const label start,
93  const label index,
95  );
96 
97  //- Construct from Istream
98  surfZone(Istream& is, const label index);
99 
100  //- Construct from dictionary
101  surfZone
102  (
103  const word& name,
104  const dictionary& dict,
105  const label index
106  );
107 
108  //- Construct from another zone, resetting the index
109  surfZone(const surfZone&, const label index);
110 
111  //- Return clone
112  autoPtr<surfZone> clone() const
113  {
115  return autoPtr<surfZone>(nullptr);
116  }
118  static autoPtr<surfZone> New(Istream& is)
119  {
120  word name(is);
121  dictionary dict(is);
122 
123  return autoPtr<surfZone>(new surfZone(name, dict, 0));
124  }
125 
126 
127  // Member Functions
128 
129  //- Return start label of this zone in the face list
130  label start() const
131  {
132  return start_;
133  }
134 
135  //- Return start label of this zone in the face list
136  label& start()
137  {
138  return start_;
139  }
140 
141  //- Return size of this zone in the face list
142  label size() const
143  {
144  return size_;
145  }
146 
147  //- Return size of this zone in the face list
148  label& size()
149  {
150  return size_;
151  }
152 
153  //- Write
154  void write(Ostream&) const;
155 
156  //- Write dictionary
157  void writeDict(Ostream&) const;
158 
159 
160  // Member Operators
161 
162  bool operator!=(const surfZone&) const;
163 
164  //- compare.
165  bool operator==(const surfZone&) const;
166 
167 
168  // IOstream Operators
169 
170  friend Istream& operator>>(Istream&, surfZone&);
171  friend Ostream& operator<<(Ostream&, const surfZone&);
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
bool operator==(const surfZone &) const
compare.
Definition: surfZone.C:126
dictionary dict
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:59
An identifier for a surface zone on a meshed surface.
ClassName("surfZone")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const word & name() const
Return name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A surface zone on a MeshedSurface.
Definition: surfZone.H:62
const word & geometricType() const
Return the geometric type of the zone.
label size() const
Return size of this zone in the face list.
Definition: surfZone.H:141
label index() const
Return the index of this zone in the surface mesh.
surfZone()
Construct null.
Definition: surfZone.C:40
void writeDict(Ostream &) const
Write dictionary.
Definition: surfZone.C:105
friend Ostream & operator<<(Ostream &, const surfZone &)
A class for handling words, derived from string.
Definition: word.H:59
Istream & operator>>(Istream &, directionInfo &)
static const word null
An empty word.
Definition: word.H:77
friend Istream & operator>>(Istream &, surfZone &)
bool operator!=(const surfZone &) const
Definition: surfZone.C:120
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void write(Ostream &) const
Write.
Definition: surfZone.C:99
static autoPtr< surfZone > New(Istream &is)
Definition: surfZone.H:117
label start() const
Return start label of this zone in the face list.
Definition: surfZone.H:129
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Ostream & operator<<(Ostream &, const ensightPart &)
autoPtr< surfZone > clone() const
Return clone.
Definition: surfZone.H:111
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
Namespace for OpenFOAM.