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

Method ProcessCell

Filters/Geometry/vtkMarkBoundaryFilter.cxx:678–738  ·  view source on GitHub ↗

Determine whether to process the structured cell at location ijk[3] with the cellId given. Return a faceMark indicating what faces are boundary. A faceMark==0 means no faces are boundary. Also, the point ids of the face(s) on the boundary are returned.

Source from the content-addressed store, hash-verified

676 // boundary. A faceMark==0 means no faces are boundary. Also, the point
677 // ids of the face(s) on the boundary are returned.
678 vtkIdType ProcessCell(vtkIdType cellId, int ijk[3], vtkIdList* ptIds)
679 {
680 // Are we on the boundary of the structured dataset? If not, just return.
681 if (ijk[0] != 0 && ijk[0] != (this->Dims[0] - 2) && ijk[1] != 0 &&
682 ijk[1] != (this->Dims[1] - 2) && ijk[2] != 0 && ijk[2] != (this->Dims[2] - 2))
683 {
684 return 0;
685 }
686
687 // Okay one or more faces and points are on the boundary. Need to figure out which
688 // is which.
689 char ptUses[8] = { 0 };
690 vtkIdType faceMark = 0;
691 vtkStructuredData::GetCellPoints(
692 cellId, ptIds, vtkStructuredData::VTK_STRUCTURED_XYZ_GRID, this->Dims);
693 vtkIdType tmpPtIds[8];
694 std::copy_n(ptIds->GetPointer(0), 8, tmpPtIds);
695
696 if (ijk[0] == 0)
697 {
698 faceMark |= (1 << 0);
699 ptUses[0] = ptUses[2] = ptUses[4] = ptUses[6] = 1;
700 }
701 if (ijk[0] == (this->Dims[0] - 2))
702 {
703 faceMark |= (1 << 1);
704 ptUses[1] = ptUses[3] = ptUses[5] = ptUses[7] = 1;
705 }
706 if (ijk[1] == 0)
707 {
708 faceMark |= (1 << 2);
709 ptUses[0] = ptUses[1] = ptUses[4] = ptUses[5] = 1;
710 }
711 if (ijk[1] == (this->Dims[1] - 2))
712 {
713 faceMark |= (1 << 3);
714 ptUses[2] = ptUses[3] = ptUses[6] = ptUses[7] = 1;
715 }
716 if (ijk[2] == 0)
717 {
718 faceMark |= (1 << 4);
719 ptUses[0] = ptUses[1] = ptUses[2] = ptUses[3] = 1;
720 }
721 if (ijk[2] == (this->Dims[2] - 2))
722 {
723 faceMark |= (1 << 5);
724 ptUses[4] = ptUses[5] = ptUses[6] = ptUses[7] = 1;
725 }
726
727 // Mark the points
728 ptIds->Reset();
729 for (int i = 0; i < 8; ++i)
730 {
731 if (ptUses[i])
732 {
733 ptIds->InsertNextId(tmpPtIds[i]);
734 }
735 }

Callers 1

operator()Method · 0.95

Calls 4

InsertNextIdMethod · 0.80
GetCellPointsFunction · 0.50
GetPointerMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected