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