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

Function vtkXMLWriterC_NewDataArray

IO/XML/vtkXMLWriterC.cxx:581–608  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

579
580//------------------------------------------------------------------------------
581static vtkSmartPointer<vtkDataArray> vtkXMLWriterC_NewDataArray(const char* method,
582 const char* name, int dataType, void* data, vtkIdType numTuples, int numComponents)
583{
584 // Create the vtkDataArray that will reference the data.
585 vtkSmartPointer<vtkDataArray> array = vtkDataArray::CreateDataArray(dataType);
586 if (array)
587 {
588 array->Delete();
589 }
590 if (!array || array->GetDataType() != dataType)
591 {
592 vtkGenericWarningMacro(
593 "vtkXMLWriterC_" << method << " could not allocate array of type " << dataType << ".");
594 return nullptr;
595 }
596
597 // Set the number of components.
598 array->SetNumberOfComponents(numComponents);
599
600 // Set the name if one was given.
601 array->SetName(name);
602
603 // Point the array at the given data. It is not copied.
604 array->SetVoidArray(data, numTuples * numComponents, 1);
605
606 // Return the array.
607 return array;
608}
609
610//------------------------------------------------------------------------------
611static vtkSmartPointer<vtkCellArray> vtkXMLWriterC_NewCellArray(

Callers 3

vtkXMLWriterC_SetPointsFunction · 0.85

Calls 6

SetVoidArrayMethod · 0.80
DeleteMethod · 0.65
CreateDataArrayFunction · 0.50
GetDataTypeMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected