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

Function vtkXMLWriterC_NewCellArray

IO/XML/vtkXMLWriterC.cxx:611–633  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

609
610//------------------------------------------------------------------------------
611static vtkSmartPointer<vtkCellArray> vtkXMLWriterC_NewCellArray(
612 const char* method, vtkIdType ncells, vtkIdType* cells, vtkIdType cellsSize)
613{
614 // Create a vtkIdTypeArray to reference the cells.
615 vtkSmartPointer<vtkIdTypeArray> array = vtkSmartPointer<vtkIdTypeArray>::New();
616 if (!array)
617 {
618 vtkGenericWarningMacro("vtkXMLWriterC_" << method << " failed to allocate a vtkIdTypeArray.");
619 return nullptr;
620 }
621 array->SetArray(cells, ncells * cellsSize, 1);
622
623 // Create the cell array.
624 vtkSmartPointer<vtkCellArray> cellArray = vtkSmartPointer<vtkCellArray>::New();
625 if (!cellArray)
626 {
627 vtkGenericWarningMacro("vtkXMLWriterC_" << method << " failed to allocate a vtkCellArray.");
628 return nullptr;
629 }
630 cellArray->AllocateExact(ncells, array->GetNumberOfValues() - ncells);
631 cellArray->ImportLegacyFormat(array);
632 return cellArray;
633}
634
635//------------------------------------------------------------------------------
636static void vtkXMLWriterC_SetDataInternal(vtkXMLWriterC* self, const char* name, int dataType,

Callers 2

Calls 5

ImportLegacyFormatMethod · 0.80
NewFunction · 0.50
SetArrayMethod · 0.45
AllocateExactMethod · 0.45
GetNumberOfValuesMethod · 0.45

Tested by

no test coverage detected