----------------------------------------------------------------------------
| 1929 | |
| 1930 | //---------------------------------------------------------------------------- |
| 1931 | bool vtkHDFReader::ReadData(vtkInformation* outInfo, vtkDataObject* data) |
| 1932 | { |
| 1933 | int ok = 1; |
| 1934 | this->MeshGeometryChangedFromPreviousTimeStep = false; |
| 1935 | |
| 1936 | if (this->GetHasTemporalData()) |
| 1937 | { |
| 1938 | double* values = outInfo->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 1939 | if (!values) |
| 1940 | { |
| 1941 | vtkErrorMacro("Expected TIME_STEPS key for temporal data"); |
| 1942 | return false; |
| 1943 | } |
| 1944 | if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())) |
| 1945 | { |
| 1946 | double requestedValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); |
| 1947 | this->Step = std::distance(values, |
| 1948 | std::upper_bound(values, values + this->NumberOfSteps, requestedValue)) - |
| 1949 | 1; |
| 1950 | this->Step = std::min(std::max<vtkIdType>(this->Step, 0), this->NumberOfSteps - 1); |
| 1951 | data->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(), this->TimeValue); |
| 1952 | } |
| 1953 | this->TimeValue = values[this->Step]; |
| 1954 | } |
| 1955 | |
| 1956 | int dataSetType = this->Impl->GetDataSetType(); |
| 1957 | if (dataSetType == VTK_IMAGE_DATA) |
| 1958 | { |
| 1959 | vtkImageData* imageData = vtkImageData::SafeDownCast(data); |
| 1960 | ok = this->Read(outInfo, imageData); |
| 1961 | } |
| 1962 | else if (dataSetType == VTK_UNSTRUCTURED_GRID) |
| 1963 | { |
| 1964 | vtkUnstructuredGrid* ug = vtkUnstructuredGrid::SafeDownCast(data); |
| 1965 | vtkPartitionedDataSet* pData = vtkPartitionedDataSet::SafeDownCast(data); |
| 1966 | ok = this->Read(outInfo, ug, pData); |
| 1967 | if (this->UseCache && this->CompositeCachePath.empty()) |
| 1968 | { |
| 1969 | ::UpdateGeometryIfRequired( |
| 1970 | ug, pData, this->UseCache, this->MeshGeometryChangedFromPreviousTimeStep, this->MeshCache); |
| 1971 | } |
| 1972 | // data cleanup after using mesh cache |
| 1973 | if (pData && this->UseCache && this->MeshGeometryChangedFromPreviousTimeStep) |
| 1974 | { |
| 1975 | this->CleanOriginalIds(pData); |
| 1976 | } |
| 1977 | } |
| 1978 | else if (dataSetType == VTK_POLY_DATA) |
| 1979 | { |
| 1980 | vtkPolyData* polydata = vtkPolyData::SafeDownCast(data); |
| 1981 | vtkPartitionedDataSet* pData = vtkPartitionedDataSet::SafeDownCast(data); |
| 1982 | ok = this->Read(outInfo, polydata, pData); |
| 1983 | if (this->UseCache && this->CompositeCachePath.empty()) |
| 1984 | { |
| 1985 | ::UpdateGeometryIfRequired(polydata, pData, this->UseCache, |
| 1986 | this->MeshGeometryChangedFromPreviousTimeStep, this->MeshCache); |
| 1987 | } |
| 1988 | // data cleanup after using mesh cache |
no test coverage detected