| 128 | |
| 129 | |
| 130 | void Foam::polyMesh::setTopology |
| 131 | ( |
| 132 | const cellShapeList& cellsAsShapes, |
| 133 | const faceListList& boundaryFaces, |
| 134 | const wordList& boundaryPatchNames, |
| 135 | labelList& patchSizes, |
| 136 | labelList& patchStarts, |
| 137 | label& defaultPatchStart, |
| 138 | label& nFaces, |
| 139 | cellList& cells |
| 140 | ) |
| 141 | { |
| 142 | // Calculate the faces of all cells |
| 143 | // Initialise maximum possible numer of mesh faces to 0 |
| 144 | label maxFaces = 0; |
| 145 | |
| 146 | // Set up a list of face shapes for each cell |
| 147 | faceListList cellsFaceShapes(cellsAsShapes.size()); |
| 148 | cells.setSize(cellsAsShapes.size()); |
| 149 | |
| 150 | forAll(cellsFaceShapes, celli) |
| 151 | { |
| 152 | cellsFaceShapes[celli] = cellsAsShapes[celli].faces(); |
| 153 | |
| 154 | cells[celli].setSize(cellsFaceShapes[celli].size()); |
| 155 | |
| 156 | // Initialise cells to -1 to flag undefined faces |
| 157 | static_cast<labelList&>(cells[celli]) = -1; |
| 158 | |
| 159 | // Count maximum possible numer of mesh faces |
| 160 | maxFaces += cellsFaceShapes[celli].size(); |
| 161 | } |
| 162 | |
| 163 | // Set size of faces array to maximum possible number of mesh faces |
| 164 | faces_.setSize(maxFaces); |
| 165 | |
| 166 | // Initialise number of faces to 0 |
| 167 | nFaces = 0; |
| 168 | |
| 169 | // Set reference to point-cell addressing |
| 170 | labelListList PointCells = cellShapePointCells(cellsAsShapes); |
| 171 | |
| 172 | bool found = false; |
| 173 | |
| 174 | forAll(cells, celli) |
| 175 | { |
| 176 | // Note: |
| 177 | // Insertion cannot be done in one go as the faces need to be |
| 178 | // added into the list in the increasing order of neighbour |
| 179 | // cells. Therefore, all neighbours will be detected first |
| 180 | // and then added in the correct order. |
| 181 | |
| 182 | const faceList& curFaces = cellsFaceShapes[celli]; |
| 183 | |
| 184 | // Record the neighbour cell |
| 185 | labelList neiCells(curFaces.size(), -1); |
| 186 | |
| 187 | // Record the face of neighbour cell |
no test coverage detected