|
|
|
processorPolyPatch.HGo 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::processorPolyPatch 00027 00028 Description 00029 Neighbour processor patch. 00030 00031 Note: morph patch face ordering comes geometric or topological. 00032 Geometric: no cyclics allowed (assumes faces coincident) 00033 Topological: needs unmodified faces on both sides to correspond. Also 00034 needs at least one per connected patch area (so all patch faces can be 00035 visited from an unmodified face) 00036 00037 SourceFiles 00038 processorPolyPatch.C 00039 processorPolyPatchMorph.C 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef processorPolyPatch_H 00044 #define processorPolyPatch_H 00045 00046 #include "coupledPolyPatch.H" 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class processorPolyPatch Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 class processorPolyPatch 00058 : 00059 public coupledPolyPatch 00060 { 00061 // Private data 00062 00063 int myProcNo_; 00064 int neighbProcNo_; 00065 00066 //- Processor-neighbbour patch face centres 00067 vectorField neighbFaceCentres_; 00068 00069 //- Processor-neighbbour patch face areas 00070 vectorField neighbFaceAreas_; 00071 00072 //- Processor-neighbbour patch neighbour cell centres 00073 vectorField neighbFaceCellCentres_; 00074 00075 //- Corresponding neighbouring local point label for every local point 00076 // (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]]) 00077 mutable labelList* neighbPointsPtr_; 00078 00079 //- Corresponding neighbouring local edge label for every local edge 00080 // (so edges()[i] == neighb.edges()[neighbEdges_[i]]) 00081 mutable labelList* neighbEdgesPtr_; 00082 00083 00084 00085 // Private static data 00086 00087 //- Whether to use geometric or topological matching 00088 static bool geometricMatch_; 00089 00090 //- Relative tolerance (for geometric matching only). Is factor of 00091 // maximum edge length per face. 00092 static scalar matchTol_; 00093 00094 00095 protected: 00096 00097 // Protected Member functions 00098 00099 //- Initialise the calculation of the patch geometry 00100 void initGeometry(); 00101 00102 //- Calculate the patch geometry 00103 void calcGeometry(); 00104 00105 //- Initialise the patches for moving points 00106 void initMovePoints(const pointField&); 00107 00108 //- Correct patches after moving points 00109 void movePoints(const pointField&); 00110 00111 //- Initialise the update of the patch topology 00112 virtual void initUpdateMesh(); 00113 00114 //- Update of the patch topology 00115 virtual void updateMesh(); 00116 00117 00118 public: 00119 00120 //- Runtime type information 00121 TypeName("processor"); 00122 00123 00124 // Constructors 00125 00126 //- Construct from components 00127 processorPolyPatch 00128 ( 00129 const word& name, 00130 const label size, 00131 const label start, 00132 const label index, 00133 const polyBoundaryMesh& bm, 00134 const int myProcNo, 00135 const int neighbProcNo 00136 ); 00137 00138 //- Construct from dictionary 00139 processorPolyPatch 00140 ( 00141 const word& name, 00142 const dictionary& dict, 00143 const label index, 00144 const polyBoundaryMesh& 00145 ); 00146 00147 //- Construct as copy, resetting the boundary mesh 00148 processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&); 00149 00150 //- Construct as given the original patch and resetting the 00151 // face list and boundary mesh information 00152 processorPolyPatch 00153 ( 00154 const processorPolyPatch& pp, 00155 const polyBoundaryMesh& bm, 00156 const label index, 00157 const label newSize, 00158 const label newStart 00159 ); 00160 00161 //- Construct and return a clone, resetting the boundary mesh 00162 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const 00163 { 00164 return autoPtr<polyPatch>(new processorPolyPatch(*this, bm)); 00165 } 00166 00167 //- Construct and return a clone, resetting the face list 00168 // and boundary mesh 00169 virtual autoPtr<polyPatch> clone 00170 ( 00171 const polyBoundaryMesh& bm, 00172 const label index, 00173 const label newSize, 00174 const label newStart 00175 ) const 00176 { 00177 return autoPtr<polyPatch> 00178 ( 00179 new processorPolyPatch 00180 ( 00181 refCast<const processorPolyPatch>(*this), 00182 bm, 00183 index, 00184 newSize, 00185 newStart 00186 ) 00187 ); 00188 } 00189 00190 00191 // Destructor 00192 00193 virtual ~processorPolyPatch(); 00194 00195 00196 // Member functions 00197 00198 //- Return processor number 00199 int myProcNo() const 00200 { 00201 return myProcNo_; 00202 } 00203 00204 //- Return neigbour processor number 00205 int neighbProcNo() const 00206 { 00207 return neighbProcNo_; 00208 } 00209 00210 //- Does the processor own the patch ? 00211 bool owner() const 00212 { 00213 return (myProcNo_ < neighbProcNo_); 00214 } 00215 00216 //- Is the processor the patch neighbour ? 00217 bool neighbour() const 00218 { 00219 return !owner(); 00220 } 00221 00222 //- Return processor-neighbbour patch face centres 00223 const vectorField& neighbFaceCentres() const 00224 { 00225 return neighbFaceCentres_; 00226 } 00227 00228 //- Return processor-neighbbour patch face areas 00229 const vectorField& neighbFaceAreas() const 00230 { 00231 return neighbFaceAreas_; 00232 } 00233 00234 //- Return processor-neighbbour patch neighbour cell centres 00235 const vectorField& neighbFaceCellCentres() const 00236 { 00237 return neighbFaceCellCentres_; 00238 } 00239 00240 //- Return neighbour point labels. This is for my local point (-1 or) 00241 // the corresponding local point on the other side. It is -1 if 00242 // there are multiple corresponding points on this or the other side 00243 // (can happen for cyclics being converted into proc patches) 00244 const labelList& neighbPoints() const; 00245 00246 //- Return neighbour edge labels. This is for my local edge (-1 or) the 00247 // corresponding local edge on the other side. See above for -1 cause. 00248 const labelList& neighbEdges() const; 00249 00250 00251 //- Initialize ordering for primitivePatch. Does not 00252 // refer to *this (except for name() and type() etc.) 00253 virtual void initOrder(const primitivePatch&) const; 00254 00255 //- Return new ordering for primitivePatch. 00256 // Ordering is -faceMap: for every face 00257 // index of the new face -rotation:for every new face the clockwise 00258 // shift of the original face. Return false if nothing changes 00259 // (faceMap is identity, rotation is 0), true otherwise. 00260 virtual bool order 00261 ( 00262 const primitivePatch&, 00263 labelList& faceMap, 00264 labelList& rotation 00265 ) const; 00266 00267 00268 //- Write the polyPatch data as a dictionary 00269 virtual void write(Ostream&) const; 00270 }; 00271 00272 00273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00274 00275 } // End namespace Foam 00276 00277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00278 00279 #endif 00280 00281 // ************************************************************************* // |