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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2017-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pointZone
29
30Description
31 A subset of mesh points.
32
33 The labels of points in the zone can be obtained from the addressing()
34 list.
35
36 For quick check whether a point belongs to the zone use the lookup
37 mechanism in pointZoneMesh, where all the zoned points are registered
38 with their zone number.
39
40SourceFiles
41 pointZone.C
42 pointZoneNew.C
43
44\*---------------------------------------------------------------------------*/
45
46#ifndef pointZone_H
47#define pointZone_H
48
49#include "zone.H"
50#include "pointZoneMeshFwd.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57// Forward Declarations
58class pointZone;
59Ostream& operator<<(Ostream& os, const pointZone& zn);
60
61
62/*---------------------------------------------------------------------------*\
63 Class pointZone Declaration
64\*---------------------------------------------------------------------------*/
66class pointZone
67:
68 public zone
69{
70 // Private Data
71
72 //- Reference to zone list
73 const pointZoneMesh& zoneMesh_;
74
75
76 // Private Member Functions
77
78 //- No copy construct
79 pointZone(const pointZone&) = delete;
80
81
82public:
83
84 // Static Data Members
85
86 //- The name associated with the zone-labels dictionary entry
87 //- ("pointLabels")
88 static const char * const labelsName;
89
90
91 //- Runtime type information
92 TypeName("pointZone");
93
94
95 // Declare run-time constructor selection tables
98 (
99 autoPtr,
100 pointZone,
102 (
103 const word& name,
104 const dictionary& dict,
105 const label index,
106 const pointZoneMesh& zm
107 ),
108 (name, dict, index, zm)
109 );
110
111
112 // Constructors
113
114 //- Construct an empty zone
116 (
117 const word& name,
118 const label index,
119 const pointZoneMesh& zm
120 );
121
122 //- Construct from components
124 (
125 const word& name,
126 const labelUList& addr,
127 const label index,
128 const pointZoneMesh& zm
129 );
130
131 //- Construct from components, transferring addressing
133 (
134 const word& name,
135 labelList&& addr,
136 const label index,
137 const pointZoneMesh& zm
138 );
139
140 //- Construct from dictionary
142 (
143 const word& name,
144 const dictionary& dict,
145 const label index,
146 const pointZoneMesh& zm
147 );
148
149 //- Construct with a new index and zone mesh information, the name
150 //- of the original zone, resetting the point addressing.
152 (
153 const pointZone& origZone,
154 const labelUList& addr,
155 const label index,
156 const pointZoneMesh& zm
157 );
158
159 //- Construct with a new index and zone mesh information, the name
160 //- of the original zone, (move) resetting the point addressing.
162 (
163 const pointZone& origZone,
164 labelList&& addr,
165 const label index,
166 const pointZoneMesh& zm
167 );
168
169
170 //- Construct and return a clone, resetting the zone mesh
171 virtual autoPtr<pointZone> clone(const pointZoneMesh& zm) const
172 {
173 return autoPtr<pointZone>::New(*this, *this, index(), zm);
174 }
175
176 //- Construct and return a clone, resetting the point list
177 //- and zone mesh
179 (
180 const pointZoneMesh& zm,
181 const label index,
182 const labelUList& addr
183 ) const
184 {
185 return autoPtr<pointZone>::New(*this, addr, index, zm);
186 }
187
188
189 // Selectors
190
191 //- Return a pointer to a new point zone
192 // created on freestore from dictionary
194 (
195 const word& name,
196 const dictionary& dict,
197 const label index,
198 const pointZoneMesh& zm
199 );
200
201
202 //- Destructor
203 virtual ~pointZone() = default;
204
205
206 // Member Functions
207
208 //- Return reference to the zone mesh
209 const pointZoneMesh& zoneMesh() const noexcept
210 {
211 return zoneMesh_;
212 }
213
214 //- Helper function to re-direct to zone::localID(...)
215 label whichPoint(const label globalPointID) const;
216
217
218 //- Check zone definition. Return true if in error.
219 virtual bool checkDefinition(const bool report = false) const;
220
221 //- Check whether zone is synchronised across coupled boundaries.
222 // \return True if any errors.
223 virtual bool checkParallelSync(const bool report = false) const;
224
225 //- Correct patch after moving points
226 virtual void movePoints(const pointField&)
227 {}
228
229 //- Write dictionary
230 virtual void writeDict(Ostream& os) const;
231
232
233 // Member Operators
234
235 //- Assign addressing, clearing demand-driven data
236 void operator=(const pointZone& zn);
237
238 //- Assign addressing, clearing demand-driven data
239 void operator=(const labelUList& addr);
240
241 //- Assign addressing, clearing demand-driven data
242 void operator=(labelList&& addr);
243
244
245 // I-O
246
247 //- Ostream Operator
248 friend Ostream& operator<<(Ostream& os, const pointZone& zn);
249};
250
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253
254} // End namespace Foam
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258#endif
259
260// ************************************************************************* //
autoPtr< List< label > > clone() const
Clone.
Definition: ListI.H:100
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A subset of mesh points.
Definition: pointZone.H:68
virtual bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: pointZone.C:135
declareRunTimeSelectionTable(autoPtr, pointZone, dictionary,(const word &name, const dictionary &dict, const label index, const pointZoneMesh &zm),(name, dict, index, zm))
virtual autoPtr< pointZone > clone(const pointZoneMesh &zm) const
Construct and return a clone, resetting the zone mesh.
Definition: pointZone.H:170
virtual void movePoints(const pointField &)
Correct patch after moving points.
Definition: pointZone.H:225
TypeName("pointZone")
Runtime type information.
const pointZoneMesh & zoneMesh() const noexcept
Return reference to the zone mesh.
Definition: pointZone.H:208
static const char *const labelsName
Definition: pointZone.H:87
virtual autoPtr< pointZone > clone(const pointZoneMesh &zm, const label index, const labelUList &addr) const
Definition: pointZone.H:178
virtual void writeDict(Ostream &os) const
Write dictionary.
Definition: pointZone.C:195
static autoPtr< pointZone > New(const word &name, const dictionary &dict, const label index, const pointZoneMesh &zm)
Return a pointer to a new point zone.
Definition: pointZoneNew.C:35
void operator=(const pointZone &zn)
Assign addressing, clearing demand-driven data.
Definition: pointZone.C:209
friend Ostream & operator<<(Ostream &os, const pointZone &zn)
Ostream Operator.
label whichPoint(const label globalPointID) const
Helper function to re-direct to zone::localID(...)
Definition: pointZone.C:129
virtual bool checkParallelSync(const bool report=false) const
Check whether zone is synchronised across coupled boundaries.
Definition: pointZone.C:141
virtual ~pointZone()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:68
label index() const noexcept
The index of this zone in the zone list.
const word & name() const noexcept
The zone name.
Base class for mesh zones.
Definition: zone.H:67
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
const direction noexcept
Definition: Scalar.H:223
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73