![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 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 initUpdateTopology(); 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 Istream 00139 processorPolyPatch 00140 ( 00141 Istream& is, 00142 const label index, 00143 const polyBoundaryMesh& 00144 ); 00145 00146 //- Construct from dictionary 00147 processorPolyPatch 00148 ( 00149 const word& name, 00150 const dictionary& dict, 00151 const label index, 00152 const polyBoundaryMesh& 00153 ); 00154 00155 //- Construct as copy, resetting the boundary mesh 00156 processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&); 00157 00158 //- Construct as given the original patch and resetting the 00159 // face list and boundary mesh information 00160 processorPolyPatch 00161 ( 00162 const processorPolyPatch& pp, 00163 const polyBoundaryMesh& bm, 00164 const label index, 00165 const label newSize, 00166 const label newStart 00167 ); 00168 00169 //- Construct and return a clone, resetting the boundary mesh 00170 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const 00171 { 00172 return autoPtr<polyPatch>(new processorPolyPatch(*this, bm)); 00173 } 00174 00175 //- Construct and return a clone, resetting the face list 00176 // and boundary mesh 00177 virtual autoPtr<polyPatch> clone 00178 ( 00179 const polyBoundaryMesh& bm, 00180 const label index, 00181 const label newSize, 00182 const label newStart 00183 ) const 00184 { 00185 return autoPtr<polyPatch> 00186 ( 00187 new processorPolyPatch 00188 ( 00189 refCast<const processorPolyPatch>(*this), 00190 bm, 00191 index, 00192 newSize, 00193 newStart 00194 ) 00195 ); 00196 } 00197 00198 00199 // Destructor 00200 00201 virtual ~processorPolyPatch(); 00202 00203 00204 // Member functions 00205 00206 //- Return processor number 00207 int myProcNo() const 00208 { 00209 return myProcNo_; 00210 } 00211 00212 //- Return neigbour processor number 00213 int neighbProcNo() const 00214 { 00215 return neighbProcNo_; 00216 } 00217 00218 //- Does the processor own the patch ? 00219 bool owner() const 00220 { 00221 return (myProcNo_ < neighbProcNo_); 00222 } 00223 00224 //- Is the processor the patch neighbour ? 00225 bool neighbour() const 00226 { 00227 return !owner(); 00228 } 00229 00230 //- Force calculation of transformation tensors 00231 void calcTransformTensors 00232 ( 00233 const vectorField& Cf, 00234 const vectorField& Cr, 00235 const vectorField& nf, 00236 const vectorField& nr 00237 ) const 00238 { 00239 coupledPolyPatch::calcTransformTensors(Cf, Cr, nf, nr); 00240 } 00241 00242 //- Return processor-neighbbour patch face centres 00243 const vectorField& neighbFaceCentres() const 00244 { 00245 return neighbFaceCentres_; 00246 } 00247 00248 //- Return processor-neighbbour patch face areas 00249 const vectorField& neighbFaceAreas() const 00250 { 00251 return neighbFaceAreas_; 00252 } 00253 00254 //- Return processor-neighbbour patch neighbour cell centres 00255 const vectorField& neighbFaceCellCentres() const 00256 { 00257 return neighbFaceCellCentres_; 00258 } 00259 00260 //- Return neighbour point labels. This is for my local point the 00261 // corresponding local point on the other side. Call 00262 // polyBoundaryMesh::setExtendedAddressing(true) on all processors 00263 // before using this. 00264 const labelList& neighbPoints() const; 00265 00266 //- Return neighbour edge labels. This is for my local edge the 00267 // corresponding local edge on the other side. Call 00268 // polyBoundaryMesh::setExtendedAddressing(true) on all processors 00269 // before using this. 00270 const labelList& neighbEdges() const; 00271 00272 00273 //- Initialize ordering for primitivePatch. Does not 00274 // refer to *this (except for name() and type() etc.) 00275 virtual void initOrder(const primitivePatch&) const; 00276 00277 //- Return new ordering for primitivePatch. 00278 // Ordering is -faceMap: for every face 00279 // index of the new face -rotation:for every new face the clockwise 00280 // shift of the original face. Return false if nothing changes 00281 // (faceMap is identity, rotation is 0), true otherwise. 00282 virtual bool order 00283 ( 00284 const primitivePatch&, 00285 labelList& faceMap, 00286 labelList& rotation 00287 ) const; 00288 00289 00290 //- Write 00291 virtual void write(Ostream&) const; 00292 00293 //- Write dictionary 00294 virtual void writeDict(Ostream&) const; 00295 }; 00296 00297 00298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00299 00300 } // End namespace Foam 00301 00302 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00303 00304 #endif 00305 00306 // ************************************************************************* //