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

Method CellDataNeedToReadTimeStep

IO/XML/vtkXMLDataReader.cxx:628–694  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

626
627//------------------------------------------------------------------------------
628int vtkXMLDataReader::CellDataNeedToReadTimeStep(vtkXMLDataElement* eNested)
629{
630 // First thing need to find the id of this dataarray from its name:
631 const char* name = eNested->GetAttribute("Name");
632
633 // Easy case no timestep:
634 int numTimeSteps =
635 eNested->GetVectorAttribute("TimeStep", this->NumberOfTimeSteps, this->TimeSteps);
636 if (!(numTimeSteps <= this->NumberOfTimeSteps))
637 {
638 vtkErrorMacro("Invalid TimeSteps specification");
639 this->DataError = 1;
640 return 0;
641 }
642 if (!numTimeSteps && !this->NumberOfTimeSteps)
643 {
644 assert(this->CellDataTimeStep->at(name) == -1); // No timestep in this file
645 return 1;
646 }
647 // else TimeStep was specified but no TimeValues associated were found
648 assert(this->NumberOfTimeSteps);
649
650 // case numTimeSteps > 1
651 int isCurrentTimeInArray =
652 vtkXMLReader::IsTimeStepInArray(this->CurrentTimeStep, this->TimeSteps, numTimeSteps);
653 if (numTimeSteps && !isCurrentTimeInArray)
654 {
655 return 0;
656 }
657 // we know that time steps are specified and that CurrentTimeStep is in the array
658 // we need to figure out if we need to read the array or if it was forwarded
659 // Need to check the current 'offset'
660 vtkTypeInt64 offset;
661 if (eNested->GetScalarAttribute("offset", offset))
662 {
663 if (this->CellDataOffset->at(name) != offset)
664 {
665 // save the pointsOffset
666 assert(this->CellDataTimeStep->at(name) == -1); // cannot have mixture of binary and appended
667 this->CellDataOffset->at(name) = offset;
668 return 1;
669 }
670 }
671 else
672 {
673 // No offset is specified this is a binary file
674 // First thing to check if numTimeSteps == 0:
675 if (!numTimeSteps && this->NumberOfTimeSteps && this->CellDataTimeStep->at(name) == -1)
676 {
677 // Update last CellDataTimeStep read
678 this->CellDataTimeStep->at(name) = this->CurrentTimeStep;
679 return 1;
680 }
681 int isLastTimeInArray = vtkXMLReader::IsTimeStepInArray(
682 this->CellDataTimeStep->at(name), this->TimeSteps, numTimeSteps);
683 // If no time is specified or if time is specified and match then read
684 if (isCurrentTimeInArray && !isLastTimeInArray)
685 {

Callers 1

ReadPieceDataMethod · 0.95

Calls 5

GetVectorAttributeMethod · 0.80
GetScalarAttributeMethod · 0.80
assertFunction · 0.50
GetAttributeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected