1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A subset of mesh points.
30 The labels of points in the zone can be obtained from the addressing()
33 For quick check whether a point belongs to the zone use the lookup
34 mechanism in pointZoneMesh, where all the zoned points are registered
35 with their zone number.
41 \*---------------------------------------------------------------------------*/
46 #include "labelList.H"
48 #include "dictionary.H"
49 #include "pointZoneMeshFwd.H"
51 #include "pointField.H"
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 // Forward declaration of friend functions and operators
61 Ostream& operator<<(Ostream&, const pointZone&);
64 /*---------------------------------------------------------------------------*\
65 Class pointZone Declaration
66 \*---------------------------------------------------------------------------*/
80 //- Reference to zone list
81 const pointZoneMesh& zoneMesh_;
84 // Demand-driven private data
86 //- Map of point labels in zone for fast location lookup
87 mutable Map<label>* pointLookupMapPtr_;
90 // Private Member Functions
92 //- Disallow default bitwise copy construct
93 pointZone(const pointZone&);
95 //- Return map of local point indices
96 const Map<label>& pointLookupMap() const;
98 //- Build map of local point indices
99 void calcPointLookupMap() const;
104 //- Runtime type information
105 TypeName("pointZone");
108 // Declare run-time constructor selection tables
110 declareRunTimeSelectionTable
117 const dictionary& dict,
119 const pointZoneMesh& zm
121 (name, dict, index, zm)
127 //- Construct from components
131 const labelList& addr,
133 const pointZoneMesh& zm
136 //- Construct from dictionary
140 const dictionary& dict,
142 const pointZoneMesh& zm
145 //- Construct given the original zone and resetting the
146 // point list and zone mesh information
150 const labelList& addr,
152 const pointZoneMesh& zm
155 //- Construct and return a clone, resetting the zone mesh
156 virtual autoPtr<pointZone> clone(const pointZoneMesh& zm) const
158 return autoPtr<pointZone>
160 new pointZone(*this, *this, index(), zm)
164 //- Construct and return a clone, resetting the point list
166 virtual autoPtr<pointZone> clone
168 const pointZoneMesh& zm,
170 const labelList& addr
173 return autoPtr<pointZone>
175 new pointZone(*this, addr, index, zm)
182 //- Return a pointer to a new point zone
183 // created on freestore from dictionary
184 static autoPtr<pointZone> New
187 const dictionary& dict,
195 virtual ~pointZone();
201 const word& name() const
206 //- Map storing the local point index for every global point
207 // index. Used to find out the index of point in the zone from
208 // the known global point index. If the point is not in the
210 label whichPoint(const label globalPointID) const;
212 //- Return the index of this zone in zone list
218 //- Return zoneMesh reference
219 const pointZoneMesh& zoneMesh() const;
222 void clearAddressing();
224 //- Check zone definition. Return true if in error.
225 bool checkDefinition(const bool report = false) const;
227 //- Correct patch after moving points
228 virtual void movePoints(const pointField&)
232 virtual void write(Ostream&) const;
235 virtual void writeDict(Ostream&) const;
240 //- Assign to zone clearing demand-driven data
241 void operator=(const pointZone&);
243 //- Assign addressing clearing demand-driven data
244 void operator=(const labelList&);
249 friend Ostream& operator<<(Ostream&, const pointZone&);
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 } // End namespace Foam
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 // ************************************************************************* //