1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::polyBoundaryMesh
28 Foam::polyBoundaryMesh
33 \*---------------------------------------------------------------------------*/
35 #ifndef polyBoundaryMesh_H
36 #define polyBoundaryMesh_H
38 #include "polyPatchList.H"
39 #include "regIOobject.H"
40 #include "labelPair.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of classes
52 // Forward declaration of friend functions and operators
54 Ostream& operator<<(Ostream&, const polyBoundaryMesh&);
57 /*---------------------------------------------------------------------------*\
58 Class polyBoundaryMesh Declaration
59 \*---------------------------------------------------------------------------*/
61 class polyBoundaryMesh
69 const polyMesh& mesh_;
71 mutable autoPtr<labelList> patchIDPtr_;
73 //- Edges of neighbouring patches
74 mutable autoPtr<List<labelPairList> > neighbourEdgesPtr_;
77 // Private Member Functions
79 //- Create identity map
80 static labelList ident(const label len);
82 //- Calculate the geometry for the patches (transformation tensors etc.)
85 //- Disallow construct as copy
86 polyBoundaryMesh(const polyBoundaryMesh&);
88 //- Disallow assignment
89 void operator=(const polyBoundaryMesh&);
94 //- Declare friendship with polyMesh
95 friend class polyMesh;
98 //- Runtime type information
99 TypeName("polyBoundaryMesh");
104 //- Read constructor given IOobject and a polyMesh reference
105 // Note point pointers are unset, only used in copying meshes
112 //- Construct given size
124 //- Clear geometry at this level and at patches
127 //- Clear addressing at this level and at patches
128 void clearAddressing();
133 //- Return the mesh reference
134 const polyMesh& mesh() const
139 //- Per patch the edges on the neighbouring patch. Is for every external
140 // edge the neighbouring patch and neighbouring (external) patch edge
141 // label. Note that edge indices are offset by nInternalEdges to keep
142 // it as much as possible consistent with coupled patch addressing
143 // (where coupling is by local patch face index).
144 // Only valid for singly connected polyBoundaryMesh and not parallel
145 const List<labelPairList>& neighbourEdges() const;
147 //- Return a list of patch names
148 wordList names() const;
150 //- Return a list of patch types
151 wordList types() const;
153 //- Return a list of physical types
154 wordList physicalTypes() const;
156 //- Return patch indices for all matches
157 labelList findIndices(const keyType&) const;
159 //- Return patch index for the first match, return -1 if not found
160 label findIndex(const keyType&) const;
162 //- Find patch index given a name
163 label findPatchID(const word& patchName) const;
165 //- Return patch index for a given face label
166 label whichPatch(const label faceIndex) const;
168 //- Per boundary face label the patch index
169 const labelList& patchID() const;
171 //- Return the set of patch IDs corresponding to the given names
172 // By default warns if given names are not found.
173 labelHashSet patchSet
175 const UList<wordRe>& patchNames,
176 const bool warnNotFound = true
179 //- Check whether all procs have all patches and in same order. Return
181 bool checkParallelSync(const bool report = false) const;
183 //- Check boundary definition. Return true if in error.
184 bool checkDefinition(const bool report = false) const;
186 //- Correct polyBoundaryMesh after moving points
187 void movePoints(const pointField&);
189 //- Correct polyBoundaryMesh after topology update
192 //- Reorders patches. Ordering does not have to be done in
193 // ascending or descending order. Reordering has to be unique.
194 // (is shuffle) Calls updateMesh() after reordering to recalculate
196 void reorder(const labelUList&);
198 //- writeData member function required by regIOobject
199 bool writeData(Ostream&) const;
201 //- Write using given format, version and form uncompression
204 IOstream::streamFormat fmt,
205 IOstream::versionNumber ver,
206 IOstream::compressionType cmp
211 //- Return const and non-const reference to polyPatch by index.
212 using polyPatchList::operator[];
214 //- Return const reference to polyPatch by name.
215 const polyPatch& operator[](const word&) const;
217 //- Return reference to polyPatch by name.
218 polyPatch& operator[](const word&);
223 friend Ostream& operator<<(Ostream&, const polyBoundaryMesh&);
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 } // End namespace Foam
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 // ************************************************************************* //