File: TestDIMACSGraphReader.cxx

package info (click to toggle)
vtk6 6.3.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 118,532 kB
  • ctags: 138,251
  • sloc: cpp: 1,443,749; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,127; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 471; makefile: 95; objc: 17
file content (57 lines) | stat: -rw-r--r-- 1,745 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "vtkDIMACSGraphReader.h"
#include "vtkGraph.h"
#include "vtkSmartPointer.h"
#include "vtkTestUtilities.h"

#define VTK_CREATE(type,name) \
  vtkSmartPointer<type> name = vtkSmartPointer<type>::New()

int TestDIMACSGraphReader(int argc, char* argv[])
{
  VTK_CREATE(vtkDIMACSGraphReader, src_pattern);
  VTK_CREATE(vtkDIMACSGraphReader, src_target);
  VTK_CREATE(vtkDIMACSGraphReader, src_flow);

  char* file_pattern = vtkTestUtilities::ExpandDataFileName(argc, argv,
                           "Data/Infovis/DimacsGraphs/iso_pattern.gr");
  char* file_target = vtkTestUtilities::ExpandDataFileName(argc, argv,
                           "Data/Infovis/DimacsGraphs/iso_target.gr");
  char* file_flow = vtkTestUtilities::ExpandDataFileName(argc, argv,
                           "Data/Infovis/DimacsGraphs/maxflow.max");

  src_pattern->SetFileName(file_pattern);
  src_target->SetFileName(file_target);
  src_flow->SetFileName(file_flow);

  delete[] file_pattern;
  delete[] file_target;
  delete[] file_flow;

  src_pattern->GetFileName();
  src_target->GetFileName();
  src_flow->GetFileName();

  src_pattern->Update();
  src_target->Update();
  src_flow->Update();

  // Do a quick check on the data, the pattern graph should have
  // 5 edges and 5 vertices
  vtkGraph * G = vtkGraph::SafeDownCast( src_pattern->GetOutput() );
  if(G->GetNumberOfVertices() != 5)
    {
    cout << "\tERROR: iso_pattern.gr vertex count wrong. "
         << "Expected 5, Got " << G->GetNumberOfVertices()
         << endl;
    return 1;
    }
  if(G->GetNumberOfEdges() != 5)
    {
    cout << "\tERROR: iso_pattern.gr edge count wrong. "
         << "Expected 5, Got " << G->GetNumberOfEdges()
         << endl;
    return 1;
    }

  return 0;
}