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