vtkPGenericIOMultiBlockReader.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 vtkPGenericIOMultiBlockReader_h
12 #define vtkPGenericIOMultiBlockReader_h
13 
15 #include "vtkPVVTKExtensionsCosmoToolsModule.h" // For export macro
16 
17 #include <set> // For std::set
18 
19 class vtkCallbackCommand;
22 class vtkStringArray;
23 class vtkIdList;
26 
27 // GenericIO forward declarations
28 namespace gio
29 {
30 class GenericIOReader;
31 }
32 
33 class VTKPVVTKEXTENSIONSCOSMOTOOLS_EXPORT vtkPGenericIOMultiBlockReader
35 {
36 public:
37  enum IOType
38  {
40  IOTYPEPOSIX
41  };
42 
44  {
46  RCB
47  };
48 
49  static vtkPGenericIOMultiBlockReader* New();
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
57  vtkSetStringMacro(XAxisVariableName);
58  vtkGetStringMacro(XAxisVariableName);
60 
62 
65  vtkSetStringMacro(YAxisVariableName);
66  vtkGetStringMacro(YAxisVariableName);
68 
70 
73  vtkSetStringMacro(ZAxisVariableName);
74  vtkGetStringMacro(ZAxisVariableName);
76 
78 
81  vtkSetStringMacro(FileName);
82  vtkGetStringMacro(FileName);
84 
86 
89  vtkSetMacro(GenericIOType, int);
90  vtkGetMacro(GenericIOType, int);
92 
94 
98  vtkSetMacro(BlockAssignment, int);
99  vtkGetMacro(BlockAssignment, int);
101 
103 
107  vtkGetObjectMacro(ArrayList, vtkStringArray);
109 
111 
115  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
117 
119 
123  vtkGetMacro(Controller, vtkMultiProcessController*);
124  vtkSetMacro(Controller, vtkMultiProcessController*);
126 
130  int GetNumberOfPointArrays();
131 
135  const char* GetPointArrayName(int i);
136 
140  int GetPointArrayStatus(const char* name);
141 
145  void SetPointArrayStatus(const char* name, int status);
146 
148 
153  vtkSetStringMacro(HaloIdVariableName);
154  vtkGetStringMacro(HaloIdVariableName);
156 
163  vtkIdType GetRequestedHaloId(vtkIdType i);
164 
171  vtkIdType GetNumberOfRequestedHaloIds();
172 
180  void SetNumberOfRequestedHaloIds(vtkIdType numIds);
181 
188  void AddRequestedHaloId(vtkIdType haloId);
189 
196  void ClearRequestedHaloIds();
197 
204  void SetRequestedHaloId(vtkIdType i, vtkIdType haloId);
205 
206 protected:
209 
214 
215  char* FileName;
218 
220 
222 
227 
228  gio::GenericIOReader* Reader;
229 
230  gio::GenericIOReader* GetInternalReader();
231 
232  bool ReaderParametersChanged();
233 
234  void LoadMetaData();
235 
236  void LoadRawVariableDataForBlock(const std::string& varName, int blockId);
237 
238  void LoadRawDataForBlock(int blockId);
239 
240  void GetPointFromRawData(int xType, void* xBuffer, int yType, void* yBuffer, int zType,
241  void* zBuffer, vtkIdType id, double point[3]);
242 
243  void LoadCoordinatesForBlock(
244  vtkUnstructuredGrid* grid, std::set<vtkIdType>& pointsInSelectedHalos, int blockId);
245 
246  void LoadDataArraysForBlock(
247  vtkUnstructuredGrid* grid, const std::set<vtkIdType>& pointsInSelectedHalos, int blockId);
248 
249  vtkUnstructuredGrid* LoadBlock(int blockId);
250 
254  static void SelectionModifiedCallback(
255  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
256 
257  // Pipeline methods
258  virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
259  virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
260 
261 private:
263  void operator=(const vtkPGenericIOMultiBlockReader&) = delete;
264  // Internal helper class
265  class vtkGenericIOMultiBlockMetaData;
266  vtkGenericIOMultiBlockMetaData* MetaData;
267 };
268 
269 #endif
int vtkIdType
Creates a vtkMultiBlockDataSet from a GenericIO file.