VTK  9.2.6
vtkAMRBaseReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMRBaseReader.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  =========================================================================*/
20 #ifndef vtkAMRBaseReader_h
21 #define vtkAMRBaseReader_h
22 
23 #include "vtkIOAMRModule.h" // For export macro
25 #include <map> // STL map header
26 #include <utility> // for STL pair
27 #include <vector> // STL vector header
28 
29 // Forward Declarations
30 class vtkOverlappingAMR;
33 class vtkCallbackCommand;
34 class vtkIndent;
35 class vtkAMRDataSetCache;
36 class vtkUniformGrid;
37 class vtkDataArray;
38 
39 class VTKIOAMR_EXPORT vtkAMRBaseReader : public vtkOverlappingAMRAlgorithm
40 {
41 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
49  void Initialize();
50 
52 
55  vtkSetMacro(EnableCaching, vtkTypeBool);
56  vtkGetMacro(EnableCaching, vtkTypeBool);
57  vtkBooleanMacro(EnableCaching, vtkTypeBool);
58  bool IsCachingEnabled() const { return ((this->EnableCaching) ? true : false); };
60 
62 
66  virtual void SetController(vtkMultiProcessController*);
67  vtkGetObjectMacro(Controller, vtkMultiProcessController);
69 
71 
74  vtkSetMacro(MaxLevel, int);
76 
78 
82  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
83  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
85 
87 
90  int GetNumberOfPointArrays();
91  int GetNumberOfCellArrays();
93 
95 
99  const char* GetPointArrayName(int index);
100  const char* GetCellArrayName(int index);
102 
104 
108  int GetPointArrayStatus(const char* name);
109  int GetCellArrayStatus(const char* name);
110  void SetPointArrayStatus(const char* name, int status);
111  void SetCellArrayStatus(const char* name, int status);
113 
115 
119  vtkGetFilePathMacro(FileName);
120  virtual void SetFileName(VTK_FILEPATH const char* fileName) = 0;
122 
126  virtual int GetNumberOfBlocks() = 0;
127 
131  virtual int GetNumberOfLevels() = 0;
132 
133 protected:
135  ~vtkAMRBaseReader() override;
136 
137  // Desscription:
138  // Checks if this reader instance is attached to a communicator
139  // with more than one MPI processes.
140  bool IsParallel();
141 
146  bool IsBlockMine(const int blockIdx);
147 
153  vtkUniformGrid* GetAMRBlock(const int blockIdx);
154 
159  void AssignAndLoadBlocks(vtkOverlappingAMR* amrds);
160 
167  void LoadRequestedBlocks(vtkOverlappingAMR* amrds);
168 
173  void GetAMRData(const int blockIdx, vtkUniformGrid* block, const char* fieldName);
174 
178  void GetAMRPointData(const int blockIdx, vtkUniformGrid* block, const char* fieldName);
179 
185  void LoadPointData(const int blockIdx, vtkUniformGrid* block);
186 
193  void LoadCellData(const int blockIdx, vtkUniformGrid* block);
194 
203  int GetBlockProcessId(const int blockIdx);
204 
212  void SetupBlockRequest(vtkInformation* outputInfo);
213 
217  virtual void ReadMetaData() = 0;
218 
222  virtual int GetBlockLevel(const int blockIdx) = 0;
223 
229  virtual int FillMetaData() = 0;
230 
234  virtual vtkUniformGrid* GetAMRGrid(const int blockIdx) = 0;
235 
239  virtual void GetAMRGridData(const int blockIdx, vtkUniformGrid* block, const char* field) = 0;
240 
244  virtual void GetAMRGridPointData(
245  const int blockIdx, vtkUniformGrid* block, const char* field) = 0;
246 
248 
251  int RequestData(vtkInformation* vtkNotUsed(request),
252  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) override;
253  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
254  vtkInformationVector* outputVector) override;
257 
258  // Array selection member variables and methods
262 
268  void InitializeArraySelections();
269 
273  virtual void SetUpDataArraySelections() = 0;
274 
278  static void SelectionModifiedCallback(
279  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
280 
282  int MaxLevel;
283  char* FileName;
285 
290 
293 
294  std::vector<int> BlockMap;
295 
296 private:
297  vtkAMRBaseReader(const vtkAMRBaseReader&) = delete;
298  void operator=(const vtkAMRBaseReader&) = delete;
299 };
300 
301 #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:62
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:69
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:39
Store on/off settings for data arrays, etc.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
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.