VTK  9.1.0
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  vtkSetMacro(Controller, vtkMultiProcessController*);
67  vtkGetMacro(Controller, vtkMultiProcessController*);
69 
71 
74  vtkSetMacro(MaxLevel, int);
76 
78 
82  vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection);
83  vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection);
85 
87 
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 
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 
160 
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 
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;
254  vtkInformationVector* outputVector) override;
257 
258  // Array selection member variables and methods
262 
269 
273  virtual void SetUpDataArraySelections() = 0;
274 
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 */
vtkAMRBaseReader::vtkGetFilePathMacro
vtkGetFilePathMacro(FileName)
Set/Get the filename.
vtkAMRBaseReader::GetNumberOfCellArrays
int GetNumberOfCellArrays()
Get the number of point or cell arrays available in the input.
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:294
vtkAMRBaseReader::FillMetaData
virtual int FillMetaData()=0
Loads all the AMR metadata & constructs the LevelIdxPair12InternalIdx datastructure which maps (level...
VTK_FILEPATH
#define VTK_FILEPATH
Definition: vtkWrappingHints.h:46
vtkAMRBaseReader::SetPointArrayStatus
void SetPointArrayStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is to be read.
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:145
vtkAMRBaseReader::SetupBlockRequest
void SetupBlockRequest(vtkInformation *outputInfo)
Initializes the request of blocks to be loaded.
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:74
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkAMRBaseReader::GetCellArrayName
const char * GetCellArrayName(int index)
Get the name of the point or cell array with the given index in the input.
vtkAMRBaseReader::SetFileName
virtual void SetFileName(VTK_FILEPATH const char *fileName)=0
Set/Get the filename.
vtkAMRBaseReader::LoadedMetaData
bool LoadedMetaData
Definition: vtkAMRBaseReader.h:292
vtkAMRBaseReader::Cache
vtkAMRDataSetCache * Cache
Definition: vtkAMRBaseReader.h:287
vtkAMRBaseReader::PointDataArraySelection
vtkDataArraySelection * PointDataArraySelection
Definition: vtkAMRBaseReader.h:259
vtkAMRBaseReader::CellDataArraySelection
vtkDataArraySelection * CellDataArraySelection
Definition: vtkAMRBaseReader.h:260
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
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:284
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:35
vtkAMRBaseReader::IsParallel
bool IsParallel()
vtkAMRBaseReader
An abstract class that encapsulates common functionality for all AMR readers.
Definition: vtkAMRBaseReader.h:40
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkAMRBaseReader::NumBlocksFromFile
int NumBlocksFromFile
Definition: vtkAMRBaseReader.h:288
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)
Get/Set whether the point or cell array with the given name is to be read.
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:77
vtkAMRBaseReader::RequestInformation
int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard Pipeline methods, subclasses may override this method if needed.
vtkAMRBaseReader::IsCachingEnabled
bool IsCachingEnabled() const
Set/Get Reader caching property.
Definition: vtkAMRBaseReader.h:58
vtkAMRBaseReader::FileName
char * FileName
Definition: vtkAMRBaseReader.h:283
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkX3D::field
@ field
Definition: vtkX3D.h:183
vtkOverlappingAMRAlgorithm
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
Definition: vtkOverlappingAMRAlgorithm.h:31
vtkAMRDataSetCache
A concrete implementation of vtkObject that provides functionality for caching AMR blocks.
Definition: vtkAMRDataSetCache.h:36
vtkAMRBaseReader::SelectionObserver
vtkCallbackCommand * SelectionObserver
Definition: vtkAMRBaseReader.h:261
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:80
vtkAMRBaseReader::SetCellArrayStatus
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is to be read.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
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:183
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkAMRBaseReader::NumBlocksFromCache
int NumBlocksFromCache
Definition: vtkAMRBaseReader.h:289
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:281
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:154
vtkAMRBaseReader::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Standard Pipeline methods, subclasses may override this method if needed.
vtkAMRBaseReader::Metadata
vtkOverlappingAMR * Metadata
Definition: vtkAMRBaseReader.h:291
vtkOverlappingAMRAlgorithm.h
vtkAMRBaseReader::MaxLevel
int MaxLevel
Definition: vtkAMRBaseReader.h:282
vtkX3D::index
@ index
Definition: vtkX3D.h:252
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:286