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

Function vtkXMLDataReaderReadArrayValues

IO/XML/vtkXMLReader.cxx:797–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795//------------------------------------------------------------------------------
796template <class iterT>
797int vtkXMLDataReaderReadArrayValues(vtkXMLDataElement* da, vtkXMLDataParser* xmlparser,
798 vtkIdType arrayIndex, iterT* iter, vtkIdType startIndex, vtkIdType numValues)
799{
800 if (!iter)
801 {
802 return 0;
803 }
804 vtkAbstractArray* array = iter->GetArray();
805 // XML Reader only creates AOS arrays.
806 auto aosArray = vtkAOSDataArrayTemplate<typename iterT::ValueType>::FastDownCast(array);
807 assert(aosArray != nullptr);
808 // Number of expected words:
809 size_t numWords = array->GetDataType() != VTK_BIT ? numValues : ((numValues + 7) / 8);
810 int result;
811 void* data = aosArray->GetPointer(arrayIndex);
812 if (da->GetAttribute("offset"))
813 {
814 vtkTypeInt64 offset = 0;
815 da->GetScalarAttribute("offset", offset);
816 result = (xmlparser->ReadAppendedData(
817 offset, data, startIndex, numWords, array->GetDataType()) == numWords);
818 }
819 else
820 {
821 int isAscii = 1;
822 const char* format = da->GetAttribute("format");
823 if (format && (strcmp(format, "binary") == 0))
824 {
825 isAscii = 0;
826 }
827 result = (xmlparser->ReadInlineData(
828 da, isAscii, data, startIndex, numWords, array->GetDataType()) == numWords);
829 }
830 return result;
831}
832
833//------------------------------------------------------------------------------
834template <>

Callers 1

ReadArrayValuesMethod · 0.85

Calls 15

GetScalarAttributeMethod · 0.80
ReadAppendedDataMethod · 0.80
ReadInlineDataMethod · 0.80
FastDownCastFunction · 0.50
assertFunction · 0.50
GetArrayMethod · 0.45
GetDataTypeMethod · 0.45
GetPointerMethod · 0.45
GetAttributeMethod · 0.45
SetNumberOfValuesMethod · 0.45
SetNumberOfComponentsMethod · 0.45
GetNumberOfComponentsMethod · 0.45

Tested by

no test coverage detected