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

Method RowDataNeedToReadTimeStep

IO/XML/vtkXMLTableReader.cxx:526–592  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

524
525//------------------------------------------------------------------------------
526int 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 {

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