VTK  9.3.20240421
vtkChacoReader.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
21#ifndef vtkChacoReader_h
22#define vtkChacoReader_h
23
24#include "vtkIOGeometryModule.h" // For export macro
26
27VTK_ABI_NAMESPACE_BEGIN
28class VTKIOGEOMETRY_EXPORT vtkChacoReader : public vtkUnstructuredGridAlgorithm
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
40 vtkSetStringMacro(BaseName);
41 vtkGetStringMacro(BaseName);
42
50 vtkSetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
51 vtkGetMacro(GenerateGlobalElementIdArray, vtkTypeBool);
52 vtkBooleanMacro(GenerateGlobalElementIdArray, vtkTypeBool);
53
54 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
55
64 vtkSetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
65 vtkGetMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
66 vtkBooleanMacro(GenerateGlobalNodeIdArray, vtkTypeBool);
67
68 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
69
76 vtkSetMacro(GenerateVertexWeightArrays, vtkTypeBool);
77 vtkGetMacro(GenerateVertexWeightArrays, vtkTypeBool);
78 vtkBooleanMacro(GenerateVertexWeightArrays, vtkTypeBool);
79
85 vtkGetMacro(NumberOfVertexWeights, int);
86
95 const char* GetVertexWeightArrayName(int weight);
96
106 vtkSetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
107 vtkGetMacro(GenerateEdgeWeightArrays, vtkTypeBool);
108 vtkBooleanMacro(GenerateEdgeWeightArrays, vtkTypeBool);
109
115 vtkGetMacro(NumberOfEdgeWeights, int);
116
125 const char* GetEdgeWeightArrayName(int weight);
126
128
131 vtkGetMacro(Dimensionality, int);
132 vtkGetMacro(NumberOfEdges, vtkIdType);
133 vtkGetMacro(NumberOfVertices, vtkIdType);
135
142 vtkGetMacro(NumberOfCellWeightArrays, int);
143
150 vtkGetMacro(NumberOfPointWeightArrays, int);
151
152protected:
154 ~vtkChacoReader() override;
155
157
158 // methods for parsing Chaco files
159
162
163 int InputGeom(vtkIdType nvtxs, int igeom, double* x, double* y, double* z);
165 int InputGraph2(vtkIdType** start, vtkIdType** adjacency, double** vweights, double** eweights);
168
169 // methods for creating vtkUnstructuredGrid from Chaco file data
170
174
175 void MakeWeightArrayNames(int nv, int ne);
176
177 // Parameters for controlling what is read in.
178 char* BaseName;
181
184
188 vtkSetStringMacro(CurrentBaseName);
189
192
193 //----------------------------------------------------------------------
194 // The following metadata is read during RequestInformation. If you
195 // add new metadata, you must modify vtkPChacoReader::RequestInformation
196 // to include it when process 0 broadcasts the metadata.
197
201 int NumberOfVertexWeights; // in file
202 int NumberOfEdgeWeights; // in file
204
205 //----------------------------------------------------------------------
206
207 int NumberOfPointWeightArrays; // in output unstructured grid
208 int NumberOfCellWeightArrays; // in output unstructured grid
209
210 // Keep the points and cells
211 // around so they don't need to be re-read when the
212 // options change.
214
215 // Should I re-read in the geometry and topology of the dataset
217
220
221private:
222 vtkChacoReader(const vtkChacoReader&) = delete;
223 void operator=(const vtkChacoReader&) = delete;
224
225 double ReadVal(FILE* infile, int* end_flag);
226 vtkIdType ReadInt(FILE* infile, int* end_flag);
227 void FlushLine(FILE* infile);
228 void ResetInputBuffers();
229
230 char Line[200];
231 const int Line_length = 200;
232 int Offset;
233 int Break_pnt;
234 int Save_pnt;
235
236 void ClearWeightArrayNames();
237};
238
239VTK_ABI_NAMESPACE_END
240#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:108
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:64
int vtkIdType
Definition vtkType.h:315