------------------------------------------------------------------------------
| 975 | |
| 976 | //------------------------------------------------------------------------------ |
| 977 | int 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 | //------------------------------------------------------------------------------ |
| 1020 | int vtkXMLReader::ReadArrayTuples(vtkXMLDataElement* da, vtkIdType arrayTupleIndex, |
no test coverage detected