------------------------------------------------------------------------------
| 49 | |
| 50 | //------------------------------------------------------------------------------ |
| 51 | int vtkUnstructuredGridReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput) |
| 52 | { |
| 53 | vtkIdType i, numPts = 0, numCells = 0; |
| 54 | char line[256]; |
| 55 | vtkIdType npts, size = 0, ncells = 0; |
| 56 | int piece, numPieces, skip1, read2, skip3, tmp; |
| 57 | vtkCellArray* cells = nullptr; |
| 58 | int* types = nullptr; |
| 59 | vtkUnstructuredGrid* output = vtkUnstructuredGrid::SafeDownCast(doOutput); |
| 60 | |
| 61 | vtkDebugMacro(<< "Reading vtk unstructured grid..."); |
| 62 | |
| 63 | if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str())) |
| 64 | { |
| 65 | return 1; |
| 66 | } |
| 67 | |
| 68 | // Read unstructured grid specific stuff |
| 69 | // |
| 70 | if (!this->ReadString(line)) |
| 71 | { |
| 72 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 73 | this->CloseVTKFile(); |
| 74 | return 1; |
| 75 | } |
| 76 | |
| 77 | if (!strncmp(this->LowerCase(line), "dataset", 7)) |
| 78 | { |
| 79 | // Make sure we're reading right type of geometry |
| 80 | // |
| 81 | if (!this->ReadString(line)) |
| 82 | { |
| 83 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 84 | this->CloseVTKFile(); |
| 85 | return 1; |
| 86 | } |
| 87 | |
| 88 | if (strncmp(this->LowerCase(line), "unstructured_grid", 17) != 0) |
| 89 | { |
| 90 | vtkErrorMacro(<< "Cannot read dataset type: " << line); |
| 91 | this->CloseVTKFile(); |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | // Might find points, cells, and cell types |
| 96 | // |
| 97 | while (true) |
| 98 | { |
| 99 | if (!this->ReadString(line)) |
| 100 | { |
| 101 | break; |
| 102 | } |
| 103 | |
| 104 | if (!strncmp(this->LowerCase(line), "field", 5)) |
| 105 | { |
| 106 | vtkFieldData* fd = this->ReadFieldData(); |
| 107 | output->SetFieldData(fd); |
| 108 | fd->Delete(); // ? |
nothing calls this directly
no test coverage detected