00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef fvMeshDistribute_H
00053 #define fvMeshDistribute_H
00054
00055 #include "Field.H"
00056 #include "fvMeshSubset.H"
00057
00058
00059
00060 namespace Foam
00061 {
00062
00063
00064 class mapAddedPolyMesh;
00065 class mapDistributePolyMesh;
00066
00067
00068
00069
00070
00071 class fvMeshDistribute
00072 {
00073
00074
00075
00076 fvMesh& mesh_;
00077
00078
00079
00080 const scalar mergeTol_;
00081
00082
00083
00084
00085
00086
00087 class checkEqualType
00088 {
00089 public:
00090
00091 void operator()(word& x, const word& y) const
00092 {
00093 if (x != y)
00094 {
00095 FatalErrorIn("checkEqualType()(word&, const word&) const")
00096 << "Patch type " << x << " possibly on processor "
00097 << Pstream::myProcNo()
00098 << " does not equal patch type " << y
00099 << " on some other processor." << nl
00100 << "Please check similarly named patches for"
00101 << " having exactly the same type."
00102 << abort(FatalError);
00103 }
00104 }
00105 };
00106
00107
00108
00109 class labelPairHash
00110 {
00111 public:
00112
00113 labelPairHash()
00114 {}
00115
00116 label operator()(const labelPair& p) const
00117 {
00118 return label(p[0]*p[0]+p[0]+p[1]);
00119 }
00120
00121 label operator()(const labelPair& p, const label tableSize) const
00122 {
00123 return mag(operator()(p)) % tableSize;
00124 }
00125 };
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 static labelList select
00137 (
00138 const bool selectEqual,
00139 const labelList& values,
00140 const label value
00141 );
00142
00143
00144 static void checkEqualWordList(const wordList&);
00145
00146
00147 static wordList mergeWordList(const wordList&);
00148
00149
00150
00151
00152
00153 label findNonEmptyPatch() const;
00154
00155
00156 label addProcPatch(const word& patchName, const label nbrProc);
00157
00158
00159 template<class GeoField>
00160 void addPatchFields(const word& patchFieldType);
00161
00162
00163 void deleteTrailingPatch();
00164
00165
00166 template<class GeoField>
00167 void deleteTrailingPatchFields();
00168
00169
00170 template <class T, class Mesh>
00171 void saveBoundaryFields
00172 (
00173 PtrList<FieldField<fvsPatchField, T> >& bflds
00174 ) const;
00175
00176
00177 template <class T, class Mesh>
00178 void mapBoundaryFields
00179 (
00180 const mapPolyMesh& map,
00181 const PtrList<FieldField<fvsPatchField, T> >& oldBflds
00182 );
00183
00184
00185 template<class GeoField>
00186 void initPatchFields
00187 (
00188 const word& patchFieldType,
00189 const typename GeoField::value_type& initVal
00190 );
00191
00192
00193
00194 autoPtr<mapPolyMesh> deleteProcPatches(const label patchI);
00195
00196
00197
00198
00199
00200
00201 autoPtr<mapPolyMesh> repatch
00202 (
00203 const labelList& newPatchID,
00204 labelListList& constructFaceMap
00205 );
00206
00207
00208
00209
00210 autoPtr<mapPolyMesh> mergeSharedPoints
00211 (
00212 labelListList& constructPointMap
00213 );
00214
00215
00216
00217
00218 void getNeighbourData
00219 (
00220 const labelList& distribution,
00221 labelList& sourceFace,
00222 labelList& sourceProc,
00223 labelList& sourceNewProc
00224 ) const;
00225
00226
00227 static void subsetBoundaryData
00228 (
00229 const fvMesh& mesh,
00230 const labelList& faceMap,
00231 const labelList& cellMap,
00232
00233 const labelList& oldDistribution,
00234 const labelList& oldFaceOwner,
00235 const labelList& oldFaceNeighbour,
00236 const label oldInternalFaces,
00237
00238 const labelList& sourceFace,
00239 const labelList& sourceProc,
00240 const labelList& sourceNewProc,
00241
00242 labelList& subFace,
00243 labelList& subProc,
00244 labelList& subNewProc
00245 );
00246
00247
00248
00249 static void findCouples
00250 (
00251 const primitiveMesh&,
00252 const labelList& sourceFace,
00253 const labelList& sourceProc,
00254
00255 const label domain,
00256 const primitiveMesh& domainMesh,
00257 const labelList& domainFace,
00258 const labelList& domainProc,
00259
00260 labelList& masterCoupledFaces,
00261 labelList& slaveCoupledFaces
00262 );
00263
00264
00265
00266 static labelList mapBoundaryData
00267 (
00268 const primitiveMesh& mesh,
00269 const mapAddedPolyMesh& map,
00270 const labelList& boundaryData0,
00271 const label nInternalFaces1,
00272 const labelList& boundaryData1
00273 );
00274
00275
00276
00277
00278
00279 autoPtr<mapPolyMesh> doRemoveCells
00280 (
00281 const labelList& cellsToRemove,
00282 const label oldInternalPatchI
00283 );
00284
00285
00286
00287 void addProcPatches
00288 (
00289 const labelList&,
00290 labelList& procPatchID
00291 );
00292
00293
00294 static labelList getProcBoundaryPatch
00295 (
00296 const labelList& neighbourNewProc,
00297 const labelList& procPatchID
00298 );
00299
00300
00301 static void sendMesh
00302 (
00303 const label domain,
00304 const fvMesh& mesh,
00305 const wordList& pointZoneNames,
00306 const wordList& facesZoneNames,
00307 const wordList& cellZoneNames,
00308 const labelList& sourceFace,
00309 const labelList& sourceProc,
00310 const labelList& sourceNewProc
00311 );
00312
00313 template<class GeoField>
00314 static void sendFields
00315 (
00316 const label domain,
00317 const wordList& fieldNames,
00318 const fvMeshSubset&
00319 );
00320
00321
00322 static autoPtr<fvMesh> receiveMesh
00323 (
00324 const label domain,
00325 const wordList& pointZoneNames,
00326 const wordList& facesZoneNames,
00327 const wordList& cellZoneNames,
00328 Time& runTime,
00329 labelList& domainSourceFace,
00330 labelList& domainSourceProc,
00331 labelList& domainSourceNewProc
00332 );
00333
00334
00335 template<class GeoField>
00336 static void receiveFields
00337 (
00338 const label domain,
00339 const wordList& fieldNames,
00340 fvMesh&,
00341 PtrList<GeoField>&
00342 );
00343
00344
00345 fvMeshDistribute(const fvMeshDistribute&);
00346
00347
00348 void operator=(const fvMeshDistribute&);
00349
00350 public:
00351
00352 ClassName("fvMeshDistribute");
00353
00354
00355
00356
00357
00358 fvMeshDistribute(fvMesh& mesh, const scalar mergeTol);
00359
00360
00361
00362
00363
00364 static labelList countCells(const labelList&);
00365
00366
00367
00368 autoPtr<mapDistributePolyMesh> distribute(const labelList& dist);
00369
00370
00371
00372
00373 static void printCoupleInfo
00374 (
00375 const primitiveMesh&,
00376 const labelList&,
00377 const labelList&,
00378 const labelList&
00379 );
00380
00381
00382 template<class GeoField>
00383 static void printFieldInfo(const fvMesh&);
00384
00385
00386 static void printMeshInfo(const fvMesh&);
00387 };
00388
00389
00390
00391
00392 }
00393
00394
00395
00396 #ifdef NoRepository
00397 # include "fvMeshDistributeTemplates.C"
00398 #endif
00399
00400
00401
00402 #endif
00403
00404
Copyright © 2000-2007 OpenCFD Ltd