OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

polyBoundaryMesh.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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::polyBoundaryMesh
00027 
00028 Description
00029     Foam::polyBoundaryMesh
00030 
00031 SourceFiles
00032     polyBoundaryMesh.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef polyBoundaryMesh_H
00037 #define polyBoundaryMesh_H
00038 
00039 #include "polyPatchList.H"
00040 #include "regIOobject.H"
00041 #include "labelPair.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 typedef List<labelPair> labelPairList;
00049 class polyMesh;
00050 
00051 // Forward declaration of friend functions and operators
00052 
00053 class polyBoundaryMesh;
00054 
00055 Ostream& operator<<(Ostream&, const polyBoundaryMesh&);
00056 
00057 
00058 /*---------------------------------------------------------------------------*\
00059                       Class polyBoundaryMesh Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class polyBoundaryMesh
00063 :
00064     public polyPatchList,
00065     public regIOobject
00066 {
00067     // private data
00068 
00069         //- Reference to mesh
00070         const polyMesh& mesh_;
00071 
00072         //- Edges of neighbouring patches
00073         mutable List<labelPairList>* neighbourEdgesPtr_;
00074 
00075 
00076     // Private Member Functions
00077 
00078         //- Create identity map
00079         static labelList ident(const label len);
00080 
00081         //- Calculate the geometry for the patches (transformation tensors etc.)
00082         void calcGeometry();
00083 
00084         //- Disallow construct as copy
00085         polyBoundaryMesh(const polyBoundaryMesh&);
00086 
00087         //- Disallow assignment
00088         void operator=(const polyBoundaryMesh&);
00089 
00090 
00091 public:
00092 
00093     //- Declare friendship with polyMesh
00094     friend class polyMesh;
00095 
00096 
00097     //- Runtime type information
00098     TypeName("polyBoundaryMesh");
00099 
00100 
00101     // Constructors
00102 
00103         //- Read constructor given IOobject and a polyMesh reference
00104         //  Note point pointers are unset, only used in copying meshes
00105         polyBoundaryMesh
00106         (
00107             const IOobject&,
00108             const polyMesh&
00109         );
00110 
00111         //- Construct given size
00112         polyBoundaryMesh
00113         (
00114             const IOobject&,
00115             const polyMesh&,
00116             const label size
00117         );
00118 
00119 
00120     // Destructor
00121 
00122         ~polyBoundaryMesh();
00123 
00124         //- Clear geometry at this level and at patches
00125         void clearGeom();
00126 
00127         //- Clear addressing at this level and at patches
00128         void clearAddressing();
00129 
00130 
00131     // Member functions
00132 
00133         //- Return the mesh reference
00134         const polyMesh& mesh() const
00135         {
00136             return mesh_;
00137         }
00138 
00139         //- Per patch the edges on the neighbouring patch. Is for every external
00140         //  edge the neighbouring patch and neighbouring (external) patch edge
00141         //  label. Note that edge indices are offset by nInternalEdges to keep
00142         //  it as much as possible consistent with coupled patch addressing
00143         //  (where coupling is by local patch face index).
00144         //  Only valid for singly connected polyBoundaryMesh and not parallel
00145         const List<labelPairList>& neighbourEdges() const;
00146 
00147         //- Return a list of patch names
00148         wordList names() const;
00149 
00150         //- Return a list of patch types
00151         wordList types() const;
00152 
00153         //- Return a list of physical types
00154         wordList physicalTypes() const;
00155 
00156         //- Find patch index given a name
00157         label findPatchID(const word& patchName) const;
00158 
00159         //- Return patch index for a given face label
00160         label whichPatch(const label faceIndex) const;
00161 
00162         //- Return the set of patch IDs corresponding to the given list of names
00163         //  Wild cards are expanded.
00164         labelHashSet patchSet(const wordList&) const;
00165 
00166         //- Check whether all procs have all patches and in same order. Return
00167         //  true if in error.
00168         bool checkParallelSync(const bool report = false) const;
00169 
00170         //- Check boundary definition. Return true if in error.
00171         bool checkDefinition(const bool report = false) const;
00172 
00173         //- Correct polyBoundaryMesh after moving points
00174         void movePoints(const pointField&);
00175 
00176         //- Correct polyBoundaryMesh after topology update
00177         void updateMesh();
00178 
00179         //- Reorders patches. Ordering does not have to be done in
00180         //  ascending or descending order. Reordering has to be unique.
00181         //  (is shuffle) Calls updateMesh() after reordering to recalculate
00182         //  data.
00183         void reorder(const UList<label>&);
00184 
00185         //- writeData member function required by regIOobject
00186         bool writeData(Ostream&) const;
00187 
00188         //- Write using given format, version and form uncompression
00189         bool writeObject
00190         (
00191             IOstream::streamFormat fmt,
00192             IOstream::versionNumber ver,
00193             IOstream::compressionType cmp
00194         ) const;
00195 
00196 
00197     // Ostream operator
00198 
00199         friend Ostream& operator<<(Ostream&, const polyBoundaryMesh&);
00200 };
00201 
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 } // End namespace Foam
00206 
00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00208 
00209 #endif
00210 
00211 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd