FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/word.H>
41 #include <OpenFOAM/label.H>
42 #include <OpenFOAM/className.H>
44 #include <OpenFOAM/autoPtr.H>
45 #include <OpenFOAM/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
116  {
117  notImplemented("autoPtr<surfZone> clone() const");
118  return autoPtr<surfZone>(NULL);
119  }
120 
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 // ************************ vim: set sw=4 sts=4 et: ************************ //