| 158 | |
| 159 | |
| 160 | bool Foam::cuttingPlane::walkCell |
| 161 | ( |
| 162 | const primitiveMesh& mesh, |
| 163 | const labelUList& edgePoint, |
| 164 | const label celli, |
| 165 | const label startEdgeI, |
| 166 | DynamicList<label>& faceVerts |
| 167 | ) |
| 168 | { |
| 169 | label facei = -1; |
| 170 | label edgeI = startEdgeI; |
| 171 | |
| 172 | label nIter = 0; |
| 173 | |
| 174 | faceVerts.clear(); |
| 175 | do |
| 176 | { |
| 177 | faceVerts.append(edgePoint[edgeI]); |
| 178 | |
| 179 | // Cross edge to other face |
| 180 | facei = meshTools::otherFace(mesh, celli, facei, edgeI); |
| 181 | |
| 182 | // Find next cut edge on face. |
| 183 | const labelList& fEdges = mesh.faceEdges()[facei]; |
| 184 | |
| 185 | label nextEdgeI = -1; |
| 186 | |
| 187 | //Note: here is where we should check for whether there are more |
| 188 | // than 2 intersections with the face (warped/non-convex face). |
| 189 | // If so should e.g. decompose the cells on both faces and redo |
| 190 | // the calculation. |
| 191 | |
| 192 | forAll(fEdges, i) |
| 193 | { |
| 194 | label edge2I = fEdges[i]; |
| 195 | |
| 196 | if (edge2I != edgeI && edgePoint[edge2I] != -1) |
| 197 | { |
| 198 | nextEdgeI = edge2I; |
| 199 | break; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | if (nextEdgeI == -1) |
| 204 | { |
| 205 | // Did not find another cut edge on facei. Do what? |
| 206 | WarningInFunction |
| 207 | << "Did not find closed walk along surface of cell " << celli |
| 208 | << " starting from edge " << startEdgeI |
| 209 | << " in " << nIter << " iterations." << nl |
| 210 | << "Collected cutPoints so far:" << faceVerts |
| 211 | << endl; |
| 212 | |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | edgeI = nextEdgeI; |
| 217 |
no test coverage detected