VTK  9.3.1
vtkAMRBaseReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
8 #ifndef vtkAMRBaseReader_h
9 #define vtkAMRBaseReader_h
10 
11 #include "vtkIOAMRModule.h" // For export macro
13 #include <map> // STL map header
14 #include <utility> // for STL pair
15 #include <vector> // STL vector header
16 
17 // Forward Declarations
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkOverlappingAMR;
22 class vtkCallbackCommand;
23 class vtkIndent;
24 class vtkAMRDataSetCache;
25 class vtkUniformGrid;
26 class vtkDataArray;
27 
28 class VTKIOAMR_EXPORT vtkAMRBaseReader : public vtkOverlappingAMRAlgorithm
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
38  void Initialize();
39 
41 
44  vtkSetMacro(EnableCaching, vtkTypeBool);
45  vtkGetMacro(EnableCaching, vtkTypeBool);
46  vtkBooleanMacro(EnableCaching, vtkTypeBool);
47  bool IsCachingEnabled() const { return ((this->EnableCaching) ? true : false); };
49 
51 
55  virtual void SetController(vtkMultiProcessController*);
56  vtkGetObjectMacro(Controller, vtkMultiProcessController);
58 
60 
63  vtkSetMacro(MaxLevel, int);
65 
67 
71  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
72  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
74 
76 
79  int GetNumberOfPointArrays();
80  int GetNumberOfCellArrays();
82 
84 
88  const char* GetPointArrayName(int index);
89  const char* GetCellArrayName(int index);
91 
93 
97  int GetPointArrayStatus(const char* name);
98  int GetCellArrayStatus(const char* name);
99  void SetPointArrayStatus(const char* name, int status);
100  void SetCellArrayStatus(const char* name, int status);
102 
104 
108  vtkGetFilePathMacro(FileName);
109  virtual void SetFileName(VTK_FILEPATH const char* fileName) = 0;
111 
115  virtual int GetNumberOfBlocks() = 0;
116 
120  virtual int GetNumberOfLevels() = 0;
121 
122 protected:
124  ~vtkAMRBaseReader() override;
125 
126  // Description:
127  // Checks if this reader instance is attached to a communicator
128  // with more than one MPI processes.
129  bool IsParallel();
130 
135  bool IsBlockMine(int blockIdx);
136 
142  vtkUniformGrid* GetAMRBlock(int blockIdx);
143 
148  void AssignAndLoadBlocks(vtkOverlappingAMR* amrds);
149 
156  void LoadRequestedBlocks(vtkOverlappingAMR* amrds);
157 
162  void GetAMRData(int blockIdx, vtkUniformGrid* block, const char* fieldName);
163 
167  void GetAMRPointData(int blockIdx, vtkUniformGrid* block, const char* fieldName);
168 
174  void LoadPointData(int blockIdx, vtkUniformGrid* block);
175 
182  void LoadCellData(int blockIdx, vtkUniformGrid* block);
183 
192  int GetBlockProcessId(int blockIdx);
193 
201  void SetupBlockRequest(vtkInformation* outputInfo);
202 
206  virtual void ReadMetaData() = 0;
207 
211  virtual int GetBlockLevel(int blockIdx) = 0;
212 
218  virtual int FillMetaData() = 0;
219 
223  virtual vtkUniformGrid* GetAMRGrid(int blockIdx) = 0;
224 
228  virtual void GetAMRGridData(int blockIdx, vtkUniformGrid* block, const char* field) = 0;
229 
233  virtual void GetAMRGridPointData(int blockIdx, vtkUniformGrid* block, const char* field) = 0;
234 
236 
239  int RequestData(vtkInformation* vtkNotUsed(request),
240  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) override;
241  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
242  vtkInformationVector* outputVector) override;
245 
246  // Array selection member variables and methods
250 
256  void InitializeArraySelections();
257 
261  virtual void SetUpDataArraySelections() = 0;
262 
266  static void SelectionModifiedCallback(
267  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
268 
270  int MaxLevel;
271  char* FileName;
273 
278 
281 
282  std::vector<int> BlockMap;
283 
284 private:
285  vtkAMRBaseReader(const vtkAMRBaseReader&) = delete;
286  void operator=(const vtkAMRBaseReader&) = delete;
287 };
288 
289 VTK_ABI_NAMESPACE_END
290 #endif /* vtkAMRBaseReader_h */
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
abstract base class for most VTK objects
Definition: vtkObject.h:51
Store vtkAlgorithm input/output information.
vtkCallbackCommand * SelectionObserver
vtkDataArraySelection * CellDataArraySelection
vtkMultiProcessController * Controller
bool IsCachingEnabled() const
Set/Get Reader caching property.
std::vector< int > BlockMap
vtkDataArraySelection * PointDataArraySelection
int vtkTypeBool
Definition: vtkABI.h:64
supports function callbacks
A concrete implementation of vtkObject that provides functionality for caching AMR blocks...
a simple class to control print indentation
Definition: vtkIndent.h:28
Store on/off settings for data arrays, etc.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
image data with blanking
#define VTK_FILEPATH
vtkOverlappingAMR * Metadata
vtkTypeBool EnableCaching
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
hierarchical dataset of vtkUniformGrids
Store zero or more vtkInformation instances.
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkAMRDataSetCache * Cache
An abstract class that encapsulates common functionality for all AMR readers.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Multiprocessing communication superclass.