VTK  9.0.1
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  =========================================================================*/
22 #ifndef vtkAMRBaseReader_h
23 #define vtkAMRBaseReader_h
24 
25 #include "vtkIOAMRModule.h" // For export macro
27 #include <map> // STL map header
28 #include <utility> // for STL pair
29 #include <vector> // STL vector header
30 
31 // Forward Declarations
32 class vtkOverlappingAMR;
35 class vtkCallbackCommand;
36 class vtkIndent;
37 class vtkAMRDataSetCache;
38 class vtkUniformGrid;
39 class vtkDataArray;
40 
41 class VTKIOAMR_EXPORT vtkAMRBaseReader : public vtkOverlappingAMRAlgorithm
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
51  void Initialize();
52 
54 
57  vtkSetMacro(EnableCaching, vtkTypeBool);
58  vtkGetMacro(EnableCaching, vtkTypeBool);
59  vtkBooleanMacro(EnableCaching, vtkTypeBool);
60  bool IsCachingEnabled() const { return ((this->EnableCaching) ? true : false); };
62 
64 
68  vtkSetMacro(Controller, vtkMultiProcessController*);
69  vtkGetMacro(Controller, vtkMultiProcessController*);
71 
73 
76  vtkSetMacro(MaxLevel, int);
78 
80 
84  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
85  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
87 
89 
92  int GetNumberOfPointArrays();
93  int GetNumberOfCellArrays();
95 
97 
101  const char* GetPointArrayName(int index);
102  const char* GetCellArrayName(int index);
104 
106 
110  int GetPointArrayStatus(const char* name);
111  int GetCellArrayStatus(const char* name);
112  void SetPointArrayStatus(const char* name, int status);
113  void SetCellArrayStatus(const char* name, int status);
115 
117 
121  vtkGetStringMacro(FileName);
122  virtual void SetFileName(const char* fileName) = 0;
124 
128  virtual int GetNumberOfBlocks() = 0;
129 
133  virtual int GetNumberOfLevels() = 0;
134 
135 protected:
137  ~vtkAMRBaseReader() override;
138 
139  // Desscription:
140  // Checks if this reader instance is attached to a communicator
141  // with more than one MPI processes.
142  bool IsParallel();
143 
148  bool IsBlockMine(const int blockIdx);
149 
155  vtkUniformGrid* GetAMRBlock(const int blockIdx);
156 
161  void AssignAndLoadBlocks(vtkOverlappingAMR* amrds);
162 
169  void LoadRequestedBlocks(vtkOverlappingAMR* amrds);
170 
175  void GetAMRData(const int blockIdx, vtkUniformGrid* block, const char* fieldName);
176 
180  void GetAMRPointData(const int blockIdx, vtkUniformGrid* block, const char* fieldName);
181 
187  void LoadPointData(const int blockIdx, vtkUniformGrid* block);
188 
195  void LoadCellData(const int blockIdx, vtkUniformGrid* block);
196 
205  int GetBlockProcessId(const int blockIdx);
206 
214  void SetupBlockRequest(vtkInformation* outputInfo);
215 
219  virtual void ReadMetaData() = 0;
220 
224  virtual int GetBlockLevel(const int blockIdx) = 0;
225 
231  virtual int FillMetaData() = 0;
232 
236  virtual vtkUniformGrid* GetAMRGrid(const int blockIdx) = 0;
237 
241  virtual void GetAMRGridData(const int blockIdx, vtkUniformGrid* block, const char* field) = 0;
242 
246  virtual void GetAMRGridPointData(
247  const int blockIdx, vtkUniformGrid* block, const char* field) = 0;
248 
250 
253  int RequestData(vtkInformation* vtkNotUsed(request),
254  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) override;
255  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
256  vtkInformationVector* outputVector) override;
259 
260  // Array selection member variables and methods
264 
270  void InitializeArraySelections();
271 
275  virtual void SetUpDataArraySelections() = 0;
276 
280  static void SelectionModifiedCallback(
281  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
282 
284  int MaxLevel;
285  char* FileName;
287 
292 
295 
296  std::vector<int> BlockMap;
297 
298 private:
299  vtkAMRBaseReader(const vtkAMRBaseReader&) = delete;
300  void operator=(const vtkAMRBaseReader&) = delete;
301 };
302 
303 #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
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:33
Store on/off settings for data arrays for a vtkSource.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
image data with blanking
vtkOverlappingAMR * Metadata
bool IsCachingEnabled() const
Set/Get Reader caching property.
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.