VTK
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 <vector> // STL vector header
28 #include <map> // STL map header
29 #include <utility> // for STL pair
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 :
43 {
44 public:
46  void PrintSelf(ostream &os, vtkIndent indent) override;
47 
52  void Initialize();
53 
55 
58  vtkSetMacro( EnableCaching, vtkTypeBool );
59  vtkGetMacro( EnableCaching, vtkTypeBool );
60  vtkBooleanMacro( EnableCaching, vtkTypeBool );
61  bool IsCachingEnabled() const
62  {
63  return( (this->EnableCaching)?true:false);
64  };
66 
68 
72  vtkSetMacro( Controller, vtkMultiProcessController* );
73  vtkGetMacro( Controller, vtkMultiProcessController* );
75 
77 
80  vtkSetMacro( MaxLevel,int);
82 
84 
88  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
89  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
91 
93 
96  int GetNumberOfPointArrays();
97  int GetNumberOfCellArrays();
99 
101 
105  const char* GetPointArrayName(int index);
106  const char* GetCellArrayName(int index);
108 
110 
114  int GetPointArrayStatus(const char* name);
115  int GetCellArrayStatus(const char* name);
116  void SetPointArrayStatus(const char* name, int status);
117  void SetCellArrayStatus(const char* name, int status);
119 
121 
125  vtkGetStringMacro( FileName );
126  virtual void SetFileName( const char *fileName ) = 0;
128 
132  virtual int GetNumberOfBlocks() = 0;
133 
137  virtual int GetNumberOfLevels() = 0;
138 
139 protected:
141  ~vtkAMRBaseReader() override;
142 
143  // Desscription:
144  // Checks if this reader instance is attached to a communicator
145  // with more than one MPI processes.
146  bool IsParallel();
147 
152  bool IsBlockMine( const int blockIdx );
153 
159  vtkUniformGrid* GetAMRBlock( const int blockIdx );
160 
165  void AssignAndLoadBlocks( vtkOverlappingAMR *amrds );
166 
173  void LoadRequestedBlocks( vtkOverlappingAMR *amrds );
174 
179  void GetAMRData(
180  const int blockIdx, vtkUniformGrid *block, const char *fieldName );
181 
182 
186  void GetAMRPointData(
187  const int blockIdx, vtkUniformGrid *block, const char *fieldName );
188 
194  void LoadPointData( const int blockIdx, vtkUniformGrid *block );
195 
202  void LoadCellData( const int blockIdx, vtkUniformGrid *block );
203 
212  int GetBlockProcessId( const int blockIdx );
213 
221  void SetupBlockRequest( vtkInformation *outputInfo );
222 
226  virtual void ReadMetaData() = 0;
227 
231  virtual int GetBlockLevel( const int blockIdx ) = 0;
232 
238  virtual int FillMetaData( ) = 0;
239 
243  virtual vtkUniformGrid* GetAMRGrid( const int blockIdx ) = 0;
244 
248  virtual void GetAMRGridData(
249  const int blockIdx, vtkUniformGrid *block, const char *field ) = 0;
250 
254  virtual void GetAMRGridPointData(
255  const int blockIdx, vtkUniformGrid *block, const char *field ) = 0;
256 
258 
261  int RequestData(
262  vtkInformation* vtkNotUsed(request),
263  vtkInformationVector** vtkNotUsed(inputVector),
264  vtkInformationVector* outputVector ) override;
265  int RequestInformation(
266  vtkInformation* rqst,
267  vtkInformationVector** inputVector,
268  vtkInformationVector* outputVector ) override;
271 
272  // Array selection member variables and methods
276 
282  void InitializeArraySelections();
283 
287  virtual void SetUpDataArraySelections() = 0;
288 
292  static void SelectionModifiedCallback(
293  vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
294 
296  int MaxLevel;
297  char *FileName;
299 
304 
307 
308  std::vector<int> BlockMap;
309 
310 private:
311  vtkAMRBaseReader( const vtkAMRBaseReader& ) = delete;
312  void operator=( const vtkAMRBaseReader& ) = delete;
313 };
314 
315 #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:59
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 for a vtkSource.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
image data with blanking
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.