MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteData

Method WriteData

IO/Legacy/vtkTreeWriter.cxx:30–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void 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);

Callers

nothing calls this directly

Calls 12

GetInputMethod · 0.95
WriteEdgesMethod · 0.95
WriteEdgeDataMethod · 0.80
WriteVertexDataMethod · 0.80
OpenVTKFileMethod · 0.45
WriteHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
WriteFieldDataMethod · 0.45
GetFieldDataMethod · 0.45
WritePointsMethod · 0.45
GetPointsMethod · 0.45
GetNumberOfEdgesMethod · 0.45

Tested by

no test coverage detected