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 
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 
162 
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 
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;
256  vtkInformationVector* outputVector) override;
259 
260  // Array selection member variables and methods
264 
271 
275  virtual void SetUpDataArraySelections() = 0;
276 
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 */
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:296
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:36
vtkAMRBaseReader::SetupBlockRequest
void SetupBlockRequest(vtkInformation *outputInfo)
Initializes the request of blocks to be loaded.
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:35
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:54
vtkAMRBaseReader::GetCellArrayName
const char * GetCellArrayName(int index)
vtkAMRBaseReader::LoadedMetaData
bool LoadedMetaData
Definition: vtkAMRBaseReader.h:294
vtkAMRBaseReader::Cache
vtkAMRDataSetCache * Cache
Definition: vtkAMRBaseReader.h:289
vtkAMRBaseReader::PointDataArraySelection
vtkDataArraySelection * PointDataArraySelection
Definition: vtkAMRBaseReader.h:261
vtkAMRBaseReader::CellDataArraySelection
vtkDataArraySelection * CellDataArraySelection
Definition: vtkAMRBaseReader.h:262
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
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:286
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:42
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkAMRBaseReader::NumBlocksFromFile
int NumBlocksFromFile
Definition: vtkAMRBaseReader.h:290
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:76
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:60
vtkAMRBaseReader::FileName
char * FileName
Definition: vtkAMRBaseReader.h:285
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
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:33
vtkAMRDataSetCache
A concrete implementation of vtkObject that provides functionality for caching AMR blocks.
Definition: vtkAMRDataSetCache.h:36
vtkAMRBaseReader::SelectionObserver
vtkCallbackCommand * SelectionObserver
Definition: vtkAMRBaseReader.h:263
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:41
vtkAMRBaseReader::SetCellArrayStatus
void SetCellArrayStatus(const char *name, int status)
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:65
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkAMRBaseReader::NumBlocksFromCache
int NumBlocksFromCache
Definition: vtkAMRBaseReader.h:291
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:283
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:45
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:293
vtkOverlappingAMRAlgorithm.h
vtkAMRBaseReader::MaxLevel
int MaxLevel
Definition: vtkAMRBaseReader.h:284
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:288