1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A subset of mesh points.
29 The labels of points in the zone can be obtained from the addressing()
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.
40 \*---------------------------------------------------------------------------*/
45 #include "labelList.H"
47 #include "dictionary.H"
48 #include "pointZoneMeshFwd.H"
50 #include "pointField.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Forward declaration of friend functions and operators
60 Ostream& operator<<(Ostream&, const pointZone&);
63 /*---------------------------------------------------------------------------*\
64 Class pointZone Declaration
65 \*---------------------------------------------------------------------------*/
79 //- Reference to zone list
80 const pointZoneMesh& zoneMesh_;
83 // Demand-driven private data
85 //- Map of point labels in zone for fast location lookup
86 mutable Map<label>* pointLookupMapPtr_;
89 // Private Member Functions
91 //- Disallow default bitwise copy construct
92 pointZone(const pointZone&);
94 //- Return map of local point indices
95 const Map<label>& pointLookupMap() const;
97 //- Build map of local point indices
98 void calcPointLookupMap() const;
103 //- Runtime type information
104 TypeName("pointZone");
107 // Declare run-time constructor selection tables
109 declareRunTimeSelectionTable
116 const dictionary& dict,
118 const pointZoneMesh& zm
120 (name, dict, index, zm)
126 //- Construct from components
130 const labelList& addr,
135 //- Construct from components, transferring contents
139 const Xfer<labelList>& addr,
144 //- Construct from dictionary
153 //- Construct given the original zone and resetting the
154 // point list and zone mesh information
158 const labelList& addr,
163 //- Construct given the original zone, resetting the
164 // face list and zone mesh information
168 const Xfer<labelList>& addr,
173 //- Construct and return a clone, resetting the zone mesh
174 virtual autoPtr<pointZone> clone(const pointZoneMesh& zm) const
176 return autoPtr<pointZone>
178 new pointZone(*this, *this, index(), zm)
182 //- Construct and return a clone, resetting the point list
184 virtual autoPtr<pointZone> clone
186 const pointZoneMesh& zm,
188 const labelList& addr
191 return autoPtr<pointZone>
193 new pointZone(*this, addr, index, zm)
200 //- Return a pointer to a new point zone
201 // created on freestore from dictionary
202 static autoPtr<pointZone> New
213 virtual ~pointZone();
219 const word& name() const
224 //- Map storing the local point index for every global point
225 // index. Used to find out the index of point in the zone from
226 // the known global point index. If the point is not in the
228 label whichPoint(const label globalPointID) const;
230 //- Return the index of this zone in zone list
236 //- Return zoneMesh reference
237 const pointZoneMesh& zoneMesh() const;
240 void clearAddressing();
242 //- Check zone definition. Return true if in error.
243 bool checkDefinition(const bool report = false) const;
245 //- Correct patch after moving points
246 virtual void movePoints(const pointField&)
249 //- Correct after topology update. Note: Zone has been rebuilt
250 // and no mapping is required. HJ, 1/Mar/2009
254 virtual void write(Ostream&) const;
257 virtual void writeDict(Ostream&) const;
262 //- Assign to zone clearing demand-driven data
263 void operator=(const pointZone&);
265 //- Assign addressing clearing demand-driven data
266 void operator=(const labelList&);
271 friend Ostream& operator<<(Ostream&, const pointZone&);
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 } // End namespace Foam
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 // ************************************************************************* //