------------------------------------------------------------------------------
| 316 | |
| 317 | //------------------------------------------------------------------------------ |
| 318 | int vtkGraphReader::ReadGraphType(const char* fname, GraphType& type) |
| 319 | { |
| 320 | type = UnknownGraph; |
| 321 | |
| 322 | if (!this->OpenVTKFile(fname) || !this->ReadHeader()) |
| 323 | { |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | // Read graph-specific stuff |
| 328 | char line[256]; |
| 329 | if (!this->ReadString(line)) |
| 330 | { |
| 331 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 332 | this->CloseVTKFile(); |
| 333 | return 0; |
| 334 | } |
| 335 | |
| 336 | if (strncmp(this->LowerCase(line), "dataset", 7) != 0) |
| 337 | { |
| 338 | vtkErrorMacro(<< "Unrecognized keyword: " << line); |
| 339 | this->CloseVTKFile(); |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | if (!this->ReadString(line)) |
| 344 | { |
| 345 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 346 | this->CloseVTKFile(); |
| 347 | return 0; |
| 348 | } |
| 349 | |
| 350 | if (!strncmp(this->LowerCase(line), "directed_graph", 14)) |
| 351 | { |
| 352 | type = DirectedGraph; |
| 353 | } |
| 354 | else if (!strncmp(this->LowerCase(line), "undirected_graph", 16)) |
| 355 | { |
| 356 | type = UndirectedGraph; |
| 357 | } |
| 358 | else if (!strncmp(this->LowerCase(line), "molecule", 8)) |
| 359 | { |
| 360 | type = Molecule; |
| 361 | } |
| 362 | else |
| 363 | { |
| 364 | vtkErrorMacro(<< "Cannot read type: " << line); |
| 365 | this->CloseVTKFile(); |
| 366 | return 0; |
| 367 | } |
| 368 | return 1; |
| 369 | } |
| 370 | |
| 371 | //------------------------------------------------------------------------------ |
| 372 | int vtkGraphReader::FillOutputPortInformation(int, vtkInformation* info) |
no test coverage detected