pointZone.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-2021 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 meshPointZones, 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 "meshPointZonesFwd.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
74 
75 
76 public:
77 
78  // Static Data Members
79 
80  //- The name associated with the zone-labels dictionary entry
81  static const char * const labelsName;
82 
83 
84  //- Runtime type information
85  TypeName("pointZone");
86 
87 
88  // Declare run-time constructor selection tables
89 
91  (
92  autoPtr,
93  pointZone,
94  dictionary,
95  (
96  const word& name,
97  const dictionary& dict,
98  const label index,
99  const meshPointZones& mz
100  ),
101  (name, dict, index, mz)
102  );
103 
104 
105  // Constructors
106 
107  //- Construct from components
108  pointZone
109  (
110  const word& name,
111  const labelUList& addr,
112  const label index,
113  const meshPointZones&
114  );
115 
116  //- Construct from components, transferring contents
117  pointZone
118  (
119  const word& name,
120  labelList&& addr,
121  const label index,
122  const meshPointZones&
123  );
124 
125  //- Construct from dictionary
126  pointZone
127  (
128  const word& name,
129  const dictionary&,
130  const label index,
131  const meshPointZones&
132  );
133 
134  //- Construct given the original zone and resetting the
135  // point list and mesh zones information
136  pointZone
137  (
138  const pointZone&,
139  const labelUList& addr,
140  const label index,
141  const meshPointZones&
142  );
143 
144  //- Construct given the original zone, resetting the
145  // face list and mesh zones information
146  pointZone
147  (
148  const pointZone&,
149  labelList&& addr,
150  const label index,
151  const meshPointZones&
152  );
153 
154  //- Disallow default bitwise copy construction
155  pointZone(const pointZone&) = delete;
156 
157 
158  //- Construct and return a clone, resetting the mesh zones
159  virtual autoPtr<pointZone> clone(const meshPointZones& mz) const
160  {
161  return autoPtr<pointZone>
162  (
163  new pointZone(*this, *this, index(), mz)
164  );
165  }
166 
167  //- Construct and return a clone, resetting the point list
168  // and mesh zones
169  virtual autoPtr<pointZone> clone
170  (
171  const meshPointZones& mz,
172  const label index,
173  const labelUList& addr
174  ) const
175  {
176  return autoPtr<pointZone>
177  (
178  new pointZone(*this, addr, index, mz)
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 meshPointZones&
193  );
194 
195 
196  //- Destructor
197  virtual ~pointZone();
198 
199 
200  // Member Functions
201 
202  //- Return meshZones reference
203  const meshPointZones& meshZones() 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  //- Assignment to zone, clearing demand-driven data
226  void operator=(const pointZone&);
227 
228  //- Move assignment to zone, clearing demand-driven data
229  void operator=(pointZone&&);
230 
231  //- Assign addressing, clearing demand-driven data
232  void operator=(const labelUList&);
233 
234  //- Move addressing, clearing demand-driven data
235  void operator=(labelList&&);
236 
237 
238  // I-O
239 
240  //- Ostream Operator
241  friend Ostream& operator<<(Ostream&, const pointZone&);
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
autoPtr< List< label > > clone() const
Clone.
Definition: ListI.H:109
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list.
Definition: pointZone.H:65
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: pointZone.C:132
const meshPointZones & meshZones() const
Return meshZones reference.
Definition: pointZone.C:120
const meshPointZones & meshZones_
Reference to zone list.
Definition: pointZone.H:72
friend Ostream & operator<<(Ostream &, const pointZone &)
Ostream Operator.
virtual void movePoints(const pointField &)
Correct patch after moving points.
Definition: pointZone.H:215
static autoPtr< pointZone > New(const word &name, const dictionary &, const label index, const meshPointZones &)
Return a pointer to a new point zone.
Definition: pointZoneNew.C:32
virtual ~pointZone()
Destructor.
Definition: pointZone.C:114
TypeName("pointZone")
Runtime type information.
void operator=(const pointZone &)
Assignment to zone, clearing demand-driven data.
Definition: pointZone.C:202
static const char *const labelsName
The name associated with the zone-labels dictionary entry.
Definition: pointZone.H:80
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: pointZone.C:189
label whichPoint(const label globalPointID) const
Helper function to re-direct to zone::localID(...)
Definition: pointZone.C:126
virtual bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries. Return.
Definition: pointZone.C:138
declareRunTimeSelectionTable(autoPtr, pointZone, dictionary,(const word &name, const dictionary &dict, const label index, const meshPointZones &mz),(name, dict, index, mz))
pointZone(const word &name, const labelUList &addr, const label index, const meshPointZones &)
Construct from components.
Definition: pointZone.C:48
A class for handling words, derived from string.
Definition: word.H:62
Base class for zones.
Definition: zone.H:60
label index() const
Return the index of this zone in zone list.
Definition: zone.H:158
const word & name() const
Return name.
Definition: zone.H:147
Namespace for OpenFOAM.
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
Ostream & operator<<(Ostream &, const ensightPart &)
dictionary dict