OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

decomposeMesh.C

Go 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 InClass
00026     domainDecomposition
00027 
00028 Description
00029     Private member of domainDecomposition.
00030     Decomposes the mesh into bits
00031 
00032 \*---------------------------------------------------------------------------*/
00033 
00034 #include "domainDecomposition.H"
00035 #include "IOstreams.H"
00036 #include "SLPtrList.H"
00037 #include "boolList.H"
00038 #include "primitiveMesh.H"
00039 #include "cyclicPolyPatch.H"
00040 
00041 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00042 
00043 void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
00044 {
00045     // Decide which cell goes to which processor
00046     distributeCells();
00047 
00048     // Distribute the cells according to the given processor label
00049 
00050     // calculate the addressing information for the original mesh
00051     Info<< "\nCalculating original mesh data" << endl;
00052 
00053     // set references to the original mesh
00054     const polyBoundaryMesh& patches = boundaryMesh();
00055     const faceList& fcs = faces();
00056     const labelList& owner = faceOwner();
00057     const labelList& neighbour = faceNeighbour();
00058 
00059     // loop through the list of processor labels for the cell and add the
00060     // cell shape to the list of cells for the appropriate processor
00061 
00062     Info<< "\nDistributing cells to processors" << endl;
00063 
00064     // Memory management
00065     {
00066         List<SLList<label> > procCellList(nProcs_);
00067 
00068         forAll (cellToProc_, celli)
00069         {
00070             if (cellToProc_[celli] >= nProcs_)
00071             {
00072                 FatalErrorIn("domainDecomposition::decomposeMesh()")
00073                     << "Impossible processor label " << cellToProc_[celli]
00074                     << "for cell " << celli
00075                     << abort(FatalError);
00076             }
00077             else
00078             {
00079                 procCellList[cellToProc_[celli]].append(celli);
00080             }
00081         }
00082 
00083         // Convert linked lists into normal lists
00084         forAll (procCellList, procI)
00085         {
00086             procCellAddressing_[procI] = procCellList[procI];
00087         }
00088     }
00089 
00090     Info << "\nDistributing faces to processors" << endl;
00091 
00092     // Loop through all internal faces and decide which processor they belong to
00093     // First visit all internal faces. If cells at both sides belong to the
00094     // same processor, the face is an internal face. If they are different,
00095     // it belongs to both processors.
00096 
00097     // Memory management
00098     {
00099         List<SLList<label> > procFaceList(nProcs_);
00100 
00101         forAll (neighbour, facei)
00102         {
00103             if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]])
00104             {
00105                 // Face internal to processor
00106                 procFaceList[cellToProc_[owner[facei]]].append(facei);
00107             }
00108         }
00109 
00110         // Detect inter-processor boundaries
00111 
00112         // Neighbour processor for each subdomain
00113         List<SLList<label> > interProcBoundaries(nProcs_);
00114 
00115         // Face labels belonging to each inter-processor boundary
00116         List<SLList<SLList<label> > > interProcBFaces(nProcs_);
00117 
00118         List<SLList<label> > procPatchIndex(nProcs_);
00119 
00120         forAll (neighbour, facei)
00121         {
00122             if (cellToProc_[owner[facei]] != cellToProc_[neighbour[facei]])
00123             {
00124                 // inter - processor patch face found. Go through the list of
00125                 // inside boundaries for the owner processor and try to find
00126                 // this inter-processor patch.
00127 
00128                 label ownerProc = cellToProc_[owner[facei]];
00129                 label neighbourProc = cellToProc_[neighbour[facei]];
00130 
00131                 SLList<label>::iterator curInterProcBdrsOwnIter =
00132                     interProcBoundaries[ownerProc].begin();
00133 
00134                 SLList<SLList<label> >::iterator curInterProcBFacesOwnIter =
00135                     interProcBFaces[ownerProc].begin();
00136 
00137                 bool interProcBouFound = false;
00138 
00139                 // WARNING: Synchronous SLList iterators
00140 
00141                 for
00142                 (
00143                     ;
00144                     curInterProcBdrsOwnIter
00145                  != interProcBoundaries[ownerProc].end()
00146                  && curInterProcBFacesOwnIter
00147                  != interProcBFaces[ownerProc].end();
00148                     ++curInterProcBdrsOwnIter, ++curInterProcBFacesOwnIter
00149                 )
00150                 {
00151                     if (curInterProcBdrsOwnIter() == neighbourProc)
00152                     {
00153                         // the inter - processor boundary exists. Add the face
00154                         interProcBouFound = true;
00155 
00156                         curInterProcBFacesOwnIter().append(facei);
00157 
00158                         SLList<label>::iterator curInterProcBdrsNeiIter =
00159                             interProcBoundaries[neighbourProc].begin();
00160 
00161                         SLList<SLList<label> >::iterator 
00162                             curInterProcBFacesNeiIter =
00163                             interProcBFaces[neighbourProc].begin();
00164 
00165                         bool neighbourFound = false;
00166 
00167                         // WARNING: Synchronous SLList iterators
00168 
00169                         for
00170                         (
00171                             ;
00172                             curInterProcBdrsNeiIter !=
00173                             interProcBoundaries[neighbourProc].end()
00174                          && curInterProcBFacesNeiIter !=
00175                             interProcBFaces[neighbourProc].end();
00176                             ++curInterProcBdrsNeiIter,
00177                             ++curInterProcBFacesNeiIter
00178                         )
00179                         {
00180                             if (curInterProcBdrsNeiIter() == ownerProc)
00181                             {
00182                                 // boundary found. Add the face
00183                                 neighbourFound = true;
00184 
00185                                 curInterProcBFacesNeiIter().append(facei);
00186                             }
00187 
00188                             if (neighbourFound) break;
00189                         }
00190 
00191                         if (interProcBouFound && !neighbourFound)
00192                         {
00193                             FatalErrorIn("domainDecomposition::decomposeMesh()")
00194                                 << "Inconsistency in inter - "
00195                                 << "processor boundary lists for processors "
00196                                 << ownerProc << " and " << neighbourProc
00197                                 << abort(FatalError);
00198                         }
00199                     }
00200 
00201                     if (interProcBouFound) break;
00202                 }
00203 
00204                 if (!interProcBouFound)
00205                 {
00206                     // inter - processor boundaries do not exist and need to
00207                     // be created
00208 
00209                     // set the new addressing information
00210 
00211                     // owner
00212                     interProcBoundaries[ownerProc].append(neighbourProc);
00213                     interProcBFaces[ownerProc].append(SLList<label>(facei));
00214 
00215                     // neighbour
00216                     interProcBoundaries[neighbourProc].append(ownerProc);
00217                     interProcBFaces[neighbourProc].append(SLList<label>(facei));
00218                 }
00219             }
00220         }
00221 
00222         // Loop through patches. For cyclic boundaries detect inter-processor
00223         // faces; for all other, add faces to the face list and remember start
00224         // and size of all patches.
00225 
00226         // for all processors, set the size of start index and patch size
00227         // lists to the number of patches in the mesh
00228         forAll (procPatchSize_, procI)
00229         {
00230             procPatchSize_[procI].setSize(patches.size());
00231             procPatchStartIndex_[procI].setSize(patches.size());
00232         }
00233 
00234         forAll (patches, patchi)
00235         {
00236             // Reset size and start index for all processors
00237             forAll (procPatchSize_, procI)
00238             {
00239                 procPatchSize_[procI][patchi] = 0;
00240                 procPatchStartIndex_[procI][patchi] =
00241                     procFaceList[procI].size();
00242             }
00243 
00244             const label patchStart = patches[patchi].start();
00245 
00246             if (typeid(patches[patchi]) != typeid(cyclicPolyPatch))
00247             {
00248                 // Normal patch. Add faces to processor where the cell
00249                 // next to the face lives
00250 
00251                 const unallocLabelList& patchFaceCells =
00252                     patches[patchi].faceCells();
00253 
00254                 forAll (patchFaceCells, facei)
00255                 {
00256                     const label curProc = cellToProc_[patchFaceCells[facei]];
00257 
00258                     // add the face
00259                     procFaceList[curProc].append(patchStart + facei);
00260 
00261                     // increment the number of faces for this patch
00262                     procPatchSize_[curProc][patchi]++;
00263                 }
00264             }
00265             else
00266             {
00267                 // Cyclic patch special treatment
00268 
00269                 const polyPatch& cPatch = patches[patchi];
00270 
00271                 const label cycOffset = cPatch.size()/2;
00272 
00273                 // Set reference to faceCells for both patches
00274                 const labelList::subList firstFaceCells
00275                 (
00276                     cPatch.faceCells(),
00277                     cycOffset
00278                 );
00279 
00280                 const labelList::subList secondFaceCells
00281                 (
00282                     cPatch.faceCells(),
00283                     cycOffset,
00284                     cycOffset
00285                 );
00286 
00287                 forAll (firstFaceCells, facei)
00288                 {
00289                     if
00290                     (
00291                         cellToProc_[firstFaceCells[facei]]
00292                      != cellToProc_[secondFaceCells[facei]]
00293                     )
00294                     {
00295                         // This face becomes an inter-processor boundary face
00296                         // inter - processor patch face found. Go through
00297                         // the list of inside boundaries for the owner
00298                         // processor and try to find this inter-processor
00299                         // patch.
00300 
00301                         cyclicParallel_ = true;
00302 
00303                         label ownerProc = cellToProc_[firstFaceCells[facei]];
00304                         label neighbourProc =
00305                             cellToProc_[secondFaceCells[facei]];
00306 
00307                         SLList<label>::iterator curInterProcBdrsOwnIter =
00308                             interProcBoundaries[ownerProc].begin();
00309 
00310                         SLList<SLList<label> >::iterator 
00311                             curInterProcBFacesOwnIter =
00312                             interProcBFaces[ownerProc].begin();
00313 
00314                         bool interProcBouFound = false;
00315 
00316                         // WARNING: Synchronous SLList iterators
00317 
00318                         for
00319                         (
00320                             ;
00321                             curInterProcBdrsOwnIter !=
00322                             interProcBoundaries[ownerProc].end()
00323                          && curInterProcBFacesOwnIter !=
00324                             interProcBFaces[ownerProc].end();
00325                             ++curInterProcBdrsOwnIter,
00326                             ++curInterProcBFacesOwnIter
00327                         )
00328                         {
00329                             if (curInterProcBdrsOwnIter() == neighbourProc)
00330                             {
00331                                 // the inter - processor boundary exists.
00332                                 // Add the face
00333                                 interProcBouFound = true;
00334 
00335                                 curInterProcBFacesOwnIter().append
00336                                     (patchStart + facei);
00337 
00338                                 SLList<label>::iterator curInterProcBdrsNeiIter
00339                                    = interProcBoundaries[neighbourProc].begin();
00340 
00341                                 SLList<SLList<label> >::iterator
00342                                     curInterProcBFacesNeiIter =
00343                                     interProcBFaces[neighbourProc].begin();
00344 
00345                                 bool neighbourFound = false;
00346 
00347                                 // WARNING: Synchronous SLList iterators
00348 
00349                                 for
00350                                 (
00351                                     ;
00352                                     curInterProcBdrsNeiIter
00353                                    != interProcBoundaries[neighbourProc].end()
00354                                  && curInterProcBFacesNeiIter
00355                                    != interProcBFaces[neighbourProc].end();
00356                                     ++curInterProcBdrsNeiIter,
00357                                     ++curInterProcBFacesNeiIter
00358                                 )
00359                                 {
00360                                     if (curInterProcBdrsNeiIter() == ownerProc)
00361                                     {
00362                                         // boundary found. Add the face
00363                                         neighbourFound = true;
00364 
00365                                         curInterProcBFacesNeiIter()
00366                                             .append
00367                                             (
00368                                                 patchStart
00369                                               + cycOffset
00370                                               + facei
00371                                             );
00372                                     }
00373 
00374                                     if (neighbourFound) break;
00375                                 }
00376 
00377                                 if (interProcBouFound && !neighbourFound)
00378                                 {
00379                                     FatalErrorIn
00380                                     (
00381                                         "domainDecomposition::decomposeMesh()"
00382                                     )   << "Inconsistency in inter-processor "
00383                                         << "boundary lists for processors "
00384                                         << ownerProc << " and " << neighbourProc
00385                                         << " in cyclic boundary matching"
00386                                         << abort(FatalError);
00387                                 }
00388                             }
00389 
00390                             if (interProcBouFound) break;
00391                         }
00392 
00393                         if (!interProcBouFound)
00394                         {
00395                             // inter - processor boundaries do not exist
00396                             // and need to be created
00397 
00398                             // set the new addressing information
00399 
00400                             // owner
00401                             interProcBoundaries[ownerProc]
00402                                 .append(neighbourProc);
00403                             interProcBFaces[ownerProc]
00404                                 .append(SLList<label>(patchStart + facei));
00405 
00406                             // neighbour
00407                             interProcBoundaries[neighbourProc]
00408                                 .append(ownerProc);
00409                             interProcBFaces[neighbourProc]
00410                                 .append
00411                                 (
00412                                     SLList<label>
00413                                     (
00414                                         patchStart
00415                                       + cycOffset
00416                                       + facei
00417                                     )
00418                                 );
00419                         }
00420                     }
00421                     else
00422                     {
00423                         // This cyclic face remains on the processor
00424                         label ownerProc = cellToProc_[firstFaceCells[facei]];
00425 
00426                         // add the face
00427                         procFaceList[ownerProc].append(patchStart + facei);
00428 
00429                         // increment the number of faces for this patch
00430                         procPatchSize_[ownerProc][patchi]++;
00431 
00432                         // Note: I cannot add the other side of the cyclic
00433                         // boundary here because this would violate the order.
00434                         // They will be added in a separate loop below
00435                         // 
00436                     }
00437                 }
00438 
00439                 // Ordering in cyclic boundaries is important.
00440                 // Add the other half of cyclic faces for cyclic boundaries
00441                 // that remain on the processor
00442                 forAll (secondFaceCells, facei)
00443                 {
00444                     if
00445                     (
00446                         cellToProc_[firstFaceCells[facei]]
00447                      == cellToProc_[secondFaceCells[facei]]
00448                     )
00449                     {
00450                         // This cyclic face remains on the processor
00451                         label ownerProc = cellToProc_[firstFaceCells[facei]];
00452 
00453                         // add the second face
00454                         procFaceList[ownerProc].append
00455                             (patchStart + cycOffset + facei);
00456 
00457                         // increment the number of faces for this patch
00458                         procPatchSize_[ownerProc][patchi]++;
00459                     }
00460                 }
00461             }
00462         }
00463 
00464         // Convert linked lists into normal lists
00465         // Add inter-processor boundaries and remember start indices
00466         forAll (procFaceList, procI)
00467         {
00468             // Get internal and regular boundary processor faces
00469             SLList<label>& curProcFaces = procFaceList[procI];
00470 
00471             // Get reference to processor face addressing
00472             labelList& curProcFaceAddressing = procFaceAddressing_[procI];
00473 
00474             labelList& curProcNeighbourProcessors =
00475                 procNeighbourProcessors_[procI];
00476 
00477             labelList& curProcProcessorPatchSize =
00478                 procProcessorPatchSize_[procI];
00479 
00480             labelList& curProcProcessorPatchStartIndex =
00481                 procProcessorPatchStartIndex_[procI];
00482 
00483             // calculate the size
00484             label nFacesOnProcessor = curProcFaces.size();
00485 
00486             for 
00487             (
00488                 SLList<SLList<label> >::iterator curInterProcBFacesIter =
00489                     interProcBFaces[procI].begin();
00490                 curInterProcBFacesIter != interProcBFaces[procI].end();
00491                 ++curInterProcBFacesIter
00492             )
00493             {
00494                 nFacesOnProcessor += curInterProcBFacesIter().size();
00495             }
00496 
00497             curProcFaceAddressing.setSize(nFacesOnProcessor);
00498 
00499             // Fill in the list. Calculate turning index.
00500             // Turning index will be -1 only for some faces on processor
00501             // boundaries, i.e. the ones where the current processor ID
00502             // is in the cell which is a face neighbour.
00503             // Turning index is stored as the sign of the face addressing list
00504 
00505             label nFaces = 0;
00506 
00507             // Add internal and boundary faces
00508             // Remember to increment the index by one such that the
00509             // turning index works properly.  
00510             for
00511             (
00512                 SLList<label>::iterator curProcFacesIter = curProcFaces.begin();
00513                 curProcFacesIter != curProcFaces.end();
00514                 ++curProcFacesIter
00515             )
00516             {
00517                 curProcFaceAddressing[nFaces] = curProcFacesIter() + 1;
00518                 nFaces++;
00519             }
00520 
00521             // Add inter-processor boundary faces. At the beginning of each
00522             // patch, grab the patch start index and size
00523 
00524             curProcNeighbourProcessors.setSize
00525             (
00526                 interProcBoundaries[procI].size()
00527             );
00528 
00529             curProcProcessorPatchSize.setSize
00530             (
00531                 interProcBoundaries[procI].size()
00532             );
00533 
00534             curProcProcessorPatchStartIndex.setSize
00535             (
00536                 interProcBoundaries[procI].size()
00537             );
00538 
00539             label nProcPatches = 0;
00540 
00541             SLList<label>::iterator curInterProcBdrsIter =
00542                 interProcBoundaries[procI].begin();
00543 
00544             SLList<SLList<label> >::iterator curInterProcBFacesIter =
00545                 interProcBFaces[procI].begin();
00546 
00547             for
00548             (
00549                 ;
00550                 curInterProcBdrsIter != interProcBoundaries[procI].end()
00551              && curInterProcBFacesIter != interProcBFaces[procI].end();
00552                 ++curInterProcBdrsIter, ++curInterProcBFacesIter
00553             )
00554             {
00555                 curProcNeighbourProcessors[nProcPatches] =
00556                     curInterProcBdrsIter();
00557 
00558                 // Get start index for processor patch
00559                 curProcProcessorPatchStartIndex[nProcPatches] = nFaces;
00560 
00561                 label& curSize =
00562                     curProcProcessorPatchSize[nProcPatches];
00563 
00564                 curSize = 0;
00565 
00566                 // add faces for this processor boundary
00567 
00568                 for
00569                 (
00570                     SLList<label>::iterator curFacesIter =
00571                         curInterProcBFacesIter().begin();
00572                     curFacesIter != curInterProcBFacesIter().end();
00573                     ++curFacesIter
00574                 )
00575                 {
00576                     // add the face
00577 
00578                     // Remember to increment the index by one such that the
00579                     // turning index works properly.  
00580                     if (cellToProc_[owner[curFacesIter()]] == procI)
00581                     {
00582                         curProcFaceAddressing[nFaces] = curFacesIter() + 1;
00583                     }
00584                     else
00585                     {
00586                         // turning face
00587                         curProcFaceAddressing[nFaces] = -(curFacesIter() + 1);
00588                     }
00589 
00590                     // increment the size
00591                     curSize++;
00592 
00593                     nFaces++;
00594                 }
00595 
00596                 nProcPatches++;
00597             }
00598         }
00599     }
00600 
00601     Info << "\nCalculating processor boundary addressing" << endl;
00602     // For every patch of processor boundary, find the index of the original
00603     // patch. Mis-alignment is caused by the fact that patches with zero size
00604     // are omitted. For processor patches, set index to -1.
00605     // At the same time, filter the procPatchSize_ and procPatchStartIndex_
00606     // lists to exclude zero-size patches
00607     forAll (procPatchSize_, procI)
00608     {
00609         // Make a local copy of old lists
00610         const labelList oldPatchSizes = procPatchSize_[procI];
00611 
00612         const labelList oldPatchStarts = procPatchStartIndex_[procI];
00613 
00614         labelList& curPatchSizes = procPatchSize_[procI];
00615 
00616         labelList& curPatchStarts = procPatchStartIndex_[procI];
00617 
00618         const labelList& curProcessorPatchSizes =
00619             procProcessorPatchSize_[procI];
00620 
00621         labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
00622 
00623         curBoundaryAddressing.setSize
00624         (
00625             oldPatchSizes.size()
00626           + curProcessorPatchSizes.size()
00627         );
00628 
00629         label nPatches = 0;
00630 
00631         forAll (oldPatchSizes, patchi)
00632         {
00633             if (!filterEmptyPatches || oldPatchSizes[patchi] > 0)
00634             {
00635                 curBoundaryAddressing[nPatches] = patchi;
00636 
00637                 curPatchSizes[nPatches] = oldPatchSizes[patchi];
00638 
00639                 curPatchStarts[nPatches] = oldPatchStarts[patchi];
00640 
00641                 nPatches++;
00642             }
00643         }
00644 
00645         // reset to the size of live patches
00646         curPatchSizes.setSize(nPatches);
00647         curPatchStarts.setSize(nPatches);
00648 
00649         forAll (curProcessorPatchSizes, procPatchI)
00650         {
00651             curBoundaryAddressing[nPatches] = -1;
00652 
00653             nPatches++;
00654         }
00655 
00656         curBoundaryAddressing.setSize(nPatches);
00657     }
00658 
00659     Info << "\nDistributing points to processors" << endl;
00660     // For every processor, loop through the list of faces for the processor.
00661     // For every face, loop through the list of points and mark the point as
00662     // used for the processor. Collect the list of used points for the
00663     // processor.
00664 
00665     forAll (procPointAddressing_, procI)
00666     {
00667         boolList pointLabels(nPoints(), false);
00668 
00669         // Get reference to list of used faces
00670         const labelList& procFaceLabels = procFaceAddressing_[procI];
00671 
00672         forAll (procFaceLabels, facei)
00673         {
00674             // Because of the turning index, some labels may be negative
00675             const labelList& facePoints = fcs[mag(procFaceLabels[facei]) - 1];
00676 
00677             forAll (facePoints, pointi)
00678             {
00679                 // Mark the point as used
00680                 pointLabels[facePoints[pointi]] = true;
00681             }
00682         }
00683 
00684         // Collect the used points
00685         labelList& procPointLabels = procPointAddressing_[procI];
00686 
00687         procPointLabels.setSize(pointLabels.size());
00688 
00689         label nUsedPoints = 0;
00690 
00691         forAll (pointLabels, pointi)
00692         {
00693             if (pointLabels[pointi])
00694             {
00695                 procPointLabels[nUsedPoints] = pointi;
00696 
00697                 nUsedPoints++;
00698             }
00699         }
00700 
00701         // Reset the size of used points
00702         procPointLabels.setSize(nUsedPoints);
00703     }
00704 
00705     // Gather data about globally shared points
00706 
00707     // Memory management
00708     {
00709         labelList pointsUsage(nPoints(), 0);
00710 
00711         // Globally shared points are the ones used by more than 2 processors
00712         // Size the list approximately and gather the points
00713         labelHashSet gSharedPoints
00714         (
00715             min(100, nPoints()/1000)
00716         );
00717 
00718         // Loop through all the processors and mark up points used by
00719         // processor boundaries.  When a point is used twice, it is a
00720         // globally shared point
00721 
00722         for (label procI = 0; procI < nProcs_; procI++)
00723         {
00724             // Get list of face labels
00725             const labelList& curFaceLabels = procFaceAddressing_[procI];
00726 
00727             // Get start of processor faces
00728             const labelList& curProcessorPatchStarts =
00729                 procProcessorPatchStartIndex_[procI];
00730 
00731             const labelList& curProcessorPatchSizes =
00732                 procProcessorPatchSize_[procI];
00733 
00734             // Reset the lookup list
00735             pointsUsage = 0;
00736 
00737             forAll (curProcessorPatchStarts, patchi)
00738             {
00739                 const label curStart = curProcessorPatchStarts[patchi];
00740                 const label curEnd = curStart + curProcessorPatchSizes[patchi];
00741 
00742                 for
00743                 (
00744                     label facei = curStart;
00745                     facei < curEnd;
00746                     facei++
00747                 )
00748                 {
00749                     // Mark the original face as used
00750                     // Remember to decrement the index by one (turning index)
00751                     // 
00752                     const label curF = mag(curFaceLabels[facei]) - 1;
00753 
00754                     const face& f = fcs[curF];
00755 
00756                     forAll (f, pointi)
00757                     {
00758                         if (pointsUsage[f[pointi]] == 0)
00759                         {
00760                             // Point not previously used
00761                             pointsUsage[f[pointi]] = patchi + 1;
00762                         }
00763                         else if (pointsUsage[f[pointi]] != patchi + 1)
00764                         {
00765                             // Point used by some other patch = global point!
00766                             gSharedPoints.insert(f[pointi]);
00767                         }
00768                     }
00769                 }
00770             }
00771         }
00772 
00773         // Grab the result from the hash list
00774         globallySharedPoints_ = gSharedPoints.toc();
00775         sort(globallySharedPoints_);
00776     }
00777 }
Copyright © 2000-2009 OpenCFD Ltd