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