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 cells.
30 Currently set up as an indirect list but will be extended to use a
31 primitive mesh. For quick check whether a cell belongs to the zone use
32 the lookup mechanism in cellZoneMesh, where all the zoned cells are
33 registered with their zone number.
39 \*---------------------------------------------------------------------------*/
44 #include "labelList.H"
46 #include "dictionary.H"
47 #include "cellZoneMeshFwd.H"
48 #include "pointFieldFwd.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 // Forward declaration of friend functions and operators
59 Ostream& operator<<(Ostream&, const cellZone&);
62 /*---------------------------------------------------------------------------*\
63 Class cellZone Declaration
64 \*---------------------------------------------------------------------------*/
78 //- Reference to zone list
79 const cellZoneMesh& zoneMesh_;
81 // Demand-driven private data
83 //- Map of cell labels in zone for fast location lookup
84 mutable Map<label>* cellLookupMapPtr_;
87 // Private Member Functions
89 //- Disallow default bitwise copy construct
90 cellZone(const cellZone&);
92 //- Return map of local cell indices
93 const Map<label>& cellLookupMap() const;
95 //- Build map of local cell indices
96 void calcCellLookupMap() const;
101 //- Runtime type information
102 TypeName("cellZone");
105 // Declare run-time constructor selection tables
107 declareRunTimeSelectionTable
114 const dictionary& dict,
116 const cellZoneMesh& zm
118 (name, dict, index, zm)
124 //- Construct from components
128 const labelList& addr,
133 //- Construct from components, transferring contents
137 const Xfer<labelList>& addr,
142 //- Construct from dictionary
151 //- Construct given the original zone and resetting the
152 // cell list and zone mesh information
156 const labelList& addr,
161 //- Construct given the original zone, resetting the
162 // cell list and zone mesh information
166 const Xfer<labelList>& addr,
171 //- Construct and return a clone, resetting the zone mesh
172 virtual autoPtr<cellZone> clone(const cellZoneMesh& zm) const
174 return autoPtr<cellZone>
176 new cellZone(*this, *this, index(), zm)
180 //- Construct and return a clone, resetting the cell list
182 virtual autoPtr<cellZone> clone
184 const labelList& addr,
186 const cellZoneMesh& zm
189 return autoPtr<cellZone>
191 new cellZone(*this, addr, index, zm)
198 //- Return a pointer to a new cell zone
199 // created on freestore from dictionary
200 static autoPtr<cellZone> New
217 const word& name() const
222 //- Map storing the local cell index for every global cell
223 // index. Used to find out the index of cell in the zone from
224 // the known global cell index. If the cell is not in the
226 label whichCell(const label globalCellID) const;
228 //- Return the index of this zone in zone list
234 //- Return zoneMesh reference
235 const cellZoneMesh& zoneMesh() const;
238 void clearAddressing();
240 //- Check zone definition. Return true if in error.
241 bool checkDefinition(const bool report = false) const;
243 //- Correct patch after moving points
244 virtual void movePoints(const pointField&)
247 //- Correct after topology update Note: Zone has been rebuilt
248 // and no mapping is required. HJ, 1/Mar/2009
252 virtual void write(Ostream&) const;
255 virtual void writeDict(Ostream&) const;
260 //- Assign to zone clearing demand-driven data
261 void operator=(const cellZone&);
263 //- Assign addressing clearing demand-driven data
264 void operator=(const labelList&);
269 friend Ostream& operator<<(Ostream&, const cellZone&);
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 } // End namespace Foam
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 // ************************************************************************* //