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 | Copyright (C) 2011-2016 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 as copy
109  surfZone(const surfZone&);
110 
111  //- Construct from another zone, resetting the index
112  surfZone(const surfZone&, const label index);
113 
114  //- Return clone
115  autoPtr<surfZone> clone() const
116  {
118  return autoPtr<surfZone>(nullptr);
119  }
121  static autoPtr<surfZone> New(Istream& is)
122  {
123  word name(is);
124  dictionary dict(is);
125 
126  return autoPtr<surfZone>(new surfZone(name, dict, 0));
127  }
128 
129 
130  // Member Functions
131 
132  //- Return start label of this zone in the face list
133  label start() const
134  {
135  return start_;
136  }
137 
138  //- Return start label of this zone in the face list
139  label& start()
140  {
141  return start_;
142  }
143 
144  //- Return size of this zone in the face list
145  label size() const
146  {
147  return size_;
148  }
149 
150  //- Return size of this zone in the face list
151  label& size()
152  {
153  return size_;
154  }
155 
156  //- Write
157  void write(Ostream&) const;
158 
159  //- Write dictionary
160  void writeDict(Ostream&) const;
161 
162 
163  // Member Operators
164 
165  bool operator!=(const surfZone&) const;
166 
167  //- compare.
168  bool operator==(const surfZone&) const;
169 
170 
171  // IOstream Operators
172 
173  friend Istream& operator>>(Istream&, surfZone&);
174  friend Ostream& operator<<(Ostream&, const surfZone&);
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
bool operator==(const surfZone &) const
compare.
Definition: surfZone.C:134
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:137
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:144
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:113
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:128
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:107
static autoPtr< surfZone > New(Istream &is)
Definition: surfZone.H:120
label start() const
Return start label of this zone in the face list.
Definition: surfZone.H:132
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Ostream & operator<<(Ostream &, const ensightPart &)
autoPtr< surfZone > clone() const
Return clone.
Definition: surfZone.H:114
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.