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

Method ReadCaseFileVariable

IO/EnSight/vtkEnSightReader.cxx:638–1180  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

636
637//------------------------------------------------------------------------------
638int vtkEnSightReader::ReadCaseFileVariable(char* line)
639{
640 int lineRead, timeSet, fileSet;
641
642 this->NumberOfScalarsPerNode = 0;
643 this->NumberOfVectorsPerNode = 0;
644 this->NumberOfTensorsAsymPerNode = 0;
645 this->NumberOfTensorsSymmPerNode = 0;
646 this->NumberOfScalarsPerElement = 0;
647 this->NumberOfVectorsPerElement = 0;
648 this->NumberOfTensorsAsymPerElement = 0;
649 this->NumberOfTensorsSymmPerElement = 0;
650 this->NumberOfScalarsPerMeasuredNode = 0;
651 this->NumberOfVectorsPerMeasuredNode = 0;
652 this->NumberOfComplexScalarsPerNode = 0;
653 this->NumberOfComplexVectorsPerNode = 0;
654 this->NumberOfComplexScalarsPerElement = 0;
655 this->NumberOfComplexVectorsPerElement = 0;
656
657 lineRead = this->ReadNextDataLine(line);
658 while (lineRead && strncmp(line, "FORMAT", 6) != 0 && strncmp(line, "GEOMETRY", 8) != 0 &&
659 strncmp(line, "VARIABLE", 8) != 0 && strncmp(line, "TIME", 4) != 0 &&
660 strncmp(line, "FILE", 4) != 0 && strncmp(line, "SCRIPTS", 7) != 0)
661 {
662 if (strncmp(line, "constant", 8) == 0)
663 {
664 vtkDebugMacro(<< line);
665 }
666 else if (strncmp(line, "scalar", 6) == 0)
667 {
668 auto resultSubLine0 = vtk::scan<std::string_view, std::string_view, std::string>(
669 std::string_view(line), " {:s} {:s} {:s}");
670 auto subLine = std::get<2>(resultSubLine0->values());
671 if (subLine == "node:")
672 {
673 vtkDebugMacro("scalar per node");
674 this->VariableMode = vtkEnSightReader::SCALAR_PER_NODE;
675 if (auto resultSubLine1 =
676 vtk::scan<int, int, std::string_view>(resultSubLine0->range(), "{:d} {:d} {:s}"))
677 {
678 std::tie(timeSet, fileSet, subLine) = resultSubLine1->values();
679 this->VariableTimeSetIds->InsertNextId(timeSet);
680 this->VariableFileSetIds->InsertNextId(fileSet);
681 this->AddVariableDescription(subLine.c_str());
682 subLine = vtk::scan_value<std::string_view>(resultSubLine1->range())->value();
683 }
684 else if (auto resultSubLine2 =
685 vtk::scan<int, std::string_view>(resultSubLine0->range(), "{:d} {:s}"))
686 {
687 std::tie(timeSet, subLine) = resultSubLine2->values();
688 this->VariableTimeSetIds->InsertNextId(timeSet);
689 this->AddVariableDescription(subLine.c_str());
690 subLine = vtk::scan_value<std::string_view>(resultSubLine2->range())->value();
691 }
692 else if (auto resultSubLine3 = vtk::scan_value<std::string_view>(resultSubLine0->range()))
693 {
694 subLine = resultSubLine3->value();
695 this->VariableTimeSetIds->InsertNextId(1);

Callers 1

ReadCaseFileMethod · 0.95

Calls 10

AddVariableTypeMethod · 0.95
AddVariableFileNameMethod · 0.95
ReadNextDataLineMethod · 0.80
InsertNextIdMethod · 0.80
valuesMethod · 0.45
rangeMethod · 0.45
c_strMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected