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