------------------------------------------------------------------------------
| 524 | |
| 525 | //------------------------------------------------------------------------------ |
| 526 | int vtkXMLTableReader::RowDataNeedToReadTimeStep(vtkXMLDataElement* eNested) |
| 527 | { |
| 528 | // First thing need to find the id of this dataarray from its name: |
| 529 | const char* name = eNested->GetAttribute("Name"); |
| 530 | |
| 531 | // Easy case no timestep: |
| 532 | int numTimeSteps = |
| 533 | eNested->GetVectorAttribute("TimeStep", this->NumberOfTimeSteps, this->TimeSteps); |
| 534 | if (!(numTimeSteps <= this->NumberOfTimeSteps)) |
| 535 | { |
| 536 | vtkErrorMacro("Invalid TimeStep specification"); |
| 537 | this->DataError = 1; |
| 538 | return 0; |
| 539 | } |
| 540 | if (!numTimeSteps && !this->NumberOfTimeSteps) |
| 541 | { |
| 542 | assert(this->RowDataTimeStep.at(name) == -1); // No timestep in this file |
| 543 | return 1; |
| 544 | } |
| 545 | // else TimeStep was specified but no TimeValues associated were found |
| 546 | assert(this->NumberOfTimeSteps); |
| 547 | |
| 548 | // case numTimeSteps > 1 |
| 549 | int isCurrentTimeInArray = |
| 550 | vtkXMLReader::IsTimeStepInArray(this->CurrentTimeStep, this->TimeSteps, numTimeSteps); |
| 551 | if (numTimeSteps && !isCurrentTimeInArray) |
| 552 | { |
| 553 | return 0; |
| 554 | } |
| 555 | // we know that time steps are specified and that CurrentTimeStep is in the array |
| 556 | // we need to figure out if we need to read the array or if it was forwarded |
| 557 | // Need to check the current 'offset' |
| 558 | vtkTypeInt64 offset; |
| 559 | if (eNested->GetScalarAttribute("offset", offset)) |
| 560 | { |
| 561 | if (this->RowDataOffset.at(name) != offset) |
| 562 | { |
| 563 | // save the pointsOffset |
| 564 | assert(this->RowDataTimeStep.at(name) == -1); // cannot have mixture of binary and appended |
| 565 | this->RowDataOffset.at(name) = offset; |
| 566 | return 1; |
| 567 | } |
| 568 | } |
| 569 | else |
| 570 | { |
| 571 | // No offset is specified this is a binary file |
| 572 | // First thing to check if numTimeSteps == 0: |
| 573 | if (!numTimeSteps && this->NumberOfTimeSteps && this->RowDataTimeStep.at(name) == -1) |
| 574 | { |
| 575 | // Update last PointsTimeStep read |
| 576 | this->RowDataTimeStep.at(name) = this->CurrentTimeStep; |
| 577 | return 1; |
| 578 | } |
| 579 | int isLastTimeInArray = vtkXMLReader::IsTimeStepInArray( |
| 580 | this->RowDataTimeStep.at(name), this->TimeSteps, numTimeSteps); |
| 581 | // If no time is specified or if time is specified and match then read |
| 582 | if (isCurrentTimeInArray && !isLastTimeInArray) |
| 583 | { |
no test coverage detected