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 "sammMesh.H"
00030
00031
00032
00033 void sammMesh::createPolyCells()
00034 {
00035
00036
00037
00038
00039 cellPolys_.setSize(cellShapes_.size());
00040
00041 label maxFaces = 0;
00042
00043 forAll (cellPolys_, cellI)
00044 {
00045 cell& curCell = cellPolys_[cellI];
00046
00047 curCell.setSize(cellFaces_[cellI].size());
00048
00049 forAll (curCell, fI)
00050 {
00051 curCell[fI] = -1;
00052 }
00053
00054 maxFaces += cellFaces_[cellI].size();
00055 }
00056
00057 Info << "Maximum possible number of faces in mesh: " << maxFaces << endl;
00058
00059 meshFaces_.setSize(maxFaces);
00060
00061
00062 const labelListList& PointCells = pointCells();
00063
00064 bool found = false;
00065
00066 nInternalFaces_ = 0;
00067
00068 forAll(cellFaces_, cellI)
00069 {
00070
00071
00072
00073
00074
00075
00076 const faceList& curFaces = cellFaces_[cellI];
00077
00078
00079 labelList neiCells(curFaces.size(), -1);
00080
00081
00082 labelList faceOfNeiCell(curFaces.size(), -1);
00083
00084 label nNeighbours = 0;
00085
00086
00087 forAll(curFaces, faceI)
00088 {
00089
00090 if (cellPolys_[cellI][faceI] >= 0) continue;
00091
00092 found = false;
00093
00094 const face& curFace = curFaces[faceI];
00095
00096
00097 const labelList& curPoints = curFace;
00098
00099
00100 forAll(curPoints, pointI)
00101 {
00102
00103 const labelList& curNeighbours = PointCells[curPoints[pointI]];
00104
00105
00106 forAll(curNeighbours, neiI)
00107 {
00108 label curNei = curNeighbours[neiI];
00109
00110
00111
00112 if (curNei > cellI)
00113 {
00114
00115 const faceList& searchFaces = cellFaces_[curNei];
00116
00117 forAll(searchFaces, neiFaceI)
00118 {
00119 if (searchFaces[neiFaceI] == curFace)
00120 {
00121
00122 found = true;
00123
00124
00125 neiCells[faceI] = curNei;
00126 faceOfNeiCell[faceI] = neiFaceI;
00127 nNeighbours++;
00128
00129 break;
00130 }
00131 }
00132 if (found) break;
00133 }
00134 if (found) break;
00135 }
00136 if (found) break;
00137 }
00138 }
00139
00140
00141 for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
00142 {
00143
00144 label nextNei = -1;
00145 label minNei = cellPolys_.size();
00146
00147 forAll (neiCells, ncI)
00148 {
00149 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
00150 {
00151 nextNei = ncI;
00152 minNei = neiCells[ncI];
00153 }
00154 }
00155
00156 if (nextNei > -1)
00157 {
00158
00159 meshFaces_[nInternalFaces_] = curFaces[nextNei];
00160
00161
00162 cellPolys_[cellI][nextNei] = nInternalFaces_;
00163
00164
00165 cellPolys_[neiCells[nextNei]][faceOfNeiCell[nextNei]] =
00166 nInternalFaces_;
00167
00168
00169 neiCells[nextNei] = -1;
00170
00171
00172 nInternalFaces_++;
00173 }
00174 else
00175 {
00176 FatalErrorIn("void starMesh::createPolyCells()")
00177 << "Error in internal face insertion"
00178 << abort(FatalError);
00179 }
00180 }
00181 }
00182
00183
00184
00185 }
00186
00187
00188