FreeFOAM The Cross-Platform CFD Toolkit
polyBoundaryMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::polyBoundaryMesh
26 
27 Description
28  Foam::polyBoundaryMesh
29 
30 SourceFiles
31  polyBoundaryMesh.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef polyBoundaryMesh_H
36 #define polyBoundaryMesh_H
37 
38 #include <OpenFOAM/polyPatchList.H>
39 #include <OpenFOAM/regIOobject.H>
40 #include <OpenFOAM/labelPair.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
48 class polyMesh;
49 
50 // Forward declaration of friend functions and operators
51 
52 class polyBoundaryMesh;
53 
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class polyBoundaryMesh Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public polyPatchList,
64  public regIOobject
65 {
66  // private data
67 
68  //- Reference to mesh
69  const polyMesh& mesh_;
70 
71  //- Edges of neighbouring patches
72  mutable List<labelPairList>* neighbourEdgesPtr_;
73 
74 
75  // Private Member Functions
76 
77  //- Create identity map
78  static labelList ident(const label len);
79 
80  //- Calculate the geometry for the patches (transformation tensors etc.)
81  void calcGeometry();
82 
83  //- Disallow construct as copy
85 
86  //- Disallow assignment
87  void operator=(const polyBoundaryMesh&);
88 
89 
90 public:
91 
92  //- Declare friendship with polyMesh
93  friend class polyMesh;
94 
95 
96  //- Runtime type information
97  TypeName("polyBoundaryMesh");
98 
99 
100  // Constructors
101 
102  //- Read constructor given IOobject and a polyMesh reference
103  // Note point pointers are unset, only used in copying meshes
105  (
106  const IOobject&,
107  const polyMesh&
108  );
109 
110  //- Construct given size
112  (
113  const IOobject&,
114  const polyMesh&,
115  const label size
116  );
117 
118 
119  // Destructor
120 
122 
123  //- Clear geometry at this level and at patches
124  void clearGeom();
125 
126  //- Clear addressing at this level and at patches
127  void clearAddressing();
128 
129 
130  // Member functions
131 
132  //- Return the mesh reference
133  const polyMesh& mesh() const
134  {
135  return mesh_;
136  }
137 
138  //- Per patch the edges on the neighbouring patch. Is for every external
139  // edge the neighbouring patch and neighbouring (external) patch edge
140  // label. Note that edge indices are offset by nInternalEdges to keep
141  // it as much as possible consistent with coupled patch addressing
142  // (where coupling is by local patch face index).
143  // Only valid for singly connected polyBoundaryMesh and not parallel
144  const List<labelPairList>& neighbourEdges() const;
145 
146  //- Return a list of patch names
147  wordList names() const;
148 
149  //- Return a list of patch types
150  wordList types() const;
151 
152  //- Return a list of physical types
153  wordList physicalTypes() const;
154 
155  //- Find patch index given a name
156  label findPatchID(const word& patchName) const;
157 
158  //- Return patch index for a given face label
159  label whichPatch(const label faceIndex) const;
160 
161  //- Return the set of patch IDs corresponding to the given list of names
162  // Wild cards are expanded.
163  labelHashSet patchSet(const wordList&) const;
164 
165  //- Check whether all procs have all patches and in same order. Return
166  // true if in error.
167  bool checkParallelSync(const bool report = false) const;
168 
169  //- Check boundary definition. Return true if in error.
170  bool checkDefinition(const bool report = false) const;
171 
172  //- Correct polyBoundaryMesh after moving points
173  void movePoints(const pointField&);
174 
175  //- Correct polyBoundaryMesh after topology update
176  void updateMesh();
177 
178  //- Reorders patches. Ordering does not have to be done in
179  // ascending or descending order. Reordering has to be unique.
180  // (is shuffle) Calls updateMesh() after reordering to recalculate
181  // data.
182  void reorder(const UList<label>&);
183 
184  //- writeData member function required by regIOobject
185  bool writeData(Ostream&) const;
186 
187  //- Write using given format, version and form uncompression
188  bool writeObject
189  (
193  ) const;
194 
195 
196  // Ostream operator
197 
198  friend Ostream& operator<<(Ostream&, const polyBoundaryMesh&);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************ vim: set sw=4 sts=4 et: ************************ //