| 428 | |
| 429 | |
| 430 | void Foam::polyDualMesh::splitFace |
| 431 | ( |
| 432 | const polyPatch& patch, |
| 433 | const labelList& pointToDualPoint, |
| 434 | |
| 435 | const label pointi, |
| 436 | const labelList& dualFace, |
| 437 | const labelList& featEdgeIndices, |
| 438 | |
| 439 | DynamicList<face>& dualFaces, |
| 440 | DynamicList<label>& dualOwner, |
| 441 | DynamicList<label>& dualNeighbour, |
| 442 | DynamicList<label>& dualRegion |
| 443 | ) |
| 444 | { |
| 445 | |
| 446 | // Split face because of feature edges/points |
| 447 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 448 | label meshPointi = patch.meshPoints()[pointi]; |
| 449 | |
| 450 | if (pointToDualPoint[meshPointi] >= 0) |
| 451 | { |
| 452 | // Feature point. Do face-centre decomposition. |
| 453 | |
| 454 | if (featEdgeIndices.size() < 2) |
| 455 | { |
| 456 | // Feature point but no feature edges. Not handled at the moment |
| 457 | dualFaces.append(face(dualFace)); |
| 458 | dualOwner.append(meshPointi); |
| 459 | dualNeighbour.append(-1); |
| 460 | dualRegion.append(patch.index()); |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | // Do 'face-centre' decomposition. Start from first feature |
| 465 | // edge create face up until next feature edge. |
| 466 | |
| 467 | forAll(featEdgeIndices, i) |
| 468 | { |
| 469 | label startFp = featEdgeIndices[i]; |
| 470 | |
| 471 | label endFp = featEdgeIndices[(i+1) % featEdgeIndices.size()]; |
| 472 | |
| 473 | // Collect face from startFp to endFp |
| 474 | label sz = 0; |
| 475 | |
| 476 | if (endFp > startFp) |
| 477 | { |
| 478 | sz = endFp - startFp + 2; |
| 479 | } |
| 480 | else |
| 481 | { |
| 482 | sz = endFp + dualFace.size() - startFp + 2; |
| 483 | } |
| 484 | face subFace(sz); |
| 485 | |
| 486 | // feature point becomes face centre. |
| 487 | subFace[0] = pointToDualPoint[patch.meshPoints()[pointi]]; |