| 295 | } |
| 296 | |
| 297 | int vtkDataSetReader::ReadOutputType() |
| 298 | { |
| 299 | char line[256]; |
| 300 | |
| 301 | vtkDebugMacro(<< "Reading vtk dataset..."); |
| 302 | |
| 303 | if (!this->OpenVTKFile() || !this->ReadHeader()) |
| 304 | { |
| 305 | return -1; |
| 306 | } |
| 307 | |
| 308 | // Determine dataset type |
| 309 | // |
| 310 | if (!this->ReadString(line)) |
| 311 | { |
| 312 | vtkDebugMacro(<< "Premature EOF reading dataset keyword"); |
| 313 | return -1; |
| 314 | } |
| 315 | |
| 316 | if (!strncmp(this->LowerCase(line), "dataset", 7)) |
| 317 | { |
| 318 | // See if type is recognized. |
| 319 | // |
| 320 | if (!this->ReadString(line)) |
| 321 | { |
| 322 | vtkDebugMacro(<< "Premature EOF reading type"); |
| 323 | this->CloseVTKFile(); |
| 324 | return -1; |
| 325 | } |
| 326 | |
| 327 | this->CloseVTKFile(); |
| 328 | if (!strncmp(this->LowerCase(line), "polydata", 8)) |
| 329 | { |
| 330 | return VTK_POLY_DATA; |
| 331 | } |
| 332 | else if (!strncmp(line, "structured_points", 17)) |
| 333 | { |
| 334 | return VTK_STRUCTURED_POINTS; |
| 335 | } |
| 336 | else if (!strncmp(line, "structured_grid", 15)) |
| 337 | { |
| 338 | return VTK_STRUCTURED_GRID; |
| 339 | } |
| 340 | else if (!strncmp(line, "rectilinear_grid", 16)) |
| 341 | { |
| 342 | return VTK_RECTILINEAR_GRID; |
| 343 | } |
| 344 | else if (!strncmp(line, "unstructured_grid", 17)) |
| 345 | { |
| 346 | return VTK_UNSTRUCTURED_GRID; |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | vtkDebugMacro(<< "Cannot read dataset type: " << line); |
| 351 | return -1; |
| 352 | } |
| 353 | } |
| 354 | else if (!strncmp(this->LowerCase(line), "field", (unsigned long)5)) |
no test coverage detected