FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

ZoneMesh.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::ZoneMesh
00026 
00027 Description
00028     List of mesh zones
00029 
00030 SourceFiles
00031     ZoneMesh.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef ZoneMesh_H
00036 #define ZoneMesh_H
00037 
00038 #include <OpenFOAM/List.H>
00039 #include <OpenFOAM/regIOobject.H>
00040 #include <OpenFOAM/HashSet.H>
00041 #include <OpenFOAM/pointFieldsFwd.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 // Forward declaration of friend functions and operators
00051 
00052 template<class ZoneType, class MeshType> class ZoneMesh;
00053 
00054 template<class ZoneType, class MeshType>
00055 Ostream& operator<<(Ostream&, const ZoneMesh<ZoneType, MeshType>&);
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class ZoneMesh Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 template<class ZoneType, class MeshType>
00062 class ZoneMesh
00063 :
00064     public PtrList<ZoneType>,
00065     public regIOobject
00066 {
00067     // Private data
00068 
00069         //- Reference to mesh
00070         const MeshType& mesh_;
00071 
00072         //- Map of zone labels for given element
00073         mutable Map<label>* zoneMapPtr_;
00074 
00075 
00076     // Private member functions
00077 
00078         //- Disallow construct as copy
00079         ZoneMesh(const ZoneMesh&);
00080 
00081         //- Disallow assignment
00082         void operator=(const ZoneMesh<ZoneType, MeshType>&);
00083 
00084 
00085         //- Create zone map
00086         void calcZoneMap() const;
00087 
00088 
00089 public:
00090 
00091     // Constructors
00092 
00093         //- Read constructor given IOobject and a MeshType reference
00094         ZoneMesh
00095         (
00096             const IOobject&,
00097             const MeshType&
00098         );
00099 
00100         //- Construct given size
00101         ZoneMesh
00102         (
00103             const IOobject&,
00104             const MeshType&,
00105             const label size
00106         );
00107 
00108     // Destructor
00109 
00110         ~ZoneMesh();
00111 
00112 
00113     // Member functions
00114 
00115         //- Return the mesh reference
00116         const MeshType& mesh() const
00117         {
00118             return mesh_;
00119         }
00120 
00121         //- Map of zones containing zone index for all zoned elements
00122         //  Return -1 if the object is not in the zone
00123         const Map<label>& zoneMap() const;
00124 
00125         //- Given a global object index, return the zone it is in.  If
00126         //object does not belong to any zones, return -1
00127         label whichZone(const label objectIndex) const;
00128 
00129         //- Return a list of zone types
00130         wordList types() const;
00131 
00132         //- Return a list of zone names
00133         wordList names() const;
00134 
00135         //- Find zone index given a name
00136         label findZoneID(const word& zoneName) const;
00137 
00138         //- Clear addressing
00139         void clearAddressing();
00140 
00141         //- Clear the zones
00142         void clear();
00143 
00144         //- Check zone definition. Return true if in error.
00145         bool checkDefinition(const bool report = false) const;
00146 
00147         //- Correct zone mesh after moving points
00148         void movePoints(const pointField&);
00149 
00150         //- writeData member function required by regIOobject
00151         bool writeData(Ostream&) const;
00152 
00153 
00154     // Ostream operator
00155 
00156         friend Ostream& operator<< <ZoneType, MeshType>
00157         (
00158             Ostream&,
00159             const ZoneMesh<ZoneType, MeshType>&
00160         );
00161 };
00162 
00163 
00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00165 
00166 } // End namespace Foam
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 #ifdef NoRepository
00171 #   include "ZoneMesh.C"
00172 #endif
00173 
00174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00175 
00176 #endif
00177 
00178 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines