| 1478 | |
| 1479 | |
| 1480 | void Foam::polyDualMesh::calcFeatures |
| 1481 | ( |
| 1482 | const polyMesh& mesh, |
| 1483 | const scalar featureCos, |
| 1484 | labelList& featureEdges, |
| 1485 | labelList& featurePoints |
| 1486 | ) |
| 1487 | { |
| 1488 | // Create big primitivePatch for all outside. |
| 1489 | primitivePatch allBoundary |
| 1490 | ( |
| 1491 | SubList<face> |
| 1492 | ( |
| 1493 | mesh.faces(), |
| 1494 | mesh.nFaces() - mesh.nInternalFaces(), |
| 1495 | mesh.nInternalFaces() |
| 1496 | ), |
| 1497 | mesh.points() |
| 1498 | ); |
| 1499 | |
| 1500 | // For ease of use store patch number per face in allBoundary. |
| 1501 | labelList allRegion(allBoundary.size()); |
| 1502 | |
| 1503 | const polyBoundaryMesh& patches = mesh.boundaryMesh(); |
| 1504 | |
| 1505 | forAll(patches, patchi) |
| 1506 | { |
| 1507 | const polyPatch& pp = patches[patchi]; |
| 1508 | |
| 1509 | forAll(pp, i) |
| 1510 | { |
| 1511 | allRegion[i + pp.start() - mesh.nInternalFaces()] = patchi; |
| 1512 | } |
| 1513 | } |
| 1514 | |
| 1515 | |
| 1516 | // Calculate patch/feature edges |
| 1517 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1518 | |
| 1519 | const labelListList& edgeFaces = allBoundary.edgeFaces(); |
| 1520 | const vectorField& faceNormals = allBoundary.faceNormals(); |
| 1521 | const labelList& meshPoints = allBoundary.meshPoints(); |
| 1522 | |
| 1523 | boolList isFeatureEdge(edgeFaces.size(), false); |
| 1524 | |
| 1525 | forAll(edgeFaces, edgeI) |
| 1526 | { |
| 1527 | const labelList& eFaces = edgeFaces[edgeI]; |
| 1528 | |
| 1529 | if (eFaces.size() != 2) |
| 1530 | { |
| 1531 | // Non-manifold. Problem? |
| 1532 | const edge& e = allBoundary.edges()[edgeI]; |
| 1533 | |
| 1534 | WarningInFunction |
| 1535 | << meshPoints[e[0]] << ' ' << meshPoints[e[1]] |
| 1536 | << " coords:" << mesh.points()[meshPoints[e[0]]] |
| 1537 | << mesh.points()[meshPoints[e[1]]] |