------------------------------------------------------------------------------
| 474 | |
| 475 | //------------------------------------------------------------------------------ |
| 476 | bool EnSightDataSet::ParseCaseFile(const char* casefilename) |
| 477 | { |
| 478 | // need to reset since this means that RequestInformation has been called |
| 479 | this->MeasuredPartitionId = -1; |
| 480 | |
| 481 | // has 5 sections: FORMAT, GEOMETRY, VARIABLE, TIME, FILE |
| 482 | if (!this->CaseFile.SetFileNamePattern(casefilename, true)) |
| 483 | { |
| 484 | vtkGenericWarningMacro("Casefile " << casefilename << " could not be opened"); |
| 485 | return false; |
| 486 | } |
| 487 | auto parentDir = vtksys::SystemTools::GetParentDirectory(casefilename); |
| 488 | vtksys::SystemTools::SplitPath(parentDir, this->FilePath); |
| 489 | |
| 490 | auto result = this->CaseFile.ReadNextLine(MAX_CASE_LINE_LENGTH); |
| 491 | while (result.first) |
| 492 | { |
| 493 | std::string& line = result.second; |
| 494 | if (line.find("FORMAT") != std::string::npos) |
| 495 | { |
| 496 | if (!this->ParseFormatSection()) |
| 497 | { |
| 498 | vtkGenericWarningMacro("This reader handles only EnSight Gold files"); |
| 499 | return false; |
| 500 | } |
| 501 | } |
| 502 | else if (line.find("GEOMETRY") != std::string::npos) |
| 503 | { |
| 504 | this->ParseGeometrySection(); |
| 505 | } |
| 506 | else if (line.find("VARIABLE") != std::string::npos) |
| 507 | { |
| 508 | this->ParseVariableSection(); |
| 509 | } |
| 510 | else if (line.find("TIME") != std::string::npos) |
| 511 | { |
| 512 | this->ParseTimeSection(); |
| 513 | } |
| 514 | else if (line.find("FILE") != std::string::npos) |
| 515 | { |
| 516 | this->ParseFileSection(); |
| 517 | } |
| 518 | else if (line.find("MATERIAL") != std::string::npos || |
| 519 | line.find("BLOCK_CONTINUATION") != std::string::npos || |
| 520 | line.find("SCRIPTS") != std::string::npos) |
| 521 | { |
| 522 | vtkGenericWarningMacro("Skipping case file section: " << line); |
| 523 | result = this->CaseFile.ReadNextLine(MAX_CASE_LINE_LENGTH); |
| 524 | while (result.first && !this->IsSectionHeader(result.second)) |
| 525 | { |
| 526 | result = this->CaseFile.ReadNextLine(MAX_CASE_LINE_LENGTH); |
| 527 | } |
| 528 | continue; |
| 529 | } |
| 530 | else |
| 531 | { |
| 532 | vtkGenericWarningMacro("ParseCaseFile: invalid line - " << line); |
| 533 | } |
no test coverage detected