| 38 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
| 39 | |
| 40 | void Foam::meshReader::createPolyCells() |
| 41 | { |
| 42 | // loop through all cell faces and create connectivity. This will produce |
| 43 | // a global face list and will describe all cells as lists of face labels |
| 44 | |
| 45 | const faceListList& cFaces = cellFaces(); |
| 46 | |
| 47 | // count the maximum number of faces and set the size of the cellPolys_ |
| 48 | cellPolys_.setSize(cFaces.size()); |
| 49 | |
| 50 | label maxFaces = 0; |
| 51 | |
| 52 | forAll(cellPolys_, celli) |
| 53 | { |
| 54 | cellPolys_[celli].setSize(cFaces[celli].size(), -1); |
| 55 | |
| 56 | maxFaces += cFaces[celli].size(); |
| 57 | } |
| 58 | |
| 59 | Info<< "Maximum possible number of faces in mesh: " << maxFaces << endl; |
| 60 | |
| 61 | meshFaces_.setSize(maxFaces); |
| 62 | |
| 63 | // set reference to point-cell addressing |
| 64 | const labelListList& ptCells = pointCells(); |
| 65 | |
| 66 | // size the baffle lists and initialize to -1 |
| 67 | baffleIds_.setSize(baffleFaces_.size()); |
| 68 | forAll(baffleIds_, baffleI) |
| 69 | { |
| 70 | baffleIds_[baffleI].setSize(2); |
| 71 | } |
| 72 | |
| 73 | // block off baffles first |
| 74 | // |
| 75 | // To prevent internal faces, we'll mark the cell faces |
| 76 | // with negative cell ids (offset by nCells). |
| 77 | // eg, |
| 78 | // celli = -(nCells + baffleI) |
| 79 | // |
| 80 | // To distinguish these from the normal '-1' marker, we require |
| 81 | // celli = -(nCells + baffleI) < -1 |
| 82 | // |
| 83 | // This condition is met provided that nCells > 1. |
| 84 | // ie., baffles require at least 2 volume cells |
| 85 | |
| 86 | label baffleOffset = cFaces.size(); |
| 87 | forAll(baffleFaces_, baffleI) |
| 88 | { |
| 89 | label celli = -(baffleOffset + baffleI); |
| 90 | const face& curFace = baffleFaces_[baffleI]; |
| 91 | |
| 92 | // get the list of labels |
| 93 | const labelList& curPoints = curFace; |
| 94 | |
| 95 | // a baffle is a single face - only need to match one face |
| 96 | // get the list of cells sharing this point |
| 97 | const labelList& curNeighbours = ptCells[curPoints[0]]; |
no test coverage detected