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

Method ParseVariableSection

IO/EnSight/core/EnSightDataSet.cxx:736–813  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

734
735//------------------------------------------------------------------------------
736void EnSightDataSet::ParseVariableSection()
737{
738 this->Variables.clear();
739 auto result = this->CaseFile.ReadNextLine(MAX_CASE_LINE_LENGTH);
740 while (result.first)
741 {
742 std::string& line = result.second;
743 if (this->IsSectionHeader(line))
744 {
745 this->CaseFile.GoBackOneLine();
746 break;
747 }
748
749 std::string varType, fileName;
750 VariableOptions opts;
751
752 extractLinePart(GetLineTypeRegEx(), line, varType);
753 opts.Type = getVariableTypeFromString(varType);
754 if (opts.Type == VariableType::Unknown)
755 {
756 // error
757 vtkGenericWarningMacro("could not determine type of variable!");
758 continue;
759 }
760
761 extractLinePart(GetIntRegEx(), line, opts.File.TimeSet);
762 if (opts.Type == VariableType::ConstantPerCase)
763 {
764 extractLinePart(GetFileNameRegEx(), line, opts.Name);
765 readCaseFileValues(this->CaseFile, line, opts.Constants);
766 }
767 else if (opts.Type == VariableType::ConstantPerCaseFile)
768 {
769 extractLinePart(GetFileNameRegEx(), line, opts.Name);
770 if (!extractFileName(line, fileName))
771 {
772 vtkGenericWarningMacro("could not extract file name from " << result.second);
773 }
774 opts.File.SetFileNamePattern(this->GetFullPath(fileName));
775 }
776 else if (opts.Type == VariableType::ConstantPerPart)
777 {
778 vtkGenericWarningMacro("Constant per part not yet supported");
779 }
780 else
781 {
782 if (opts.File.TimeSet == -1)
783 {
784 // old reader seems to just automatically have a time set id 1 even if it's not specified
785 // I have run into some customer data that used wildcards in filenames, but did not
786 // specify the time set
787 opts.File.TimeSet = 1;
788 }
789
790 extractLinePart(GetIntRegEx(), line, opts.File.FileSet);
791 extractLinePart(GetFileNameRegEx(), line, opts.Name);
792
793 if (!extractFileName(line, fileName))

Callers 1

ParseCaseFileMethod · 0.95

Calls 12

IsSectionHeaderMethod · 0.95
GetFullPathMethod · 0.95
extractLinePartFunction · 0.85
readCaseFileValuesFunction · 0.85
extractFileNameFunction · 0.85
ReadNextLineMethod · 0.80
GoBackOneLineMethod · 0.80
SetFileNamePatternMethod · 0.80
clearMethod · 0.45
findMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected