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

Method ReadMeshSimple

IO/Legacy/vtkTreeReader.cxx:48–199  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

46
47//------------------------------------------------------------------------------
48int vtkTreeReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput)
49{
50 vtkDebugMacro(<< "Reading vtk tree ...");
51
52 if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader())
53 {
54 return 1;
55 }
56
57 // Read table-specific stuff
58 char line[256];
59 if (!this->ReadString(line))
60 {
61 vtkErrorMacro(<< "Data file ends prematurely!");
62 this->CloseVTKFile();
63 return 1;
64 }
65
66 if (strncmp(this->LowerCase(line), "dataset", 7) != 0)
67 {
68 vtkErrorMacro(<< "Unrecognized keyword: " << line);
69 this->CloseVTKFile();
70 return 1;
71 }
72
73 if (!this->ReadString(line))
74 {
75 vtkErrorMacro(<< "Data file ends prematurely!");
76 this->CloseVTKFile();
77 return 1;
78 }
79
80 if (strncmp(this->LowerCase(line), "tree", 4) != 0)
81 {
82 vtkErrorMacro(<< "Cannot read dataset type: " << line);
83 this->CloseVTKFile();
84 return 1;
85 }
86
87 vtkTree* const output = vtkTree::SafeDownCast(doOutput);
88
89 vtkSmartPointer<vtkMutableDirectedGraph> builder =
90 vtkSmartPointer<vtkMutableDirectedGraph>::New();
91
92 while (true)
93 {
94 if (!this->ReadString(line))
95 {
96 break;
97 }
98
99 if (!strncmp(this->LowerCase(line), "field", 5))
100 {
101 vtkFieldData* const field_data = this->ReadFieldData();
102 builder->SetFieldData(field_data);
103 field_data->Delete();
104 continue;
105 }

Callers 2

ReadMeshMethod · 0.45
ReadMeshMethod · 0.45

Calls 15

ReadStringMethod · 0.80
ReadPointCoordinatesMethod · 0.80
ReadVertexDataMethod · 0.80
ReadEdgeDataMethod · 0.80
GetNumberOfVerticesMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
OpenVTKFileMethod · 0.45
c_strMethod · 0.45
ReadHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
LowerCaseMethod · 0.45

Tested by

no test coverage detected