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

Method ReadArrayValues

IO/XML/vtkXMLReader.cxx:977–1017  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

975
976//------------------------------------------------------------------------------
977int vtkXMLReader::ReadArrayValues(vtkXMLDataElement* da, vtkIdType arrayIndex,
978 vtkAbstractArray* array, vtkIdType startIndex, vtkIdType numValues, FieldType fieldType)
979{
980 // Skip real read if aborting.
981 if (this->AbortExecute)
982 {
983 return 0;
984 }
985 this->InReadData = 1;
986 int result;
987 vtkArrayIterator* iter = array->NewIterator();
988 if (arrayIndex + numValues > array->GetNumberOfValues())
989 {
990 vtkErrorMacro("Array has " << array->GetNumberOfValues() << " allocated elements, but "
991 << arrayIndex + numValues << " were requested to be read");
992 return 0;
993 }
994 switch (array->GetDataType())
995 {
996 vtkArrayIteratorTemplateMacro(result = vtkXMLDataReaderReadArrayValues(da, this->XMLParser,
997 arrayIndex, static_cast<VTK_TT*>(iter), startIndex, numValues));
998 default:
999 result = 0;
1000 }
1001 if (iter)
1002 {
1003 iter->Delete();
1004 }
1005
1006 this->ConvertGhostLevelsToGhostType(fieldType, array, startIndex, numValues);
1007 // Marking the array modified is essential, since otherwise, when reading
1008 // multiple time-steps, the array does not realize that its contents may have
1009 // changed and does not recompute the array ranges.
1010 // This becomes an issue only because we reuse the vtkAbstractArray* instance
1011 // when reading time-steps. The array is allocated only for the first timestep
1012 // read (see vtkXMLReader::ReadXMLData() and its use of
1013 // this->TimeStepWasReadOnce flag).
1014 array->Modified();
1015 this->InReadData = 0;
1016 return result;
1017}
1018
1019//------------------------------------------------------------------------------
1020int vtkXMLReader::ReadArrayTuples(vtkXMLDataElement* da, vtkIdType arrayTupleIndex,

Callers 15

ReadXMLInformationMethod · 0.95
ReadArrayTuplesMethod · 0.95
ReadFieldDataMethod · 0.95
ReadSubCoordinatesMethod · 0.80
ReadCellArrayMethod · 0.80
ReadFaceArrayMethod · 0.80
ReadFaceCellArrayMethod · 0.80
ReadArrayForPointsMethod · 0.80
ReadGridMethod · 0.80
ReadTrees_0Method · 0.80
ReadTrees_1Method · 0.80

Calls 7

DeleteMethod · 0.65
NewIteratorMethod · 0.45
GetNumberOfValuesMethod · 0.45
GetDataTypeMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected