------------------------------------------------------------------------------
| 137 | |
| 138 | //------------------------------------------------------------------------------ |
| 139 | int vtkStructuredGridReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput) |
| 140 | { |
| 141 | vtkIdType numPts = 0, npts = 0, numCells = 0, ncells; |
| 142 | char line[256]; |
| 143 | int dimsRead = 0; |
| 144 | vtkStructuredGrid* output = vtkStructuredGrid::SafeDownCast(doOutput); |
| 145 | |
| 146 | vtkDebugMacro(<< "Reading vtk structured grid file..."); |
| 147 | |
| 148 | if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str())) |
| 149 | { |
| 150 | return 1; |
| 151 | } |
| 152 | |
| 153 | // Read structured grid specific stuff |
| 154 | // |
| 155 | if (!this->ReadString(line)) |
| 156 | { |
| 157 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 158 | this->CloseVTKFile(); |
| 159 | return 1; |
| 160 | } |
| 161 | |
| 162 | if (!strncmp(this->LowerCase(line), "dataset", 7)) |
| 163 | { |
| 164 | // Make sure we're reading right type of geometry |
| 165 | // |
| 166 | if (!this->ReadString(line)) |
| 167 | { |
| 168 | vtkErrorMacro(<< "Data file ends prematurely!"); |
| 169 | this->CloseVTKFile(); |
| 170 | return 1; |
| 171 | } |
| 172 | |
| 173 | if (strncmp(this->LowerCase(line), "structured_grid", 15) != 0) |
| 174 | { |
| 175 | vtkErrorMacro(<< "Cannot read dataset type: " << line); |
| 176 | this->CloseVTKFile(); |
| 177 | return 1; |
| 178 | } |
| 179 | |
| 180 | // Read keyword and number of points |
| 181 | // |
| 182 | while (true) |
| 183 | { |
| 184 | if (!this->ReadString(line)) |
| 185 | { |
| 186 | break; |
| 187 | } |
| 188 | |
| 189 | if (!strncmp(this->LowerCase(line), "field", 5)) |
| 190 | { |
| 191 | vtkFieldData* fd = this->ReadFieldData(); |
| 192 | output->SetFieldData(fd); |
| 193 | fd->Delete(); // ? |
| 194 | } |
| 195 | |
| 196 | else if (!strncmp(line, "extent", 6) && !dimsRead) |
nothing calls this directly
no test coverage detected