| 278 | } |
| 279 | |
| 280 | int vtkStructuredPointsReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput) |
| 281 | { |
| 282 | this->SetErrorCode(vtkErrorCode::NoError); |
| 283 | vtkIdType numPts = 0, numCells = 0; |
| 284 | char line[256]; |
| 285 | vtkIdType npts, ncells; |
| 286 | int dimsRead = 0, arRead = 0, originRead = 0; |
| 287 | vtkStructuredPoints* output = vtkStructuredPoints::SafeDownCast(doOutput); |
| 288 | |
| 289 | // ImageSource superclass does not do this. |
| 290 | output->ReleaseData(); |
| 291 | |
| 292 | vtkDebugMacro(<< "Reading vtk structured points file..."); |
| 293 | |
| 294 | if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str())) |
| 295 | { |
| 296 | return 1; |
| 297 | } |
| 298 | |
| 299 | // Read structured points specific stuff |
| 300 | // |
| 301 | if (!this->ReadString(line)) |
| 302 | { |
| 303 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 304 | this->CloseVTKFile(); |
| 305 | this->SetErrorCode(vtkErrorCode::PrematureEndOfFileError); |
| 306 | return 1; |
| 307 | } |
| 308 | |
| 309 | if (!strncmp(this->LowerCase(line), "dataset", 7)) |
| 310 | { |
| 311 | // Make sure we're reading right type of geometry |
| 312 | // |
| 313 | if (!this->ReadString(line)) |
| 314 | { |
| 315 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 316 | this->CloseVTKFile(); |
| 317 | this->SetErrorCode(vtkErrorCode::PrematureEndOfFileError); |
| 318 | return 1; |
| 319 | } |
| 320 | |
| 321 | if (strncmp(this->LowerCase(line), "structured_points", 17) != 0) |
| 322 | { |
| 323 | vtkErrorMacro(<< "Cannot read dataset type: " << line); |
| 324 | this->CloseVTKFile(); |
| 325 | this->SetErrorCode(vtkErrorCode::UnrecognizedFileTypeError); |
| 326 | return 1; |
| 327 | } |
| 328 | |
| 329 | // Read keyword and number of points |
| 330 | // |
| 331 | numPts = output->GetNumberOfPoints(); // get default |
| 332 | while (true) |
| 333 | { |
| 334 | if (!this->ReadString(line)) |
| 335 | { |
| 336 | break; |
| 337 | } |
nothing calls this directly
no test coverage detected