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

Method WriteData

IO/Legacy/vtkSimplePointsWriter.cxx:27–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void vtkSimplePointsWriter::WriteData()
28{
29 vtkPointSet* input = vtkPointSet::SafeDownCast(this->GetInput());
30 vtkIdType numberOfPoints = 0;
31
32 if (input)
33 {
34 numberOfPoints = input->GetNumberOfPoints();
35 }
36
37 // OpenVTKFile() will report any errors that happen
38 ostream* outfilep = this->OpenVTKFile();
39 if (!outfilep)
40 {
41 return;
42 }
43
44 ostream& outfile = *outfilep;
45
46 for (vtkIdType i = 0; i < numberOfPoints; i++)
47 {
48 double p[3];
49 input->GetPoint(i, p);
50 outfile << std::setprecision(this->DecimalPrecision) << p[0] << " " << p[1] << " " << p[2]
51 << std::endl;
52 }
53
54 // Close the file
55 this->CloseVTKFile(outfilep);
56
57 // Delete the file if an error occurred
58 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
59 {
60 vtkErrorMacro("Ran out of disk space; deleting file: " << this->FileName);
61 unlink(this->FileName);
62 }
63}
64
65void vtkSimplePointsWriter::PrintSelf(ostream& os, vtkIndent indent)
66{

Callers

nothing calls this directly

Calls 5

GetInputMethod · 0.45
GetNumberOfPointsMethod · 0.45
OpenVTKFileMethod · 0.45
GetPointMethod · 0.45
CloseVTKFileMethod · 0.45

Tested by

no test coverage detected