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  =========================================================================*/
21 #ifndef VTKAMRBASEREADER_H_
22 #define VTKAMRBASEREADER_H_
23 
24 #include "vtkIOAMRModule.h" // For export macro
26 #include <vector> // STL vector header
27 #include <map> // STL map header
28 #include <utility> // for STL pair
29 
30 // Forward Declarations
31 class vtkOverlappingAMR;
34 class vtkCallbackCommand;
35 class vtkIndent;
36 class vtkAMRDataSetCache;
37 class vtkUniformGrid;
38 class vtkDataArray;
39 
42 {
43 public:
45  void PrintSelf(ostream &os, vtkIndent indent);
46 
49  void Initialize();
50 
52 
53  vtkSetMacro( EnableCaching, int );
54  vtkGetMacro( EnableCaching, int );
55  vtkBooleanMacro( EnableCaching, int );
56  bool IsCachingEnabled() const
57  {
58  return( (this->EnableCaching)?true:false);
59  };
61 
63 
65  vtkSetMacro( Controller, vtkMultiProcessController* );
66  vtkGetMacro( Controller, vtkMultiProcessController* );
68 
70 
71  vtkSetMacro( MaxLevel,int);
73 
75 
77  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
78  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
80 
82 
83  int GetNumberOfPointArrays();
84  int GetNumberOfCellArrays();
86 
88 
90  const char* GetPointArrayName(int index);
91  const char* GetCellArrayName(int index);
93 
95 
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 
106  vtkGetStringMacro( FileName );
107  virtual void SetFileName( const char *fileName ) = 0;
109 
112  virtual int GetNumberOfBlocks() = 0;
113 
116  virtual int GetNumberOfLevels() = 0;
117 
118 protected:
120  virtual ~vtkAMRBaseReader();
121 
122  // Desscription:
123  // Checks if this reader instance is attached to a communicator
124  // with more than one MPI processes.
125  bool IsParallel();
126 
129  bool IsBlockMine( const int blockIdx );
130 
134  vtkUniformGrid* GetAMRBlock( const int blockIdx );
135 
139  void AssignAndLoadBlocks( vtkOverlappingAMR *amrds );
140 
146  void LoadRequestedBlocks( vtkOverlappingAMR *amrds );
147 
149 
151  void GetAMRData(
152  const int blockIdx, vtkUniformGrid *block, const char *fieldName );
154 
155 
157 
158  void GetAMRPointData(
159  const int blockIdx, vtkUniformGrid *block, const char *fieldName );
161 
165  void LoadPointData( const int blockIdx, vtkUniformGrid *block );
166 
171  void LoadCellData( const int blockIdx, vtkUniformGrid *block );
172 
179  int GetBlockProcessId( const int blockIdx );
180 
186  void SetupBlockRequest( vtkInformation *outputInfo );
187 
190  virtual void ReadMetaData() = 0;
191 
193  virtual int GetBlockLevel( const int blockIdx ) = 0;
194 
198  virtual int FillMetaData( ) = 0;
199 
201  virtual vtkUniformGrid* GetAMRGrid( const int blockIdx ) = 0;
202 
204 
205  virtual void GetAMRGridData(
206  const int blockIdx, vtkUniformGrid *block, const char *field ) = 0;
208 
210 
211  virtual void GetAMRGridPointData(
212  const int blockIdx, vtkUniformGrid *block, const char *field ) = 0;
214 
216 
218  virtual int RequestData(
219  vtkInformation* vtkNotUsed(request),
220  vtkInformationVector** vtkNotUsed(inputVector),
221  vtkInformationVector* outputVector );
222  virtual int RequestInformation(
223  vtkInformation* rqst,
224  vtkInformationVector** inputVector,
225  vtkInformationVector* outputVector );
228 
229  // Array selection member variables and methods
233 
237  void InitializeArraySelections();
238 
240  virtual void SetUpDataArraySelections() = 0;
241 
243 
244  static void SelectionModifiedCallback(
245  vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
247 
249  int MaxLevel;
250  char *FileName;
252 
257 
260 
261 
262  //BTX
263  std::vector<int> BlockMap;
264  //ETX
265 
266 private:
267  vtkAMRBaseReader( const vtkAMRBaseReader& ); // Not implemented
268  void operator=( const vtkAMRBaseReader& ); // Not implemented
269 };
270 
271 #endif /* VTKAMRBASEREADER_H_ */
void PrintSelf(ostream &os, vtkIndent indent)
abstract base class for most VTK objects
Definition: vtkObject.h:61
Store vtkAlgorithm input/output information.
vtkCallbackCommand * SelectionObserver
#define VTKIOAMR_EXPORT
vtkDataArraySelection * CellDataArraySelection
vtkMultiProcessController * Controller
bool IsCachingEnabled() const
std::vector< int > BlockMap
vtkDataArraySelection * PointDataArraySelection
supports function callbacks
virtual int FillOutputPortInformation(int port, vtkInformation *info)
a simple class to control print indentation
Definition: vtkIndent.h:38
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
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
hierarchical dataset of vtkUniformGrids
Store zero or more vtkInformation instances.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkAMRDataSetCache * Cache
Multiprocessing communication superclass.