vtkPGenericIOReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkPGenericIOReader_h
12 #define vtkPGenericIOReader_h
13 
14 // VTK includes
15 #include "vtkPVVTKExtensionsCosmoToolsModule.h" // For export macro
17 
18 #include <set> // for std::set in protected methods
19 
20 // Forward Declarations
21 class vtkCallbackCommand;
22 class vtkDataArray;
24 class vtkGenericIOMetaData;
25 class vtkIdList;
26 class vtkInformation;
29 class vtkStringArray;
31 
32 // GenericIO Forward Declarations
33 namespace gio
34 {
35 class GenericIOReader;
36 }
37 
38 class VTKPVVTKEXTENSIONSCOSMOTOOLS_EXPORT vtkPGenericIOReader : public vtkUnstructuredGridAlgorithm
39 {
40 public:
41  enum IOType
42  {
44  IOTYPEPOSIX
45  };
46 
48  {
50  RCB
51  };
52 
53  static vtkPGenericIOReader* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
61  vtkSetStringMacro(FileName);
62  vtkGetStringMacro(FileName);
64 
66 
69  vtkSetStringMacro(XAxisVariableName);
70  vtkGetStringMacro(XAxisVariableName);
72 
74 
77  vtkSetStringMacro(YAxisVariableName);
78  vtkGetStringMacro(YAxisVariableName);
80 
82 
85  vtkSetStringMacro(ZAxisVariableName);
86  vtkGetStringMacro(ZAxisVariableName);
88 
90 
93  vtkSetMacro(GenericIOType, int);
94  vtkGetMacro(GenericIOType, int);
96 
98 
102  vtkSetMacro(BlockAssignment, int);
103  vtkGetMacro(BlockAssignment, int);
105 
107 
112  vtkSetMacro(RankInQuery, int);
113  vtkGetMacro(RankInQuery, int);
115 
117 
121  vtkSetMacro(QueryRankNeighbors, int);
122  vtkGetMacro(QueryRankNeighbors, int);
124 
126 
130  vtkSetMacro(AppendBlockCoordinates, bool);
131  vtkBooleanMacro(AppendBlockCoordinates, bool);
132  vtkGetMacro(AppendBlockCoordinates, bool);
134 
136 
140  vtkGetObjectMacro(ArrayList, vtkStringArray);
142 
144 
148  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
150 
152 
156  vtkSetMacro(Controller, vtkMultiProcessController*);
157  vtkGetMacro(Controller, vtkMultiProcessController*);
159 
163  int GetNumberOfPointArrays();
164 
168  const char* GetPointArrayName(int i);
169 
173  int GetPointArrayStatus(const char* name);
174 
179  void SetPointArrayStatus(const char* name, int status);
180 
182 
187  vtkSetStringMacro(HaloIdVariableName);
188  vtkGetStringMacro(HaloIdVariableName);
190 
197  vtkIdType GetRequestedHaloId(vtkIdType i);
198 
205  vtkIdType GetNumberOfRequestedHaloIds();
206 
214  void SetNumberOfRequestedHaloIds(vtkIdType numIds);
215 
222  void AddRequestedHaloId(vtkIdType haloId);
223 
230  void ClearRequestedHaloIds();
231 
238  void SetRequestedHaloId(vtkIdType i, vtkIdType haloId);
239 
240 protected:
242  virtual ~vtkPGenericIOReader();
243 
244  // Pipeline methods
245  int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
246  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
247 
251  void LoadMetaData();
252 
258  bool ReaderParametersChanged();
259 
263  gio::GenericIOReader* GetInternalReader();
264 
268  void GetPointFromRawData(int xType, void* xBuffer, int yType, void* yBuffer, int zType,
269  void* zBuffer, vtkIdType idx, double pnt[3]);
270 
274  void LoadRawVariableData(std::string varName);
275 
279  void LoadRawData();
280 
284  void LoadCoordinates(vtkUnstructuredGrid* grid, std::set<vtkIdType>& pointsInSelectedHalos);
285 
289  void LoadData(vtkUnstructuredGrid* grid, const std::set<vtkIdType>& pointsInSelectedHalos);
290 
294  void FindRankNeighbors();
295 
299  static void SelectionModifiedCallback(
300  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
301 
306 
307  char* FileName;
310 
313 
316 
318 
323 
324  gio::GenericIOReader* Reader;
325  vtkGenericIOMetaData* MetaData;
326 
329 
330 private:
331  vtkPGenericIOReader(const vtkPGenericIOReader&) = delete;
332  void operator=(const vtkPGenericIOReader&) = delete;
333 };
334 
335 #endif /* vtkPGenericIOReader_h */
gio::GenericIOReader * Reader
vtkMultiProcessController * Controller
vtkCallbackCommand * SelectionObserver
int vtkIdType
vtkGenericIOMetaData * MetaData
vtkStringArray * ArrayList
vtkDataArraySelection * PointDataArraySelection
Creates a vtkUnstructuredGrid instance from a GenericIO file.