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

Method WriteData

IO/Legacy/vtkStructuredGridWriter.cxx:19–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17vtkStandardNewMacro(vtkStructuredGridWriter);
18
19void 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);

Callers

nothing calls this directly

Calls 11

GetInputMethod · 0.95
WriteDataSetDataMethod · 0.80
OpenVTKFileMethod · 0.45
WriteHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
GetExtentMethod · 0.45
GetDimensionsMethod · 0.45
WritePointsMethod · 0.45
GetPointsMethod · 0.45
WriteCellDataMethod · 0.45
WritePointDataMethod · 0.45

Tested by

no test coverage detected