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

Method ReadMeshSimple

IO/Infovis/vtkNewickTreeReader.cxx:140–188  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

138
139//------------------------------------------------------------------------------
140int vtkNewickTreeReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput)
141{
142 vtkDebugMacro(<< "Reading Newick tree ...");
143
144 if (!this->ReadFromInputString)
145 {
146 if (fname.empty())
147 {
148 vtkErrorMacro("FileName not set.");
149 return 1;
150 }
151
152 vtksys::ifstream ifs(fname.c_str(), vtksys::ifstream::in);
153 if (!ifs.good())
154 {
155 vtkErrorMacro(<< "Unable to open " << fname << " for reading");
156 return 1;
157 }
158
159 // Read the input file into a char *
160 ifs.seekg(0, std::ios::end);
161 this->InputStringLength = ifs.tellg();
162 ifs.seekg(0, std::ios::beg);
163 this->InputString = new char[this->InputStringLength];
164 ifs.read(this->InputString, this->InputStringLength);
165 ifs.close();
166 }
167 else
168 {
169 if ((!this->InputString) || (this->InputStringLength == 0))
170 {
171 vtkErrorMacro(<< "Input string is empty!");
172 return 1;
173 }
174 }
175
176 vtkTree* const output = vtkTree::SafeDownCast(doOutput);
177
178 if (!ReadNewickTree(this->InputString, *output))
179 {
180 vtkErrorMacro(<< "Error reading a vtkTree from the input.");
181 return 1;
182 }
183
184 vtkDebugMacro(<< "Read " << output->GetNumberOfVertices() << " vertices and "
185 << output->GetNumberOfEdges() << " edges.\n");
186
187 return 1;
188}
189
190//------------------------------------------------------------------------------
191void vtkNewickTreeReader::CountNodes(const char* buffer, vtkIdType* numNodes)

Callers

nothing calls this directly

Calls 7

GetNumberOfVerticesMethod · 0.80
emptyMethod · 0.45
c_strMethod · 0.45
goodMethod · 0.45
readMethod · 0.45
closeMethod · 0.45
GetNumberOfEdgesMethod · 0.45

Tested by

no test coverage detected