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

Method ReadGraphType

IO/Legacy/vtkGraphReader.cxx:318–369  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

316
317//------------------------------------------------------------------------------
318int vtkGraphReader::ReadGraphType(const char* fname, GraphType& type)
319{
320 type = UnknownGraph;
321
322 if (!this->OpenVTKFile(fname) || !this->ReadHeader())
323 {
324 return 0;
325 }
326
327 // Read graph-specific stuff
328 char line[256];
329 if (!this->ReadString(line))
330 {
331 vtkErrorMacro(<< "Data file ends prematurely!");
332 this->CloseVTKFile();
333 return 0;
334 }
335
336 if (strncmp(this->LowerCase(line), "dataset", 7) != 0)
337 {
338 vtkErrorMacro(<< "Unrecognized keyword: " << line);
339 this->CloseVTKFile();
340 return 0;
341 }
342
343 if (!this->ReadString(line))
344 {
345 vtkErrorMacro(<< "Data file ends prematurely!");
346 this->CloseVTKFile();
347 return 0;
348 }
349
350 if (!strncmp(this->LowerCase(line), "directed_graph", 14))
351 {
352 type = DirectedGraph;
353 }
354 else if (!strncmp(this->LowerCase(line), "undirected_graph", 16))
355 {
356 type = UndirectedGraph;
357 }
358 else if (!strncmp(this->LowerCase(line), "molecule", 8))
359 {
360 type = Molecule;
361 }
362 else
363 {
364 vtkErrorMacro(<< "Cannot read type: " << line);
365 this->CloseVTKFile();
366 return 0;
367 }
368 return 1;
369}
370
371//------------------------------------------------------------------------------
372int vtkGraphReader::FillOutputPortInformation(int, vtkInformation* info)

Callers 2

ReadMeshSimpleMethod · 0.95
CreateOutputMethod · 0.95

Calls 5

ReadStringMethod · 0.80
OpenVTKFileMethod · 0.45
ReadHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
LowerCaseMethod · 0.45

Tested by

no test coverage detected