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

Method ParseCaseFile

IO/EnSight/core/EnSightDataSet.cxx:476–617  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

474
475//------------------------------------------------------------------------------
476bool 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 }

Callers 1

RequestInformationMethod · 0.45

Calls 12

ParseFormatSectionMethod · 0.95
ParseGeometrySectionMethod · 0.95
ParseVariableSectionMethod · 0.95
ParseTimeSectionMethod · 0.95
ParseFileSectionMethod · 0.95
IsSectionHeaderMethod · 0.95
SetFileNamePatternMethod · 0.80
ReadNextLineMethod · 0.80
SetTimeSetInfoMethod · 0.80
SetFileSetInfoMethod · 0.80
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected