| 28 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
| 29 | |
| 30 | void Foam::polyMesh::initMesh() |
| 31 | { |
| 32 | if (debug) |
| 33 | { |
| 34 | InfoInFunction << "initialising primitiveMesh" << endl; |
| 35 | } |
| 36 | |
| 37 | // For backward compatibility check if the neighbour array is the same |
| 38 | // length as the owner and shrink to remove the -1s padding |
| 39 | if (neighbour_.size() == owner_.size()) |
| 40 | { |
| 41 | label nInternalFaces = 0; |
| 42 | |
| 43 | forAll(neighbour_, facei) |
| 44 | { |
| 45 | if (neighbour_[facei] == -1) |
| 46 | { |
| 47 | break; |
| 48 | } |
| 49 | else |
| 50 | { |
| 51 | nInternalFaces++; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | neighbour_.setSize(nInternalFaces); |
| 56 | } |
| 57 | |
| 58 | label nCells = -1; |
| 59 | |
| 60 | forAll(owner_, facei) |
| 61 | { |
| 62 | if (owner_[facei] < 0) |
| 63 | { |
| 64 | FatalErrorInFunction |
| 65 | << "Illegal cell label " << owner_[facei] |
| 66 | << " in neighbour addressing for face " << facei |
| 67 | << exit(FatalError); |
| 68 | } |
| 69 | nCells = max(nCells, owner_[facei]); |
| 70 | } |
| 71 | |
| 72 | // The neighbour array may or may not be the same length as the owner |
| 73 | forAll(neighbour_, facei) |
| 74 | { |
| 75 | if (neighbour_[facei] < 0) |
| 76 | { |
| 77 | FatalErrorInFunction |
| 78 | << "Illegal cell label " << neighbour_[facei] |
| 79 | << " in neighbour addressing for face " << facei |
| 80 | << exit(FatalError); |
| 81 | } |
| 82 | nCells = max(nCells, neighbour_[facei]); |
| 83 | } |
| 84 | |
| 85 | nCells++; |
| 86 | |
| 87 | // Reset the primitiveMesh with the sizes of the primitive arrays |
no test coverage detected