VTK  9.2.6
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
36#ifndef vtkChacoReader_h
37#define vtkChacoReader_h
38
39#include "vtkIOGeometryModule.h" // For export macro
41
42class VTKIOGEOMETRY_EXPORT vtkChacoReader : public vtkUnstructuredGridAlgorithm
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
54 vtkSetStringMacro(BaseName);
55 vtkGetStringMacro(BaseName);
56
64 vtkSetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
65 vtkGetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
66 vtkBooleanMacro(GenerateGlobalElementIdArray, vtkTypeBool);
67
68 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
69
78 vtkSetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
79 vtkGetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
80 vtkBooleanMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
81
82 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
83
90 vtkSetMacro(GenerateVertexWeightArrays, vtkTypeBool);
91 vtkGetMacro(GenerateVertexWeightArrays, vtkTypeBool);
92 vtkBooleanMacro(GenerateVertexWeightArrays, vtkTypeBool);
93
99 vtkGetMacro(NumberOfVertexWeights, int);
100
109 const char* GetVertexWeightArrayName(int weight);
110
120 vtkSetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
121 vtkGetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
122 vtkBooleanMacro(GenerateEdgeWeightArrays, vtkTypeBool);
123
129 vtkGetMacro(NumberOfEdgeWeights, int);
130
139 const char* GetEdgeWeightArrayName(int weight);
140
142
145 vtkGetMacro(Dimensionality, int);
146 vtkGetMacro(NumberOfEdges, vtkIdType);
147 vtkGetMacro(NumberOfVertices, vtkIdType);
149
156 vtkGetMacro(NumberOfCellWeightArrays, int);
157
164 vtkGetMacro(NumberOfPointWeightArrays, int);
165
166protected:
168 ~vtkChacoReader() override;
169
171
172 // methods for parsing Chaco files
173
176
177 int InputGeom(vtkIdType nvtxs, int igeom, double* x, double* y, double* z);
179 int InputGraph2(vtkIdType** start, vtkIdType** adjacency, double** vweights, double** eweights);
182
183 // methods for creating vtkUnstructuredGrid from Chaco file data
184
188
189 void MakeWeightArrayNames(int nv, int ne);
190
191 // Parameters for controlling what is read in.
192 char* BaseName;
195
198
202 vtkSetStringMacro(CurrentBaseName);
203
206
207 //----------------------------------------------------------------------
208 // The following metadata is read during RequestInformation. If you
209 // add new metadata, you must modify vtkPChacoReader::RequestInformation
210 // to include it when process 0 broadcasts the metadata.
211
215 int NumberOfVertexWeights; // in file
216 int NumberOfEdgeWeights; // in file
218
219 //----------------------------------------------------------------------
220
221 int NumberOfPointWeightArrays; // in output unstructured grid
222 int NumberOfCellWeightArrays; // in output unstructured grid
223
224 // Keep the points and cells
225 // around so they don't need to be re-read when the
226 // options change.
228
229 // Should I re-read in the geometry and topology of the dataset
231
234
235private:
236 vtkChacoReader(const vtkChacoReader&) = delete;
237 void operator=(const vtkChacoReader&) = delete;
238
239 double ReadVal(FILE* infile, int* end_flag);
240 vtkIdType ReadInt(FILE* infile, int* end_flag);
241 void FlushLine(FILE* infile);
242 void ResetInputBuffers();
243
244 char Line[200];
245 const int Line_length = 200;
246 int Offset;
247 int Break_pnt;
248 int Save_pnt;
249
250 void ClearWeightArrayNames();
251};
252
253#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()
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 GetCoordsMetadata()
void AddElementIds(vtkUnstructuredGrid *output)
void CloseCurrentFile()
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()
vtkIdType NumberOfEdges
void AddNodeIds(vtkUnstructuredGrid *output)
a simple class to control print indentation
Definition vtkIndent.h:40
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
int vtkTypeBool
Definition vtkABI.h:69
int vtkIdType
Definition vtkType.h:332