| 249 | |
| 250 | |
| 251 | void Foam::cuttingPlane::walkCellCuts |
| 252 | ( |
| 253 | const primitiveMesh& mesh, |
| 254 | const bool triangulate, |
| 255 | const labelUList& edgePoint |
| 256 | ) |
| 257 | { |
| 258 | const pointField& cutPoints = this->points(); |
| 259 | |
| 260 | // use dynamic lists to handle triangulation and/or missed cuts |
| 261 | DynamicList<face> dynCutFaces(cutCells_.size()); |
| 262 | DynamicList<label> dynCutCells(cutCells_.size()); |
| 263 | |
| 264 | // scratch space for calculating the face vertices |
| 265 | DynamicList<label> faceVerts(10); |
| 266 | |
| 267 | forAll(cutCells_, i) |
| 268 | { |
| 269 | label celli = cutCells_[i]; |
| 270 | |
| 271 | // Find the starting edge to walk from. |
| 272 | const labelList& cEdges = mesh.cellEdges()[celli]; |
| 273 | |
| 274 | label startEdgeI = -1; |
| 275 | |
| 276 | forAll(cEdges, cEdgeI) |
| 277 | { |
| 278 | label edgeI = cEdges[cEdgeI]; |
| 279 | |
| 280 | if (edgePoint[edgeI] != -1) |
| 281 | { |
| 282 | startEdgeI = edgeI; |
| 283 | break; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | // Check for the unexpected ... |
| 288 | if (startEdgeI == -1) |
| 289 | { |
| 290 | FatalErrorInFunction |
| 291 | << "Cannot find cut edge for cut cell " << celli |
| 292 | << abort(FatalError); |
| 293 | } |
| 294 | |
| 295 | // Walk from starting edge around the circumference of the cell. |
| 296 | bool okCut = walkCell |
| 297 | ( |
| 298 | mesh, |
| 299 | edgePoint, |
| 300 | celli, |
| 301 | startEdgeI, |
| 302 | faceVerts |
| 303 | ); |
| 304 | |
| 305 | if (okCut) |
| 306 | { |
| 307 | face f(faceVerts); |
| 308 | |