pointZone.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 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::pointZone
26 
27 Description
28  A subset of mesh points.
29  The labels of points in the zone can be obtained from the addressing()
30  list.
31 
32  For quick check whether a point belongs to the zone use the lookup
33  mechanism in pointZoneMesh, where all the zoned points are registered
34  with their zone number.
35 
36 SourceFiles
37  pointZone.C
38  pointZoneNew.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef pointZone_H
43 #define pointZone_H
44 
45 #include "zone.H"
46 #include "pointZoneMeshFwd.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of friend functions and operators
54 
55 class pointZone;
56 Ostream& operator<<(Ostream&, const pointZone&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class pointZone Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class pointZone
64 :
65  public zone
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  //- Reference to zone list
73  const pointZoneMesh& zoneMesh_;
74 
75  // Private Member Functions
76 
77  //- Disallow default bitwise copy construct
78  pointZone(const pointZone&);
79 
80 public:
81 
82  // Static data members
83 
84  //- The name associated with the zone-labels dictionary entry
85  static const char * const labelsName;
86 
87 
88  //- Runtime type information
89  TypeName("pointZone");
90 
91 
92  // Declare run-time constructor selection tables
93 
95  (
96  autoPtr,
97  pointZone,
98  dictionary,
99  (
100  const word& name,
101  const dictionary& dict,
102  const label index,
103  const pointZoneMesh& zm
104  ),
105  (name, dict, index, zm)
106  );
107 
108 
109  // Constructors
110 
111  //- Construct from components
112  pointZone
113  (
114  const word& name,
115  const labelUList& addr,
116  const label index,
117  const pointZoneMesh&
118  );
119 
120  //- Construct from components, transferring contents
121  pointZone
122  (
123  const word& name,
124  const Xfer<labelList>& addr,
125  const label index,
126  const pointZoneMesh&
127  );
128 
129  //- Construct from dictionary
130  pointZone
131  (
132  const word& name,
133  const dictionary&,
134  const label index,
135  const pointZoneMesh&
136  );
137 
138  //- Construct given the original zone and resetting the
139  // point list and zone mesh information
140  pointZone
141  (
142  const pointZone&,
143  const labelUList& addr,
144  const label index,
145  const pointZoneMesh&
146  );
147 
148  //- Construct given the original zone, resetting the
149  // face list and zone mesh information
150  pointZone
151  (
152  const pointZone&,
153  const Xfer<labelList>& addr,
154  const label index,
155  const pointZoneMesh&
156  );
157 
158  //- Construct and return a clone, resetting the zone mesh
159  virtual autoPtr<pointZone> clone(const pointZoneMesh& zm) const
160  {
161  return autoPtr<pointZone>
162  (
163  new pointZone(*this, *this, index(), zm)
164  );
165  }
166 
167  //- Construct and return a clone, resetting the point list
168  // and zone mesh
170  (
171  const pointZoneMesh& zm,
172  const label index,
173  const labelUList& addr
174  ) const
175  {
176  return autoPtr<pointZone>
177  (
178  new pointZone(*this, addr, index, zm)
179  );
180  }
181 
182 
183  // Selectors
184 
185  //- Return a pointer to a new point zone
186  // created on freestore from dictionary
187  static autoPtr<pointZone> New
188  (
189  const word& name,
190  const dictionary&,
191  const label index,
192  const pointZoneMesh&
193  );
194 
195 
196  //- Destructor
197  virtual ~pointZone();
198 
199 
200  // Member Functions
201 
202  //- Return zoneMesh reference
203  const pointZoneMesh& zoneMesh() const;
204 
205  //- Helper function to re-direct to zone::localID(...)
206  label whichPoint(const label globalPointID) const;
207 
208  //- Check zone definition. Return true if in error.
209  virtual bool checkDefinition(const bool report = false) const;
210 
211  //- Check whether zone is synchronised across coupled boundaries. Return
212  // true if in error.
213  virtual bool checkParallelSync(const bool report = false) const;
214 
215  //- Correct patch after moving points
216  virtual void movePoints(const pointField&)
217  {}
218 
219  //- Write dictionary
220  virtual void writeDict(Ostream&) const;
221 
222 
223  // Member Operators
224 
225  //- Assign to zone, clearing demand-driven data
226  void operator=(const pointZone&);
227 
228  //- Assign addressing, clearing demand-driven data
229  void operator=(const labelUList&);
230 
231  //- Assign addressing, clearing demand-driven data
232  void operator=(const Xfer<labelList>&);
233 
234 
235  // I-O
236 
237  //- Ostream Operator
238  friend Ostream& operator<<(Ostream&, const pointZone&);
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 } // End namespace Foam
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
dictionary dict
virtual void movePoints(const pointField &)
Correct patch after moving points.
Definition: pointZone.H:215
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: pointZone.C:132
const pointZoneMesh & zoneMesh() const
Return zoneMesh reference.
Definition: pointZone.C:120
void operator=(const pointZone &)
Assign to zone, clearing demand-driven data.
Definition: pointZone.C:202
const pointZoneMesh & zoneMesh_
Reference to zone list.
Definition: pointZone.H:72
label index() const
Return the index of this zone in zone list.
Definition: zone.H:158
friend Ostream & operator<<(Ostream &, const pointZone &)
Ostream Operator.
Base class for zones.
Definition: zone.H:57
A class for handling words, derived from string.
Definition: word.H:59
static autoPtr< pointZone > New(const word &name, const dictionary &, const label index, const pointZoneMesh &)
Return a pointer to a new point zone.
Definition: pointZoneNew.C:32
const word & name() const
Return name.
Definition: zone.H:147
virtual bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries. Return.
Definition: pointZone.C:138
label whichPoint(const label globalPointID) const
Helper function to re-direct to zone::localID(...)
Definition: pointZone.C:126
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:61
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("pointZone")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, pointZone, dictionary,(const word &name, const dictionary &dict, const label index, const pointZoneMesh &zm),(name, dict, index, zm))
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
Definition: pointZone.H:84
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list...
Definition: pointZone.H:62
pointZone(const pointZone &)
Disallow default bitwise copy construct.
Ostream & operator<<(Ostream &, const ensightPart &)
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: pointZone.C:189
autoPtr< List< T > > clone() const
Clone.
Definition: ListI.H:108
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual ~pointZone()
Destructor.
Definition: pointZone.C:114
Namespace for OpenFOAM.