1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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
34 \*---------------------------------------------------------------------------*/
40 #include "regIOobject.H"
42 #include "pointFieldsFwd.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of friend functions and operators
53 template<class ZoneType, class MeshType> class ZoneMesh;
55 template<class ZoneType, class MeshType>
56 Ostream& operator<<(Ostream&, const ZoneMesh<ZoneType, MeshType>&);
58 /*---------------------------------------------------------------------------*\
59 Class ZoneMesh Declaration
60 \*---------------------------------------------------------------------------*/
62 template<class ZoneType, class MeshType>
65 public PtrList<ZoneType>,
71 const MeshType& mesh_;
73 //- Map of zone labels for given element
74 mutable Map<label>* zoneMapPtr_;
77 // Private member functions
79 //- Disallow construct as copy
80 ZoneMesh(const ZoneMesh&);
82 //- Disallow assignment
83 void operator=(const ZoneMesh<ZoneType, MeshType>&);
87 void calcZoneMap() const;
94 //- Read constructor given IOobject and a MeshType reference
101 //- Construct given size
116 //- Return the mesh reference
117 const MeshType& mesh() const
122 //- Map of zones containing zone index for all zoned elements
123 // Return -1 if the object is not in the zone
124 const Map<label>& zoneMap() const;
126 //- Given a global object index, return the zone it is in. If
127 //object does not belong to any zones, return -1
128 label whichZone(const label objectIndex) const;
130 //- Return a list of zone types
131 wordList types() const;
133 //- Return a list of zone names
134 wordList names() const;
136 //- Find zone index given a name
137 label findZoneID(const word& zoneName) const;
140 void clearAddressing();
145 //- Check zone definition. Return true if in error.
146 bool checkDefinition(const bool report = false) const;
148 //- Correct zone mesh after moving points
149 void movePoints(const pointField&);
151 //- writeData member function required by regIOobject
152 bool writeData(Ostream&) const;
157 friend Ostream& operator<< <ZoneType, MeshType>
160 const ZoneMesh<ZoneType, MeshType>&
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace Foam
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 # include "ZoneMesh.C"
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //