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

Method WriteData

IO/Legacy/vtkUnstructuredGridWriter.cxx:27–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25vtkStandardNewMacro(vtkUnstructuredGridWriter);
26
27void vtkUnstructuredGridWriter::WriteData()
28{
29 ostream* fp;
30 vtkUnstructuredGridBase* input = vtkUnstructuredGridBase::SafeDownCast(this->GetInput());
31 int *types, ncells, cellId;
32
33 vtkDebugMacro(<< "Writing vtk unstructured grid data...");
34
35 if (!(fp = this->OpenVTKFile()) || !this->WriteHeader(fp))
36 {
37 if (fp)
38 {
39 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
40 this->CloseVTKFile(fp);
41 unlink(this->FileName);
42 }
43 return;
44 }
45 //
46 // Write unstructured grid specific stuff
47 //
48 *fp << "DATASET UNSTRUCTURED_GRID\n";
49
50 // Write data owned by the dataset
51 if (!this->WriteDataSetData(fp, input))
52 {
53 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
54 this->CloseVTKFile(fp);
55 unlink(this->FileName);
56 return;
57 }
58
59 if (!this->WritePoints(fp, input->GetPoints()))
60 {
61 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
62 this->CloseVTKFile(fp);
63 unlink(this->FileName);
64 return;
65 }
66
67 // Handle face data:
68 if (!this->WriteCellsAndFaces(fp, input, "CELLS"))
69 {
70 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
71 this->CloseVTKFile(fp);
72 unlink(this->FileName);
73 return;
74 }
75
76 //
77 // Cell types are a little more work
78 //
79
80 ncells = input->GetNumberOfCells();
81 if (ncells > 0)
82 {
83 types = new int[ncells];
84 for (cellId = 0; cellId < ncells; cellId++)

Callers

nothing calls this directly

Calls 12

GetInputMethod · 0.95
WriteCellsAndFacesMethod · 0.95
WriteDataSetDataMethod · 0.80
OpenVTKFileMethod · 0.45
WriteHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
WritePointsMethod · 0.45
GetPointsMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetCellTypeMethod · 0.45
WriteCellDataMethod · 0.45
WritePointDataMethod · 0.45

Tested by

no test coverage detected