| 309 | |
| 310 | |
| 311 | void Foam::particle::changeFace(const label tetTriI) |
| 312 | { |
| 313 | // Get the old topology |
| 314 | const triFace triOldIs(currentTetIndices().faceTriIs(mesh_)); |
| 315 | |
| 316 | // Get the shared edge and the pre-rotation |
| 317 | edge sharedEdge; |
| 318 | if (tetTriI == 1) |
| 319 | { |
| 320 | sharedEdge = edge(triOldIs[1], triOldIs[2]); |
| 321 | } |
| 322 | else if (tetTriI == 2) |
| 323 | { |
| 324 | sharedEdge = edge(triOldIs[2], triOldIs[0]); |
| 325 | } |
| 326 | else if (tetTriI == 3) |
| 327 | { |
| 328 | sharedEdge = edge(triOldIs[0], triOldIs[1]); |
| 329 | } |
| 330 | else |
| 331 | { |
| 332 | FatalErrorInFunction |
| 333 | << "Changing face without changing cell should only happen when the" |
| 334 | << " track is on triangle 1, 2 or 3." |
| 335 | << exit(FatalError); |
| 336 | |
| 337 | sharedEdge = edge(-1, -1); |
| 338 | } |
| 339 | |
| 340 | // Find the face in the same cell that shares the edge, and the |
| 341 | // corresponding tetrahedra point |
| 342 | tetPti_ = -1; |
| 343 | forAll(mesh_.cells()[celli_], cellFaceI) |
| 344 | { |
| 345 | const label newFaceI = mesh_.cells()[celli_][cellFaceI]; |
| 346 | const class face& newFace = mesh_.faces()[newFaceI]; |
| 347 | |
| 348 | // Exclude the current face |
| 349 | if (tetFacei_ == newFaceI) |
| 350 | { |
| 351 | continue; |
| 352 | } |
| 353 | |
| 354 | // Loop over the edges, looking for the shared one |
| 355 | label edgeComp = 0; |
| 356 | label edgeI = 0; |
| 357 | for (; edgeI < newFace.size(); ++ edgeI) |
| 358 | { |
| 359 | edgeComp = edge::compare(sharedEdge, newFace.faceEdge(edgeI)); |
| 360 | |
| 361 | if (edgeComp != 0) |
| 362 | { |
| 363 | break; |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | // If the face does not contain the edge, then move on to the next face |
| 368 | if (edgeComp == 0) |
no test coverage detected