MCPcopy Create free account
hub / github.com/Kitware/VTK / TriangulateLocalIds

Method TriangulateLocalIds

Common/DataModel/vtkHigherOrderWedge.cxx:499–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499int vtkHigherOrderWedge::TriangulateLocalIds(int vtkNotUsed(index), vtkIdList* ptIds)
500{
501 // Note that the node numbering between the vtkWedge and vtkHigherOrderWedge is different:
502 //
503 // vtkWedge vtkHigherOrderWedge
504 // 4 +-------+ 5 5 +-------+ 4
505 // |\ /| |\ /|
506 // | \ / | | \ / |
507 // | \ / | | \ / |
508 // | 3 + | | 3 + |
509 // | | | | | |
510 // 1 +...|...+ 2 2 +...|...+ 1
511 // \ | , \ | ,
512 // \ | , \ | ,
513 // \|, \|,
514 // 0 + 0 +
515 //
516 // For this reason, in order to not get tetrahedra with negative Jacobian,
517 // the nodes 2 and 3 of each tetra are swapped.
518
519 constexpr std::array<vtkIdType, 12> linearWedgeLocalPtIds = { 0, 2, 3, 1, 1, 3, 4, 5, 1, 2, 3,
520 5 };
521
522 int i, j, k, corner;
523 const int* order = this->GetOrder();
524 vtkIdType nwedge = this->GetNumberOfApproximatingWedges();
525 ptIds->SetNumberOfIds(nwedge * 12);
526 int count = 0;
527#ifdef VTK_21_POINT_WEDGE
528 if (order[3] == 21)
529 {
530 for (int subId = 0; subId < nwedge; ++subId)
531 {
532 if (subId < 0 || subId >= 12)
533 {
534 vtkWarningMacro("Bad subId " << subId << " for 21-point wedge.");
535 return 0;
536 }
537 for (vtkIdType ic : linearWedgeLocalPtIds)
538 {
539 corner = vtkHigherOrderWedge21ApproxCorners[subId][ic];
540 ptIds->SetId(count, corner);
541 count++;
542 }
543 }
544 return 1;
545 }
546#endif
547
548 // Get the point coordinates (and optionally scalars) for each of the 6 corners
549 // in the approximating wedge spanning half of (i, i+1) x (j, j+1) x (k, k+1):
550 // vtkIdType aconn[8]; // = {0, 1, 2, 3, 4, 5, 6, 7};
551 // std::cout << "Wedgeproximate " << subId << "\n";
552 bool orientation;
553 constexpr int deltas[2][3][2] = {
554 { { 0, 0 }, { 1, 0 }, { 0, 1 } }, // positive orientation: r, s axes increase as i, j increase
555 { { 1, 1 }, { 0, 1 }, { 1, 0 } } // negative orientation: r, s axes decrease as i, j increase
556 };

Callers

nothing calls this directly

Calls 6

GetOrderMethod · 0.95
PointIndexFromIJKMethod · 0.95
SetNumberOfIdsMethod · 0.80
SetIdMethod · 0.45

Tested by

no test coverage detected