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

Method ReadVTKFile

IO/XML/vtkXMLReader.cxx:1041–1083  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1039
1040//------------------------------------------------------------------------------
1041int vtkXMLReader::ReadVTKFile(vtkXMLDataElement* eVTKFile)
1042{
1043 // Check if the file version is one we support.
1044 const char* version = eVTKFile->GetAttribute("version");
1045 if (version && !this->CanReadFileVersionString(version))
1046 {
1047 vtkWarningMacro("File version: " << version
1048 << " is higher than "
1049 "this reader supports "
1050 << vtkXMLReaderMajorVersion << "."
1051 << vtkXMLReaderMinorVersion);
1052 }
1053
1054 ::ReadStringVersion(version, this->FileMajorVersion, this->FileMinorVersion);
1055
1056 // Setup the compressor if there is one.
1057 const char* compressor = eVTKFile->GetAttribute("compressor");
1058 if (compressor)
1059 {
1060 this->SetupCompressor(compressor);
1061 }
1062
1063 // Get the primary element.
1064 const char* name = this->GetDataSetName();
1065 vtkXMLDataElement* ePrimary = nullptr;
1066 for (int i = 0; i < eVTKFile->GetNumberOfNestedElements(); ++i)
1067 {
1068 vtkXMLDataElement* eNested = eVTKFile->GetNestedElement(i);
1069 if (strcmp(eNested->GetName(), name) == 0)
1070 {
1071 ePrimary = eNested;
1072 break;
1073 }
1074 }
1075 if (!ePrimary)
1076 {
1077 vtkErrorMacro("Cannot find " << name << " element in file.");
1078 return 0;
1079 }
1080
1081 // Read the primary element.
1082 return this->ReadPrimaryElement(ePrimary);
1083}
1084
1085//------------------------------------------------------------------------------
1086int vtkXMLReader::ReadPrimaryElement(vtkXMLDataElement* ePrimary)

Callers 1

ReadXMLInformationMethod · 0.95

Calls 9

SetupCompressorMethod · 0.95
ReadPrimaryElementMethod · 0.95
ReadStringVersionFunction · 0.85
GetNestedElementMethod · 0.80
GetAttributeMethod · 0.45
GetDataSetNameMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected