distributeCells.C
Go to the documentation of this file.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 #include "domainDecomposition.H"
00028 #include "decompositionMethod.H"
00029 #include "cpuTime.H"
00030 #include "cyclicPolyPatch.H"
00031 #include "cellSet.H"
00032 #include "regionSplit.H"
00033
00034
00035
00036 void domainDecomposition::distributeCells()
00037 {
00038 Info<< "\nCalculating distribution of cells" << endl;
00039
00040 cpuTime decompositionTime;
00041
00042
00043
00044
00045
00046 labelHashSet sameProcFaces;
00047
00048 if (decompositionDict_.found("preserveFaceZones"))
00049 {
00050 wordList zNames(decompositionDict_.lookup("preserveFaceZones"));
00051
00052 Info<< "Keeping owner and neighbour of faces in zones " << zNames
00053 << " on same processor" << endl;
00054
00055 const faceZoneMesh& fZones = faceZones();
00056
00057 forAll(zNames, i)
00058 {
00059 label zoneI = fZones.findZoneID(zNames[i]);
00060
00061 if (zoneI == -1)
00062 {
00063 FatalErrorIn("domainDecomposition::distributeCells()")
00064 << "Unknown preserveFaceZone " << zNames[i]
00065 << endl << "Valid faceZones are " << fZones.names()
00066 << exit(FatalError);
00067 }
00068
00069 const faceZone& fz = fZones[zoneI];
00070
00071 forAll(fz, i)
00072 {
00073 sameProcFaces.insert(fz[i]);
00074 }
00075 }
00076 }
00077
00078
00079
00080
00081
00082
00083 autoPtr<decompositionMethod> decomposePtr = decompositionMethod::New
00084 (
00085 decompositionDict_,
00086 *this
00087 );
00088
00089 if (sameProcFaces.empty())
00090 {
00091 cellToProc_ = decomposePtr().decompose(cellCentres());
00092 }
00093 else
00094 {
00095 Info<< "Selected " << sameProcFaces.size()
00096 << " faces whose owner and neighbour cell should be kept on the"
00097 << " same processor" << endl;
00098
00099
00100
00101 boolList blockedFace(nFaces(), true);
00102
00103 forAllConstIter(labelHashSet, sameProcFaces, iter)
00104 {
00105 blockedFace[iter.key()] = false;
00106 }
00107
00108
00109 const polyBoundaryMesh& patches = boundaryMesh();
00110
00111 forAll(patches, patchI)
00112 {
00113 const polyPatch& pp = patches[patchI];
00114
00115 if (pp.coupled())
00116 {
00117 forAll(pp, i)
00118 {
00119 blockedFace[pp.start()+i] = false;
00120 }
00121 }
00122 }
00123
00124
00125 regionSplit globalRegion(*this, blockedFace);
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 const point greatPoint(GREAT, GREAT, GREAT);
00137
00138 pointField regionCentres(globalRegion.nRegions(), greatPoint);
00139
00140 forAll(globalRegion, cellI)
00141 {
00142 label regionI = globalRegion[cellI];
00143
00144 if (regionCentres[regionI] == greatPoint)
00145 {
00146 regionCentres[regionI] = cellCentres()[cellI];
00147 }
00148 }
00149
00150
00151
00152 cellToProc_ = decomposePtr().decompose(globalRegion, regionCentres);
00153 }
00154
00155 Info<< "\nFinished decomposition in "
00156 << decompositionTime.elapsedCpuTime()
00157 << " s" << endl;
00158 }
00159
00160
00161
Copyright © 2000-2009 OpenCFD Ltd