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

Function ClonePolyData

Parallel/DIY/vtkDIYGhostUtilities.cxx:3883–4016  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3881
3882//----------------------------------------------------------------------------
3883void ClonePolyData(vtkPolyData* pd, vtkPolyData* clone, ::PolyDataInformation& info)
3884{
3885 ::CloneDataObject(pd, clone);
3886 ::ClonePointData(pd, clone, info);
3887 ::ClonePoints(pd, clone, info);
3888
3889 vtkIdType cloneNumberOfVerts = clone->GetNumberOfVerts();
3890 vtkIdType cloneNumberOfLines = clone->GetNumberOfLines();
3891 vtkIdType cloneNumberOfPolys = clone->GetNumberOfPolys();
3892
3893 vtkIdType cloneLinesOffset = cloneNumberOfVerts;
3894 vtkIdType pdLinesOffset = info.NumberOfInputVerts;
3895
3896 vtkIdType clonePolysOffset = cloneNumberOfLines + cloneLinesOffset;
3897 vtkIdType pdPolysOffset = info.NumberOfInputLines + pdLinesOffset;
3898
3899 vtkIdType cloneStripsOffset = cloneNumberOfPolys + clonePolysOffset;
3900 vtkIdType pdStripsOffset = info.NumberOfInputPolys + pdPolysOffset;
3901
3902 // We cannot use CloneCellData here because the cell data gets all stirred up in a vtkPolyData
3903 vtkCellData* cloneCellData = clone->GetCellData();
3904 vtkCellData* pdCellData = pd->GetCellData();
3905 cloneCellData->CopyAllOn();
3906 cloneCellData->CopyAllocate(pdCellData, clone->GetNumberOfCells());
3907 cloneCellData->SetNumberOfTuples(clone->GetNumberOfCells());
3908
3909 if (vtkIdList* pointIds = info.InputToOutputPointIdRedirectionMap)
3910 {
3911 vtkIdList* vertIds = info.OutputToInputVertCellIdRedirectionMap;
3912 if (vertIds->GetNumberOfIds())
3913 {
3914 ::DeepCopyCells(pd->GetVerts(), clone->GetVerts(), vertIds, pointIds);
3915 }
3916
3917 vtkIdList* lineIds = info.OutputToInputLineCellIdRedirectionMap;
3918 if (lineIds->GetNumberOfIds())
3919 {
3920 ::DeepCopyCells(pd->GetLines(), clone->GetLines(), lineIds, pointIds);
3921 }
3922
3923 vtkIdList* polyIds = info.OutputToInputPolyCellIdRedirectionMap;
3924 if (polyIds->GetNumberOfIds())
3925 {
3926 ::DeepCopyCells(pd->GetPolys(), clone->GetPolys(), polyIds, pointIds);
3927 }
3928
3929 vtkIdList* stripIds = info.OutputToInputStripCellIdRedirectionMap;
3930 if (stripIds->GetNumberOfIds())
3931 {
3932 ::DeepCopyCells(pd->GetStrips(), clone->GetStrips(), stripIds, pointIds);
3933 }
3934
3935 vtkNew<vtkIdList> iotaVert;
3936 iotaVert->SetNumberOfIds(info.NumberOfInputVerts);
3937 std::iota(iotaVert->begin(), iotaVert->end(), 0);
3938
3939 vtkNew<vtkIdList> iotaLine;
3940 iotaLine->SetNumberOfIds(info.NumberOfInputLines);

Callers 1

Calls 15

CloneDataObjectFunction · 0.85
ClonePointDataFunction · 0.85
ClonePointsFunction · 0.85
DeepCopyCellsFunction · 0.85
GetNumberOfPolysMethod · 0.80
GetVertsMethod · 0.80
GetPolysMethod · 0.80
GetStripsMethod · 0.80
SetNumberOfIdsMethod · 0.80
GetAbstractArrayMethod · 0.80
GetConnectivityArrayMethod · 0.80
GetNumberOfVertsMethod · 0.45

Tested by

no test coverage detected