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 cells.
31 Currently set up as an indirect list but will be extended to use a
32 primitive mesh. For quick check whether a cell belongs to the zone use
33 the lookup mechanism in cellZoneMesh, where all the zoned cells are
34 registered with their zone number.
40 \*---------------------------------------------------------------------------*/
45 #include "labelList.H"
47 #include "dictionary.H"
48 #include "cellZoneMeshFwd.H"
49 #include "pointFieldFwd.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Forward declaration of friend functions and operators
60 Ostream& operator<<(Ostream&, const cellZone&);
63 /*---------------------------------------------------------------------------*\
64 Class cellZone Declaration
65 \*---------------------------------------------------------------------------*/
79 //- Reference to zone list
80 const cellZoneMesh& zoneMesh_;
82 // Demand-driven private data
84 //- Map of cell labels in zone for fast location lookup
85 mutable Map<label>* cellLookupMapPtr_;
88 // Private Member Functions
90 //- Disallow default bitwise copy construct
91 cellZone(const cellZone&);
93 //- Return map of local cell indices
94 const Map<label>& cellLookupMap() const;
96 //- Build map of local cell indices
97 void calcCellLookupMap() const;
102 //- Runtime type information
103 TypeName("cellZone");
106 // Declare run-time constructor selection tables
108 declareRunTimeSelectionTable
115 const dictionary& dict,
117 const cellZoneMesh& zm
119 (name, dict, index, zm)
125 //- Construct from components
129 const labelList& addr,
131 const cellZoneMesh& zm
134 //- Construct from dictionary
138 const dictionary& dict,
140 const cellZoneMesh& zm
143 //- Construct given the original zone and resetting the
144 // cell list and zone mesh information
148 const labelList& addr,
150 const cellZoneMesh& zm
153 //- Construct and return a clone, resetting the zone mesh
154 virtual autoPtr<cellZone> clone(const cellZoneMesh& zm) const
156 return autoPtr<cellZone>
158 new cellZone(*this, *this, index(), zm)
162 //- Construct and return a clone, resetting the cell list
164 virtual autoPtr<cellZone> clone
166 const labelList& addr,
168 const cellZoneMesh& zm
171 return autoPtr<cellZone>
173 new cellZone(*this, addr, index, zm)
180 //- Return a pointer to a new cell zone
181 // created on freestore from dictionary
182 static autoPtr<cellZone> New
185 const dictionary& dict,
199 const word& name() const
204 //- Map storing the local cell index for every global cell
205 // index. Used to find out the index of cell in the zone from
206 // the known global cell index. If the cell is not in the
208 label whichCell(const label globalCellID) const;
210 //- Return the index of this zone in zone list
216 //- Return zoneMesh reference
217 const cellZoneMesh& zoneMesh() const;
220 void clearAddressing();
222 //- Check zone definition. Return true if in error.
223 bool checkDefinition(const bool report = false) const;
225 //- Correct patch after moving points
226 virtual void movePoints(const pointField&)
230 virtual void write(Ostream&) const;
233 virtual void writeDict(Ostream&) const;
238 //- Assign to zone clearing demand-driven data
239 void operator=(const cellZone&);
241 //- Assign addressing clearing demand-driven data
242 void operator=(const labelList&);
247 friend Ostream& operator<<(Ostream&, const cellZone&);
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 } // End namespace Foam
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 // ************************************************************************* //