| 28 | } |
| 29 | |
| 30 | void vtkTreeWriter::WriteData() |
| 31 | { |
| 32 | ostream* fp; |
| 33 | vtkTree* const input = this->GetInput(); |
| 34 | |
| 35 | vtkDebugMacro(<< "Writing vtk tree data..."); |
| 36 | |
| 37 | if (!(fp = this->OpenVTKFile()) || !this->WriteHeader(fp)) |
| 38 | { |
| 39 | if (fp) |
| 40 | { |
| 41 | if (this->FileName) |
| 42 | { |
| 43 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
| 44 | this->CloseVTKFile(fp); |
| 45 | unlink(this->FileName); |
| 46 | } |
| 47 | else |
| 48 | { |
| 49 | this->CloseVTKFile(fp); |
| 50 | vtkErrorMacro("Could not read memory header. "); |
| 51 | } |
| 52 | } |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | *fp << "DATASET TREE\n"; |
| 57 | |
| 58 | bool error_occurred = false; |
| 59 | |
| 60 | if (!this->WriteFieldData(fp, input->GetFieldData())) |
| 61 | { |
| 62 | error_occurred = true; |
| 63 | } |
| 64 | if (!error_occurred && !this->WritePoints(fp, input->GetPoints())) |
| 65 | { |
| 66 | error_occurred = true; |
| 67 | } |
| 68 | if (!error_occurred) |
| 69 | { |
| 70 | const vtkIdType edge_count = input->GetNumberOfEdges(); |
| 71 | *fp << "EDGES " << edge_count << "\n"; |
| 72 | this->WriteEdges(*fp, input); |
| 73 | } |
| 74 | if (!error_occurred && !this->WriteEdgeData(fp, input)) |
| 75 | { |
| 76 | error_occurred = true; |
| 77 | } |
| 78 | if (!error_occurred && !this->WriteVertexData(fp, input)) |
| 79 | { |
| 80 | error_occurred = true; |
| 81 | } |
| 82 | |
| 83 | if (error_occurred) |
| 84 | { |
| 85 | if (this->FileName) |
| 86 | { |
| 87 | vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName); |
nothing calls this directly
no test coverage detected