initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / polyMesh / zones / ZoneMesh / ZoneMesh.H
blob6fb1332dc430a4622daa21bb82e609a4cb682b02
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::ZoneMesh
28 Description
29     List of mesh zones
31 SourceFiles
32     ZoneMesh.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef ZoneMesh_H
37 #define ZoneMesh_H
39 #include "List.H"
40 #include "regIOobject.H"
41 #include "HashSet.H"
42 #include "pointFieldsFwd.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
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>
63 class ZoneMesh
65     public PtrList<ZoneType>,
66     public regIOobject
68     // Private data
70         //- Reference to mesh
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>&);
86         //- Create zone map
87         void calcZoneMap() const;
90 public:
92     // Constructors
94         //- Read constructor given IOobject and a MeshType reference
95         ZoneMesh
96         (
97             const IOobject&,
98             const MeshType&
99         );
101         //- Construct given size
102         ZoneMesh
103         (
104             const IOobject&,
105             const MeshType&,
106             const label size
107         );
109     // Destructor
111         ~ZoneMesh();
114     // Member functions
116         //- Return the mesh reference
117         const MeshType& mesh() const
118         {
119             return mesh_;
120         }
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;
139         //- Clear addressing
140         void clearAddressing();
142         //- Clear the zones
143         void clear();
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;
155     // Ostream operator
157         friend Ostream& operator<< <ZoneType, MeshType>
158         (
159             Ostream&,
160             const ZoneMesh<ZoneType, MeshType>&
161         );
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace Foam
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 #ifdef NoRepository
172 #   include "ZoneMesh.C"
173 #endif
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 #endif
179 // ************************************************************************* //