------------------------------------------------------------------------------
| 557 | |
| 558 | //------------------------------------------------------------------------------ |
| 559 | int vtkXMLDataReader::PointDataNeedToReadTimeStep(vtkXMLDataElement* eNested) |
| 560 | { |
| 561 | // First thing need to find the id of this dataarray from its name: |
| 562 | const char* name = eNested->GetAttribute("Name"); |
| 563 | |
| 564 | // Easy case no timestep: |
| 565 | int numTimeSteps = |
| 566 | eNested->GetVectorAttribute("TimeStep", this->NumberOfTimeSteps, this->TimeSteps); |
| 567 | if (!(numTimeSteps <= this->NumberOfTimeSteps)) |
| 568 | { |
| 569 | vtkErrorMacro("Invalid TimeStep specification"); |
| 570 | this->DataError = 1; |
| 571 | return 0; |
| 572 | } |
| 573 | if (!numTimeSteps && !this->NumberOfTimeSteps) |
| 574 | { |
| 575 | assert(this->PointDataTimeStep->at(name) == -1); // No timestep in this file |
| 576 | return 1; |
| 577 | } |
| 578 | // else TimeStep was specified but no TimeValues associated were found |
| 579 | assert(this->NumberOfTimeSteps); |
| 580 | |
| 581 | // case numTimeSteps > 1 |
| 582 | int isCurrentTimeInArray = |
| 583 | vtkXMLReader::IsTimeStepInArray(this->CurrentTimeStep, this->TimeSteps, numTimeSteps); |
| 584 | if (numTimeSteps && !isCurrentTimeInArray) |
| 585 | { |
| 586 | return 0; |
| 587 | } |
| 588 | // we know that time steps are specified and that CurrentTimeStep is in the array |
| 589 | // we need to figure out if we need to read the array or if it was forwarded |
| 590 | // Need to check the current 'offset' |
| 591 | vtkTypeInt64 offset; |
| 592 | if (eNested->GetScalarAttribute("offset", offset)) |
| 593 | { |
| 594 | if (this->PointDataOffset->at(name) != offset) |
| 595 | { |
| 596 | // save the pointsOffset |
| 597 | assert(this->PointDataTimeStep->at(name) == -1); // cannot have mixture of binary and appended |
| 598 | this->PointDataOffset->at(name) = offset; |
| 599 | return 1; |
| 600 | } |
| 601 | } |
| 602 | else |
| 603 | { |
| 604 | // No offset is specified this is a binary file |
| 605 | // First thing to check if numTimeSteps == 0: |
| 606 | if (!numTimeSteps && this->NumberOfTimeSteps && this->PointDataTimeStep->at(name) == -1) |
| 607 | { |
| 608 | // Update last PointsTimeStep read |
| 609 | (*this->PointDataTimeStep)[name] = this->CurrentTimeStep; |
| 610 | return 1; |
| 611 | } |
| 612 | int isLastTimeInArray = vtkXMLReader::IsTimeStepInArray( |
| 613 | this->PointDataTimeStep->at(name), this->TimeSteps, numTimeSteps); |
| 614 | // If no time is specified or if time is specified and match then read |
| 615 | if (isCurrentTimeInArray && !isLastTimeInArray) |
| 616 | { |
no test coverage detected