| 91 | } |
| 92 | |
| 93 | int vtkLegacyStatisticalModelReader::ReadMeshSimple( |
| 94 | const std::string& fname, vtkDataObject* doOutput) |
| 95 | { |
| 96 | char line[256]; |
| 97 | vtkStatisticalModel* output = vtkStatisticalModel::SafeDownCast(doOutput); |
| 98 | |
| 99 | vtkDebugMacro(<< "Reading vtk statistical model..."); |
| 100 | |
| 101 | if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str())) |
| 102 | { |
| 103 | return 1; |
| 104 | } |
| 105 | |
| 106 | // Read stuff specific to statistical model |
| 107 | if (!this->ReadString(line) || strncmp(this->LowerCase(line), "dataset", 7) != 0) |
| 108 | { |
| 109 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 110 | this->CloseVTKFile(); |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | // Make sure we're reading right type of data |
| 115 | if (!this->ReadString(line) || strncmp(this->LowerCase(line), "statistical_model", 17) != 0) |
| 116 | { |
| 117 | vtkErrorMacro(<< "Cannot read dataset type \"" << line << "\"!"); |
| 118 | this->CloseVTKFile(); |
| 119 | return 1; |
| 120 | } |
| 121 | |
| 122 | int numberOfTableGroups; |
| 123 | if (!this->Read(&numberOfTableGroups)) |
| 124 | { |
| 125 | vtkErrorMacro(<< "Cannot read number of table groups."); |
| 126 | this->CloseVTKFile(); |
| 127 | return 1; |
| 128 | } |
| 129 | |
| 130 | // Read the algorithm parameters |
| 131 | std::string decodedData; |
| 132 | if (!ReadEncodedBlock("algorithm_parameters", decodedData, this, line)) |
| 133 | { |
| 134 | vtkErrorMacro(<< "Cannot read algorithm parameters \"" << line << "\"!"); |
| 135 | this->CloseVTKFile(); |
| 136 | return 1; |
| 137 | } |
| 138 | output->SetAlgorithmParameters(decodedData.empty() ? nullptr : decodedData.c_str()); |
| 139 | |
| 140 | // Read table groups |
| 141 | vtkNew<vtkTableReader> tableReader; |
| 142 | tableReader->ReadFromInputStringOn(); |
| 143 | for (int gg = 0; gg < numberOfTableGroups; ++gg) |
| 144 | { |
| 145 | int numberOfTables; |
| 146 | if (!this->ReadString(line) || strncmp(this->LowerCase(line), "model_tables", 12) != 0 || |
| 147 | !this->ReadString(line)) |
| 148 | { |
| 149 | vtkErrorMacro(<< "Cannot read model table group " << gg << "."); |
| 150 | this->CloseVTKFile(); |
nothing calls this directly
no test coverage detected