VTK  9.3.1
vtkDIMACSGraphReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
44 #ifndef vtkDIMACSGraphReader_h
45 #define vtkDIMACSGraphReader_h
46 
47 #include "vtkGraphAlgorithm.h"
48 #include "vtkIOInfovisModule.h" // For export macro
49 #include "vtkStdString.h" // For string API
50 
51 VTK_ABI_NAMESPACE_BEGIN
52 class VTKIOINFOVIS_EXPORT vtkDIMACSGraphReader : public vtkGraphAlgorithm
53 {
54 
55 public:
56  static vtkDIMACSGraphReader* New();
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
64  vtkGetFilePathMacro(FileName);
65  vtkSetFilePathMacro(FileName);
67 
69 
72  vtkGetStringMacro(VertexAttributeArrayName);
73  vtkSetStringMacro(VertexAttributeArrayName);
75 
77 
80  vtkGetStringMacro(EdgeAttributeArrayName);
81  vtkSetStringMacro(EdgeAttributeArrayName);
83 
84 protected:
86  ~vtkDIMACSGraphReader() override;
87 
89 
90  int buildGenericGraph(vtkGraph* output, vtkStdString& defaultVertexAttrArrayName,
91  vtkStdString& defaultEdgeAttrArrayName);
92 
93  int buildColoringGraph(vtkGraph* output);
94  int buildMaxflowGraph(vtkGraph* output);
95 
100  vtkInformationVector* outputVector) override;
101 
102  int ReadGraphMetaData();
103 
104 private:
105  bool fileOk;
106  bool Directed;
107  char* FileName;
108  char* VertexAttributeArrayName;
109  char* EdgeAttributeArrayName;
110 
111  int numVerts;
112  int numEdges;
113  std::string dimacsProblemStr;
114 
116  void operator=(const vtkDIMACSGraphReader&) = delete;
117 };
118 
119 VTK_ABI_NAMESPACE_END
120 #endif // vtkDIMACSGraphReader_h
static vtkGraphAlgorithm * New()
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only graph as output.
Base class for graph data types.
Definition: vtkGraph.h:280
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Store zero or more vtkInformation instances.
reads vtkGraph data from a DIMACS formatted file