MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / split

Function split

src/triSurface/faceTriangulation/faceTriangulation.C:406–596  ·  view source on GitHub ↗

Split face f into triangles. Handles all simple (convex & concave) polygons.

Source from the content-addressed store, hash-verified

404// Split face f into triangles. Handles all simple (convex & concave)
405// polygons.
406bool Foam::faceTriangulation::split
407(
408 const bool fallBack,
409 const pointField& points,
410 const face& f,
411 const vector& normal,
412 label& triI
413)
414{
415 const label size = f.size();
416
417 if (size <= 2)
418 {
419 WarningInFunction
420 << "Illegal face:" << f
421 << " with points " << UIndirectList<point>(points, f)()
422 << endl;
423
424 return false;
425 }
426 else if (size == 3)
427 {
428 // Triangle. Just copy.
429 triFace& tri = operator[](triI++);
430 tri[0] = f[0];
431 tri[1] = f[1];
432 tri[2] = f[2];
433
434 return true;
435 }
436 else
437 {
438 // General case. Start splitting for -flattest concave angle
439 // -or flattest convex angle if no concave angles.
440
441 tmp<vectorField> tedges(calcEdges(f, points));
442 const vectorField& edges = tedges();
443
444 label startIndex = findStart(f, edges, normal);
445
446 // Find diagonal to split face across
447 label index1 = -1;
448 label index2 = -1;
449
450 forAll(f, iter)
451 {
452 findDiagonal
453 (
454 points,
455 f,
456 edges,
457 normal,
458 startIndex,
459 index1,
460 index2
461 );
462
463 if (index1 != -1 && index2 != -1)

Callers 3

triFaceListFunction · 0.85
faceTemplates.CFile · 0.85
face.CFile · 0.85

Calls 6

calcEdgesFunction · 0.85
findDiagonalFunction · 0.85
forAllFunction · 0.50
abortFunction · 0.50
sizeMethod · 0.45
fcIndexMethod · 0.45

Tested by

no test coverage detected