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 
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 
166 
174 
180  const int blockIdx, vtkUniformGrid *block, const char *fieldName );
181 
182 
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 
262  vtkInformation* vtkNotUsed(request),
263  vtkInformationVector** vtkNotUsed(inputVector),
264  vtkInformationVector* outputVector ) override;
266  vtkInformation* rqst,
267  vtkInformationVector** inputVector,
268  vtkInformationVector* outputVector ) override;
271 
272  // Array selection member variables and methods
276 
283 
287  virtual void SetUpDataArraySelections() = 0;
288 
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 */
vtkAMRBaseReader::GetNumberOfCellArrays
int GetNumberOfCellArrays()
vtkAMRBaseReader::GetNumberOfLevels
virtual int GetNumberOfLevels()=0
Returns the total number of levels.
vtkAMRBaseReader::SelectionModifiedCallback
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Call-back registered with the SelectionObserver.
vtkAMRBaseReader::SetUpDataArraySelections
virtual void SetUpDataArraySelections()=0
Initializes the PointDataArraySelection & CellDataArraySelection.
vtkAMRBaseReader::Initialize
void Initialize()
Initializes the AMR reader.
vtkAMRBaseReader::BlockMap
std::vector< int > BlockMap
Definition: vtkAMRBaseReader.h:308
vtkAMRBaseReader::FillMetaData
virtual int FillMetaData()=0
Loads all the AMR metadata & constructs the LevelIdxPair12InternalIdx datastructure which maps (level...
vtkAMRBaseReader::SetPointArrayStatus
void SetPointArrayStatus(const char *name, int status)
vtkAMRBaseReader::AssignAndLoadBlocks
void AssignAndLoadBlocks(vtkOverlappingAMR *amrds)
This method assigns blocks to processes using block-cyclic distribution.
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
vtkAMRBaseReader::SetupBlockRequest
void SetupBlockRequest(vtkInformation *outputInfo)
Initializes the request of blocks to be loaded.
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:41
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkAMRBaseReader::GetCellArrayName
const char * GetCellArrayName(int index)
vtkAMRBaseReader::LoadedMetaData
bool LoadedMetaData
Definition: vtkAMRBaseReader.h:306
vtkAMRBaseReader::Cache
vtkAMRDataSetCache * Cache
Definition: vtkAMRBaseReader.h:301
vtkAMRBaseReader::PointDataArraySelection
vtkDataArraySelection * PointDataArraySelection
Definition: vtkAMRBaseReader.h:273
vtkAMRBaseReader::CellDataArraySelection
vtkDataArraySelection * CellDataArraySelection
Definition: vtkAMRBaseReader.h:274
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkAMRBaseReader::vtkAMRBaseReader
vtkAMRBaseReader()
vtkAMRBaseReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAMRBaseReader::Controller
vtkMultiProcessController * Controller
Definition: vtkAMRBaseReader.h:298
vtkAMRBaseReader::GetAMRData
void GetAMRData(const int blockIdx, vtkUniformGrid *block, const char *fieldName)
Loads the AMR data corresponding to the given field name.
vtkDataArraySelection
Store on/off settings for data arrays for a vtkSource.
Definition: vtkDataArraySelection.h:38
vtkAMRBaseReader::IsParallel
bool IsParallel()
vtkAMRBaseReader
An abstract class that encapsulates common functionality for all AMR readers.
Definition: vtkAMRBaseReader.h:43
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkAMRBaseReader::NumBlocksFromFile
int NumBlocksFromFile
Definition: vtkAMRBaseReader.h:302
vtkAMRBaseReader::GetPointArrayStatus
int GetPointArrayStatus(const char *name)
Get/Set whether the point or cell array with the given name is to be read.
vtkAMRBaseReader::GetCellArrayStatus
int GetCellArrayStatus(const char *name)
vtkAMRBaseReader::GetAMRGridData
virtual void GetAMRGridData(const int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block data.
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:83
vtkAMRBaseReader::RequestInformation
int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
vtkAMRBaseReader::IsCachingEnabled
bool IsCachingEnabled() const
Definition: vtkAMRBaseReader.h:61
vtkAMRBaseReader::FileName
char * FileName
Definition: vtkAMRBaseReader.h:297
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkX3D::field
@ field
Definition: vtkX3D.h:177
vtkOverlappingAMRAlgorithm
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
Definition: vtkOverlappingAMRAlgorithm.h:37
vtkAMRDataSetCache
A concrete implementation of vtkObject that provides functionality for caching AMR blocks.
Definition: vtkAMRDataSetCache.h:36
vtkAMRBaseReader::SelectionObserver
vtkCallbackCommand * SelectionObserver
Definition: vtkAMRBaseReader.h:275
vtkAMRBaseReader::LoadCellData
void LoadCellData(const int blockIdx, vtkUniformGrid *block)
A wrapper that loops over all cell arrays and loads the cell arrays that are enabled,...
vtkAMRBaseReader::GetNumberOfBlocks
virtual int GetNumberOfBlocks()=0
Returns the total number of blocks.
vtkAMRBaseReader::GetAMRBlock
vtkUniformGrid * GetAMRBlock(const int blockIdx)
Loads the AMR block corresponding to the given index.
vtkAMRBaseReader::RequestData
int RequestData(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) override
Standard Pipeline methods, subclasses may override this method if needed.
vtkAMRBaseReader::GetBlockLevel
virtual int GetBlockLevel(const int blockIdx)=0
Returns the block level for the given block.
vtkAMRBaseReader::GetBlockProcessId
int GetBlockProcessId(const int blockIdx)
Returns the block process ID for the block corresponding to the given block index.
vtkAMRBaseReader::GetAMRGrid
virtual vtkUniformGrid * GetAMRGrid(const int blockIdx)=0
Loads the block according to the index w.r.t.
vtkOverlappingAMR
hierarchical dataset of vtkUniformGrids
Definition: vtkOverlappingAMR.h:47
vtkAMRBaseReader::SetCellArrayStatus
void SetCellArrayStatus(const char *name, int status)
vtkX3D::name
@ name
Definition: vtkX3D.h:219
vtkAMRBaseReader::GetPointArrayName
const char * GetPointArrayName(int index)
Get the name of the point or cell array with the given index in the input.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkAMRBaseReader::NumBlocksFromCache
int NumBlocksFromCache
Definition: vtkAMRBaseReader.h:303
vtkAMRBaseReader::LoadPointData
void LoadPointData(const int blockIdx, vtkUniformGrid *block)
A wrapper that loops over point arrays and load the point arrays that are enabled,...
vtkAMRBaseReader::InitialRequest
bool InitialRequest
Definition: vtkAMRBaseReader.h:295
vtkAMRBaseReader::IsBlockMine
bool IsBlockMine(const int blockIdx)
Determines if the block is owned by this process based on the the block index and total number of pro...
vtkAMRBaseReader::GetAMRGridPointData
virtual void GetAMRGridPointData(const int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block Point data.
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:51
vtkAMRBaseReader::SetFileName
virtual void SetFileName(const char *fileName)=0
vtkAMRBaseReader::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkAMRBaseReader::Metadata
vtkOverlappingAMR * Metadata
Definition: vtkAMRBaseReader.h:305
vtkOverlappingAMRAlgorithm.h
vtkAMRBaseReader::MaxLevel
int MaxLevel
Definition: vtkAMRBaseReader.h:296
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkAMRBaseReader::GetNumberOfPointArrays
int GetNumberOfPointArrays()
Get the number of point or cell arrays available in the input.
vtkAMRBaseReader::GetAMRPointData
void GetAMRPointData(const int blockIdx, vtkUniformGrid *block, const char *fieldName)
Loads the AMR point data corresponding to the given field name.
vtkAMRBaseReader::InitializeArraySelections
void InitializeArraySelections()
Initializes the array selections.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkAMRBaseReader::LoadRequestedBlocks
void LoadRequestedBlocks(vtkOverlappingAMR *amrds)
This method loads all the blocks in the BlockMap for the given process.
vtkAMRBaseReader::~vtkAMRBaseReader
~vtkAMRBaseReader() override
vtkAMRBaseReader::ReadMetaData
virtual void ReadMetaData()=0
Reads all the metadata from the file.
vtkAMRBaseReader::EnableCaching
vtkTypeBool EnableCaching
Definition: vtkAMRBaseReader.h:300