VTK  9.1.0
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
33#ifndef vtkChacoReader_h
34#define vtkChacoReader_h
35
36#include "vtkIOGeometryModule.h" // For export macro
38
39class VTKIOGEOMETRY_EXPORT vtkChacoReader : public vtkUnstructuredGridAlgorithm
40{
41public:
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
51 vtkSetStringMacro(BaseName);
52 vtkGetStringMacro(BaseName);
53
61 vtkSetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
62 vtkGetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
63 vtkBooleanMacro(GenerateGlobalElementIdArray, vtkTypeBool);
64
65 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
66
75 vtkSetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
76 vtkGetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
77 vtkBooleanMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
78
79 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
80
87 vtkSetMacro(GenerateVertexWeightArrays, vtkTypeBool);
88 vtkGetMacro(GenerateVertexWeightArrays, vtkTypeBool);
89 vtkBooleanMacro(GenerateVertexWeightArrays, vtkTypeBool);
90
96 vtkGetMacro(NumberOfVertexWeights, int);
97
107
117 vtkSetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
118 vtkGetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
119 vtkBooleanMacro(GenerateEdgeWeightArrays, vtkTypeBool);
120
126 vtkGetMacro(NumberOfEdgeWeights, int);
127
137
139
142 vtkGetMacro(Dimensionality, int);
143 vtkGetMacro(NumberOfEdges, vtkIdType);
144 vtkGetMacro(NumberOfVertices, vtkIdType);
146
153 vtkGetMacro(NumberOfCellWeightArrays, int);
154
161 vtkGetMacro(NumberOfPointWeightArrays, int);
162
163protected:
165 ~vtkChacoReader() override;
166
168
169 // methods for parsing Chaco files
170
173
174 int InputGeom(vtkIdType nvtxs, int igeom, double* x, double* y, double* z);
176 int InputGraph2(vtkIdType** start, vtkIdType** adjacency, double** vweights, double** eweights);
179
180 // methods for creating vtkUnstructuredGrid from Chaco file data
181
185
186 void MakeWeightArrayNames(int nv, int ne);
187
188 // Parameters for controlling what is read in.
189 char* BaseName;
192
195
199 vtkSetStringMacro(CurrentBaseName);
200
203
204 //----------------------------------------------------------------------
205 // The following metadata is read during RequestInformation. If you
206 // add new metadata, you must modify vtkPChacoReader::RequestInformation
207 // to include it when process 0 broadcasts the metadata.
208
212 int NumberOfVertexWeights; // in file
213 int NumberOfEdgeWeights; // in file
215
216 //----------------------------------------------------------------------
217
218 int NumberOfPointWeightArrays; // in output unstructured grid
219 int NumberOfCellWeightArrays; // in output unstructured grid
220
221 // Keep the points and cells
222 // around so they don't need to be re-read when the
223 // options change.
225
226 // Should I re-read in the geometry and topology of the dataset
228
231
232private:
233 vtkChacoReader(const vtkChacoReader&) = delete;
234 void operator=(const vtkChacoReader&) = delete;
235
236 double ReadVal(FILE* infile, int* end_flag);
237 vtkIdType ReadInt(FILE* infile, int* end_flag);
238 void FlushLine(FILE* infile);
239 void ResetInputBuffers();
240
241 char Line[200];
242 const int Line_length = 200;
243 int Offset;
244 int Break_pnt;
245 int Save_pnt;
246
247 void ClearWeightArrayNames();
248};
249
250#endif
Read a Chaco file and create a vtkUnstructuredGrid.
~vtkChacoReader() override
int ReadFile(vtkUnstructuredGrid *output)
const char * GetVertexWeightArrayName(int weight)
This method returns the name of the selected Vertex weight point array.
vtkTypeBool GenerateVertexWeightArrays
const char * GetEdgeWeightArrayName(int weight)
This method returns the name of the selected Edge weight cell array.
static const char * GetGlobalNodeIdArrayName()
int NumberOfCellWeightArrays
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void MakeWeightArrayNames(int nv, int ne)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int InputGeom(vtkIdType nvtxs, int igeom, double *x, double *y, double *z)
int BuildOutputGrid(vtkUnstructuredGrid *gr)
int OpenCurrentFile()
int NumberOfPointWeightArrays
int GetCoordsMetadata()
void AddElementIds(vtkUnstructuredGrid *output)
void CloseCurrentFile()
int GraphFileHasVertexNumbers
vtkUnstructuredGrid * DataCache
int InputGraph2(vtkIdType **start, vtkIdType **adjacency, double **vweights, double **eweights)
vtkTypeBool GenerateGlobalNodeIdArray
vtkTypeBool GenerateGlobalElementIdArray
vtkIdType NumberOfVertices
static vtkChacoReader * New()
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkTypeBool GenerateEdgeWeightArrays
void GetGraphMetadata()
static const char * GetGlobalElementIdArrayName()
char * CurrentBaseName
FILE * CurrentGeometryFP
vtkIdType NumberOfEdges
void AddNodeIds(vtkUnstructuredGrid *output)
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only unstructured grid as output.
dataset represents arbitrary combinations of all possible cell types
@ weight
Definition: vtkX3D.h:538
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332