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 
00028 
00029 #include "starMesh.H"
00030 
00031 
00032 
00033 
00034 
00035 bool starMesh::starEqualFace
00036 (
00037     const face& boundaryFace,
00038     const face& cellFace
00039 ) const
00040 {
00041     
00042     
00043     
00044     
00045     bool cellFaceHappy = false;
00046 
00047     label nEqual = 0;
00048 
00049     forAll (cellFace, cellFaceLabelI)
00050     {
00051         const label curCellFaceLabel = cellFace[cellFaceLabelI];
00052 
00053         forAll (boundaryFace, bouFaceLabelI)
00054         {
00055             if (boundaryFace[bouFaceLabelI] == curCellFaceLabel)
00056             {
00057                 nEqual++;
00058 
00059                 break;
00060             }
00061         }
00062     }
00063 
00064     if (nEqual >= 3)
00065     {
00066         cellFaceHappy = true;
00067     }
00068 
00069     
00070     bool boundaryFaceHappy = true;
00071 
00072     forAll (boundaryFace, bouFaceLabelI)
00073     {
00074         const label curBouFaceLabel = boundaryFace[bouFaceLabelI];
00075 
00076         bool found = false;
00077 
00078         forAll (cellFace, cellFaceLabelI)
00079         {
00080             if (curBouFaceLabel == cellFace[cellFaceLabelI])
00081             {
00082                 found = true;
00083                 break;
00084             }
00085         }
00086 
00087         boundaryFaceHappy = boundaryFaceHappy && found;
00088     }
00089 
00090     return (cellFaceHappy && boundaryFaceHappy);
00091 }
00092 
00093 
00094 void starMesh::markBoundaryFaces()
00095 {
00096     
00097     boundaryCellIDs_.setSize(boundary_.size());
00098     boundaryCellFaceIDs_.setSize(boundary_.size());
00099 
00100     forAll(boundary_, patchI)
00101     {
00102         const faceList& patchFaces = boundary_[patchI];
00103 
00104         
00105         labelList& curBoundaryCellIDs = boundaryCellIDs_[patchI];
00106         labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchI];
00107 
00108         curBoundaryCellIDs.setSize(patchFaces.size());
00109         curBoundaryCellFaceIDs.setSize(patchFaces.size());
00110 
00111         const labelListList& PointCells = pointCells();
00112 
00113         forAll(patchFaces, faceI)
00114         {
00115             bool found = false;
00116 
00117             const face& curFace = patchFaces[faceI];
00118             const labelList& facePoints = curFace;
00119 
00120             forAll(facePoints, pointI)
00121             {
00122                 const labelList& facePointCells =
00123                     PointCells[facePoints[pointI]];
00124 
00125                 forAll(facePointCells, cellI)
00126                 {
00127                     const label curCellIndex = facePointCells[cellI];
00128 
00129                     const faceList& curCellFaces = 
00130                         cellFaces_[curCellIndex];
00131 
00132                     forAll(curCellFaces, cellFaceI)
00133                     {
00134                         if (starEqualFace(curFace, curCellFaces[cellFaceI]))
00135                         {
00136                             
00137                             found = true;
00138 
00139                             
00140                             curBoundaryCellIDs[faceI] = curCellIndex;
00141                             curBoundaryCellFaceIDs[faceI] = cellFaceI;
00142                         }
00143                         if (found) break;
00144                     }
00145                     if (found) break;
00146                 }
00147                 if (found) break;
00148             }
00149             if (!found)
00150             {
00151                 FatalErrorIn("starMesh::markBoundaryFaces()")
00152                     << "Face " << faceI
00153                     << " does not have neighbour cell."
00154                     << " Face : " << endl << curFace << endl
00155                     << "PROSTAR Command: vset,news,vlis";
00156 
00157                 forAll (curFace, spI)
00158                 {
00159                     if (curFace[spI] > -1 && curFace[spI] < starPointID_.size())
00160                     {
00161                         Info << "," << starPointID_[curFace[spI]];
00162                     }
00163                     else
00164                     {
00165                         Info << ",???";
00166                     }
00167                 }
00168 
00169                 FatalError << " $ bset,add,vset,all" << abort(FatalError);
00170             }
00171         }
00172     }
00173 }
00174 
00175 
00176 void starMesh::collectBoundaryFaces()
00177 {
00178     Info << "Collecting boundary faces" << endl;
00179     forAll(boundary_, patchI)
00180     {
00181         faceList& patchFaces = boundary_[patchI];
00182 
00183         
00184         const labelList& curBoundaryCellIDs = boundaryCellIDs_[patchI];
00185         const labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchI];
00186 
00187         forAll (curBoundaryCellIDs, faceI)
00188         {
00189             patchFaces[faceI] =
00190                 cellFaces_[curBoundaryCellIDs[faceI]]
00191                     [curBoundaryCellFaceIDs[faceI]];
00192         }
00193     }
00194 
00195     Info << "Finished collecting boundary faces" << endl;
00196 }
00197 
00198 
00199