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 #include "polyPatch.H"
00032
00033
00034
00035 void starMesh::createPolyBoundary()
00036 {
00037 label nBoundaryFacesFound = 0;
00038
00039 polyBoundaryPatchStartIndices_.setSize(boundary_.size());
00040
00041 label nCreatedFaces = nInternalFaces_;
00042
00043 const labelListList& PointCells = pointCells();
00044
00045 forAll (boundary_, patchI)
00046 {
00047 const faceList& curShapePatch = boundary_[patchI];
00048
00049 polyBoundaryPatchStartIndices_[patchI] = nCreatedFaces;
00050
00051 forAll (curShapePatch, faceI)
00052 {
00053 bool found = false;
00054
00055 const face& curFace = curShapePatch[faceI];
00056
00057 meshFaces_[nCreatedFaces] = curFace;
00058
00059
00060
00061 const labelList& facePoints = curFace;
00062
00063 forAll(facePoints, pointI)
00064 {
00065 const labelList& facePointCells =
00066 PointCells[facePoints[pointI]];
00067
00068 forAll(facePointCells, cellI)
00069 {
00070 const faceList& curCellFaces =
00071 cellFaces_[facePointCells[cellI]];
00072
00073 forAll(curCellFaces, cellFaceI)
00074 {
00075 if (curCellFaces[cellFaceI] == curFace)
00076 {
00077
00078 found = true;
00079
00080
00081 if
00082 (
00083 cellPolys_[facePointCells[cellI]][cellFaceI]
00084 != -1
00085 )
00086 {
00087 if
00088 (
00089 cellPolys_[facePointCells[cellI]][cellFaceI]
00090 > nInternalFaces_
00091 )
00092 {
00093 Info
00094 << "void starMesh::createPolyBoundary()"
00095 << ": Problem with face: " << curFace
00096 << "\nProbably multiple definitions "
00097 << "of a single boundary face. " << endl
00098 << "Other boundary face: "
00099 << curCellFaces[cellFaceI]
00100 << endl;
00101
00102 Info << "PROSTAR Command: vset,news,vlis";
00103 forAll (curCellFaces[cellFaceI], spI)
00104 {
00105
00106
00107 if
00108 (
00109 curCellFaces[cellFaceI][spI] > -1
00110 && curCellFaces[cellFaceI][spI]
00111 < starPointID_.size()
00112 )
00113 {
00114 Info
00115 << ","
00116 << starPointID_
00117 [curCellFaces[cellFaceI][spI]];
00118 }
00119 else
00120 {
00121 Info << ",???";
00122 }
00123 }
00124 Info << " $ bset,add,vset,all" << endl;
00125 }
00126 else
00127 {
00128 Info
00129 << "void starMesh::createPolyBoundary()"
00130 << ": Problem with face: " << curFace
00131 << "\nProbably trying to define a "
00132 << "boundary face on a previously "
00133 << "matched internal face. " << endl
00134 << "Internal face: "
00135 << curCellFaces[cellFaceI]
00136 << endl;
00137
00138 Info << "PROSTAR Command: vset,news,vlis";
00139 forAll (curCellFaces[cellFaceI], spI)
00140 {
00141
00142
00143 if
00144 (
00145 curCellFaces[cellFaceI][spI] > -1
00146 && curCellFaces[cellFaceI][spI]
00147 < starPointID_.size()
00148 )
00149 {
00150 Info
00151 << ","
00152 << starPointID_
00153 [curCellFaces[cellFaceI][spI]];
00154 }
00155 else
00156 {
00157 Info << ",???";
00158 }
00159 }
00160 Info << " $ bset,add,vset,all" << endl;
00161
00162 }
00163 }
00164
00165 cellPolys_[facePointCells[cellI]][cellFaceI] =
00166 nCreatedFaces;
00167
00168 nBoundaryFacesFound++;
00169 }
00170 if (found) break;
00171 }
00172 if (found) break;
00173 }
00174 if (found) break;
00175 }
00176
00177 nCreatedFaces++;
00178 }
00179 }
00180
00181
00182 label nMissingFaceFound = 0;
00183
00184 forAll (cellPolys_, cellI)
00185 {
00186 const labelList& curFaces = cellPolys_[cellI];
00187
00188 forAll (curFaces, faceI)
00189 {
00190 if (curFaces[faceI] < 0)
00191 {
00192 const face& missingFace = cellFaces_[cellI][faceI];
00193
00194 Info << "starMesh::createPolyBoundary() : "
00195 << "missing face found in cell " << cellI
00196 << ".\nType: " << cellShapes_[cellI].model().name()
00197 << ". STAR cell number: " << starCellID_[cellI]
00198 << ". Face: " << missingFace << endl;
00199
00200 nMissingFaceFound++;
00201
00202 Info << "PROSTAR Command: vset,news,vlis";
00203 forAll (missingFace, spI)
00204 {
00205
00206 if
00207 (
00208 missingFace[spI] > -1
00209 && missingFace[spI] < starPointID_.size()
00210 )
00211 {
00212 Info << "," << starPointID_[missingFace[spI]];
00213 }
00214 else
00215 {
00216 Info << ",???";
00217 }
00218 }
00219 Info << " $ bset,add,vset,all" << endl;
00220 }
00221 }
00222 }
00223
00224 if (nMissingFaceFound > 0)
00225 {
00226 Info << "Number of unmatched faces: " << nMissingFaceFound << endl;
00227 }
00228
00229
00230 meshFaces_.setSize(nCreatedFaces);
00231
00232
00233
00234 labelList markupFaces(meshFaces_.size(), 0);
00235
00236 forAll (cellPolys_, cellI)
00237 {
00238 const labelList& curFaces = cellPolys_[cellI];
00239
00240 forAll (curFaces, faceI)
00241 {
00242 markupFaces[curFaces[faceI]]++;
00243 }
00244 }
00245
00246 for (label i = nInternalFaces_; i < markupFaces.size(); i++)
00247 {
00248 markupFaces[i]++;
00249 }
00250
00251 label nProblemFacesFound = 0;
00252
00253 forAll (markupFaces, faceI)
00254 {
00255 if (markupFaces[faceI] != 2)
00256 {
00257 const face& problemFace = meshFaces_[faceI];
00258
00259 Info << "starMesh::createPolyBoundary() : "
00260 << "problem with face " << faceI << ": addressed "
00261 << markupFaces[faceI] << " times (should be 2!). Face: "
00262 << problemFace << endl;
00263
00264 nProblemFacesFound++;
00265
00266 Info << "PROSTAR Command: vset,news,vlis";
00267 forAll (problemFace, spI)
00268 {
00269
00270 if
00271 (
00272 problemFace[spI] > -1
00273 && problemFace[spI] < starPointID_.size()
00274 )
00275 {
00276 Info << "," << starPointID_[problemFace[spI]];
00277 }
00278 else
00279 {
00280 Info << ",???";
00281 }
00282 }
00283 Info << " $ bset,add,vset,all" << endl;
00284 }
00285 }
00286
00287 if (nProblemFacesFound > 0)
00288 {
00289 Info << "Number of incorrectly matched faces: "
00290 << nProblemFacesFound << endl;
00291 }
00292
00293 Info << "Number of boundary faces: " << nBoundaryFacesFound << endl;
00294 Info << "Total number of faces: " << nCreatedFaces << endl;
00295 }
00296
00297
00298 List<polyPatch*> starMesh::polyBoundaryPatches(const polyMesh& pMesh)
00299 {
00300 List<polyPatch*> p(boundary_.size());
00301
00302 forAll (boundary_, patchI)
00303 {
00304 p[patchI] = polyPatch::New
00305 (
00306 patchTypes_[patchI],
00307 patchNames_[patchI],
00308 boundary_[patchI].size(),
00309 polyBoundaryPatchStartIndices_[patchI],
00310 patchI,
00311 pMesh.boundaryMesh()
00312 ).ptr();
00313 }
00314
00315 return p;
00316 }
00317
00318
00319