| 17 | vtkStandardNewMacro(vtkStructuredGridWriter); |
| 18 | |
| 19 | void vtkStructuredGridWriter::WriteData() |
| 20 | { |
| 21 | ostream* fp; |
| 22 | vtkStructuredGrid* input = vtkStructuredGrid::SafeDownCast(this->GetInput()); |
| 23 | int dim[3]; |
| 24 | |
| 25 | vtkDebugMacro(<< "Writing vtk structured grid..."); |
| 26 | |
| 27 | if (!(fp = this->OpenVTKFile()) || !this->WriteHeader(fp)) |
| 28 | { |
| 29 | if (fp) |
| 30 | { |
| 31 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 32 | this->CloseVTKFile(fp); |
| 33 | unlink(this->FileName); |
| 34 | } |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | // Write structured grid specific stuff |
| 39 | // |
| 40 | *fp << "DATASET STRUCTURED_GRID\n"; |
| 41 | |
| 42 | // Write data owned by the dataset |
| 43 | if (!this->WriteDataSetData(fp, input)) |
| 44 | { |
| 45 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 46 | this->CloseVTKFile(fp); |
| 47 | unlink(this->FileName); |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | if (this->WriteExtent) |
| 52 | { |
| 53 | int extent[6]; |
| 54 | input->GetExtent(extent); |
| 55 | *fp << "EXTENT " << extent[0] << " " << extent[1] << " " << extent[2] << " " << extent[3] << " " |
| 56 | << extent[4] << " " << extent[5] << "\n"; |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | input->GetDimensions(dim); |
| 61 | *fp << "DIMENSIONS " << dim[0] << " " << dim[1] << " " << dim[2] << "\n"; |
| 62 | } |
| 63 | |
| 64 | if (!this->WritePoints(fp, input->GetPoints())) |
| 65 | { |
| 66 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 67 | this->CloseVTKFile(fp); |
| 68 | unlink(this->FileName); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | if (!this->WriteCellData(fp, input)) |
| 73 | { |
| 74 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 75 | this->CloseVTKFile(fp); |
| 76 | unlink(this->FileName); |
nothing calls this directly
no test coverage detected