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

Method RequestData

Filters/Geometry/vtkMarkBoundaryFilter.cxx:956–1065  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

954
955//----------------------------------------------------------------------------
956int vtkMarkBoundaryFilter::RequestData(vtkInformation* vtkNotUsed(request),
957 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
958{
959 // get the info objects
960 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
961 vtkInformation* outInfo = outputVector->GetInformationObject(0);
962
963 // get the input and output
964 vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
965 vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
966
967 // The output structure is the same as the input. Input point and cell data is
968 // copied through as well.
969 output->CopyStructure(input);
970 output->GetPointData()->PassData(input->GetPointData());
971 output->GetCellData()->PassData(input->GetCellData());
972
973 // Create the required output arrays indicating boundary points, cells,
974 // mand optional faces.
975 vtkIdType numPts = input->GetNumberOfPoints();
976 vtkIdType numCells = input->GetNumberOfCells();
977
978 vtkNew<vtkUnsignedCharArray> bPoints;
979 bPoints->SetNumberOfTuples(numPts);
980 bPoints->SetName(this->BoundaryPointsName);
981 output->GetPointData()->AddArray(bPoints);
982
983 vtkNew<vtkUnsignedCharArray> bCells;
984 bCells->SetNumberOfTuples(numCells);
985 bCells->SetName(this->BoundaryCellsName);
986 output->GetCellData()->AddArray(bCells);
987
988 vtkSmartPointer<vtkIdTypeArray> bFaces;
989 if (this->GenerateBoundaryFaces)
990 {
991 bFaces.TakeReference(vtkIdTypeArray::New());
992 bFaces->SetNumberOfTuples(numCells);
993 bFaces->SetName(this->BoundaryFacesName);
994 output->GetCellData()->AddArray(bFaces);
995 }
996
997 // Initially, nothing is marked on the boundary
998 InitializeBoundaryArrays(bPoints, bCells, bFaces);
999 unsigned char* bPtsPtr = bPoints->GetPointer(0);
1000 unsigned char* bCellsPtr = bCells->GetPointer(0);
1001 vtkIdType* bFacesPtr = (bFaces.Get() != nullptr ? bFaces->GetPointer(0) : nullptr);
1002
1003 if (numCells == 0)
1004 {
1005 return 1;
1006 }
1007
1008 // Grab ghost levels if needed
1009 unsigned char* cellGhosts = nullptr;
1010 vtkDataArray* temp = nullptr;
1011 temp = input->GetCellData()->GetArray(vtkDataSetAttributes::GhostArrayName());
1012 if ((!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR) || (temp->GetNumberOfComponents() != 1))
1013 {

Callers

nothing calls this directly

Calls 15

InitializeBoundaryArraysFunction · 0.85
GhostArrayNameFunction · 0.85
PolyDataExecuteFunction · 0.85
UnstructuredGridExecuteFunction · 0.85
StructuredExecuteFunction · 0.85
DataSetExecuteFunction · 0.85
GetInformationObjectMethod · 0.80
GetDataObjectTypeMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
CopyStructureMethod · 0.45
PassDataMethod · 0.45

Tested by

no test coverage detected