VTK
vtkChacoReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkChacoReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
35 #ifndef vtkChacoReader_h
36 #define vtkChacoReader_h
37 
38 #include "vtkIOGeometryModule.h" // For export macro
40 
42 {
43 public:
44  static vtkChacoReader *New();
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
51  vtkSetStringMacro(BaseName);
52  vtkGetStringMacro(BaseName);
53 
59  vtkSetMacro(GenerateGlobalElementIdArray, int);
60  vtkGetMacro(GenerateGlobalElementIdArray, int);
61  vtkBooleanMacro(GenerateGlobalElementIdArray, int);
62 
63  static const char *GetGlobalElementIdArrayName() { return "GlobalElementId"; }
64 
71  vtkSetMacro(GenerateGlobalNodeIdArray, int);
72  vtkGetMacro(GenerateGlobalNodeIdArray, int);
73  vtkBooleanMacro(GenerateGlobalNodeIdArray, int);
74 
75  static const char *GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
76 
80  vtkSetMacro(GenerateVertexWeightArrays, int);
81  vtkGetMacro(GenerateVertexWeightArrays, int);
82  vtkBooleanMacro(GenerateVertexWeightArrays, int);
83 
87  vtkGetMacro(NumberOfVertexWeights, int);
88 
95  const char *GetVertexWeightArrayName(int weight);
96 
103  vtkSetMacro(GenerateEdgeWeightArrays, int);
104  vtkGetMacro(GenerateEdgeWeightArrays, int);
105  vtkBooleanMacro(GenerateEdgeWeightArrays, int);
106 
110  vtkGetMacro(NumberOfEdgeWeights, int);
111 
118  const char *GetEdgeWeightArrayName(int weight);
119 
121 
122  vtkGetMacro(Dimensionality, int);
123  vtkGetMacro(NumberOfEdges, vtkIdType);
124  vtkGetMacro(NumberOfVertices, vtkIdType);
126 
131  vtkGetMacro(NumberOfCellWeightArrays, int);
132 
137  vtkGetMacro(NumberOfPointWeightArrays, int);
138 
139 protected:
140  vtkChacoReader();
141  ~vtkChacoReader();
142 
143  int BuildOutputGrid(vtkUnstructuredGrid *gr);
144 
145  // methods for parsing Chaco files
146 
147  void CloseCurrentFile();
148  int OpenCurrentFile();
149 
150  int InputGeom(vtkIdType nvtxs, int igeom, double *x, double *y, double *z);
151  int InputGraph1();
152  int InputGraph2( vtkIdType **start, vtkIdType **adjacency, double **vweights,
153  double **eweights);
154  int GetCoordsMetadata();
155  void GetGraphMetadata();
156 
157  // methods for creating vtkUnstructuredGrid from Chaco file data
158 
159  int ReadFile(vtkUnstructuredGrid* output);
160  void AddElementIds(vtkUnstructuredGrid* output);
161  void AddNodeIds(vtkUnstructuredGrid* output);
162 
163  void MakeWeightArrayNames(int nv, int ne);
164 
165  // Parameters for controlling what is read in.
166  char *BaseName;
169 
172 
176  vtkSetStringMacro(CurrentBaseName);
177 
178  char **VarrayName;
179  char **EarrayName;
180 
181  //----------------------------------------------------------------------
182  // The following metadata is read during RequestInformation. If you
183  // add new metadata, you must modify vtkPChacoReader::RequestInformation
184  // to include it when process 0 broadcasts the metadata.
185 
189  int NumberOfVertexWeights; // in file
190  int NumberOfEdgeWeights; // in file
192 
193  //----------------------------------------------------------------------
194 
195  int NumberOfPointWeightArrays; // in output unstuctured grid
196  int NumberOfCellWeightArrays; // in output unstuctured grid
197 
198  // Keep the points and cells
199  // around so they don't need to be re-read when the
200  // options change.
202 
203  // Should I re-read in the geometry and topology of the dataset
205 
206  int RequestInformation(
208  int RequestData(
210 
211 private:
212  vtkChacoReader(const vtkChacoReader&); // Not implemented
213  void operator=(const vtkChacoReader&); // Not implemented
214 
215  double ReadVal(FILE *infile, int *end_flag);
216  vtkIdType ReadInt(FILE *infile, int *end_flag);
217  void FlushLine( FILE *infile);
218  void ResetInputBuffers();
219 
220  char *Line;
221  int Line_length;
222  int Offset;
223  int Break_pnt;
224  int Save_pnt;
225 
226  void ClearWeightArrayNames();
227 };
228 
229 #endif
int GenerateGlobalNodeIdArray
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int GraphFileHasVertexNumbers
Store vtkAlgorithm input/output information.
char * CurrentBaseName
static vtkUnstructuredGridAlgorithm * New()
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int vtkIdType
Definition: vtkType.h:247
#define VTKIOGEOMETRY_EXPORT
int GenerateEdgeWeightArrays
a simple class to control print indentation
Definition: vtkIndent.h:38
dataset represents arbitrary combinations of all possible cell types
void PrintSelf(ostream &os, vtkIndent indent)
Superclass for algorithms that produce only unstructured grid as output.
FILE * CurrentGeometryFP
Read a Chaco file and create a vtkUnstructuredGrid.
int NumberOfPointWeightArrays
int NumberOfCellWeightArrays
vtkIdType NumberOfVertices
int GenerateVertexWeightArrays
static const char * GetGlobalNodeIdArrayName()
Store zero or more vtkInformation instances.
static const char * GetGlobalElementIdArrayName()
vtkIdType NumberOfEdges
int GenerateGlobalElementIdArray
vtkUnstructuredGrid * DataCache