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
34class vtkIndent;
36class vtkUniformGrid;
37class vtkDataArray;
38
39class VTKIOAMR_EXPORT vtkAMRBaseReader : public vtkOverlappingAMRAlgorithm
40{
41public:
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
133protected:
136
137 // Desscription:
138 // Checks if this reader instance is attached to a communicator
139 // with more than one MPI processes.
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
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
283 char* FileName;
285
290
293
294 std::vector<int> BlockMap;
295
296private:
297 vtkAMRBaseReader(const vtkAMRBaseReader&) = delete;
298 void operator=(const vtkAMRBaseReader&) = delete;
299};
300
301#endif /* vtkAMRBaseReader_h */
An abstract class that encapsulates common functionality for all AMR readers.
std::vector< int > BlockMap
void SetupBlockRequest(vtkInformation *outputInfo)
Initializes the request of blocks to be loaded.
int GetNumberOfCellArrays()
Get the number of point or cell arrays available in the input.
void GetAMRData(const int blockIdx, vtkUniformGrid *block, const char *fieldName)
Loads the AMR data corresponding to the given field name.
int RequestData(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) override
Standard Pipeline methods, subclasses may override this method if needed.
vtkDataArraySelection * PointDataArraySelection
virtual void GetAMRGridPointData(const int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block Point data.
vtkCallbackCommand * SelectionObserver
const char * GetPointArrayName(int index)
Get the name of the point or cell array with the given index in the input.
vtkDataArraySelection * CellDataArraySelection
virtual int GetNumberOfBlocks()=0
Returns the total number of blocks.
vtkUniformGrid * GetAMRBlock(const int blockIdx)
Loads the AMR block corresponding to the given index.
vtkTypeBool EnableCaching
virtual void ReadMetaData()=0
Reads all the metadata from the file.
void LoadRequestedBlocks(vtkOverlappingAMR *amrds)
This method loads all the blocks in the BlockMap for the given process.
const char * GetCellArrayName(int index)
Get the name of the point or cell array with the given index in the input.
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Call-back registered with the SelectionObserver.
int GetCellArrayStatus(const char *name)
Get/Set whether the point or cell array with the given name is to be read.
int GetBlockProcessId(const int blockIdx)
Returns the block process ID for the block corresponding to the given block index.
void LoadCellData(const int blockIdx, vtkUniformGrid *block)
A wrapper that loops over all cell arrays and loads the cell arrays that are enabled,...
virtual int GetBlockLevel(const int blockIdx)=0
Returns the block level for the given block.
bool IsCachingEnabled() const
Set/Get Reader caching property.
void AssignAndLoadBlocks(vtkOverlappingAMR *amrds)
This method assigns blocks to processes using block-cyclic distribution.
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...
void SetPointArrayStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is to be read.
void GetAMRPointData(const int blockIdx, vtkUniformGrid *block, const char *fieldName)
Loads the AMR point data corresponding to the given field name.
virtual int FillMetaData()=0
Loads all the AMR metadata & constructs the LevelIdxPair12InternalIdx datastructure which maps (level...
~vtkAMRBaseReader() override
int GetPointArrayStatus(const char *name)
Get/Set whether the point or cell array with the given name is to be read.
void InitializeArraySelections()
Initializes the array selections.
virtual void GetAMRGridData(const int blockIdx, vtkUniformGrid *block, const char *field)=0
Loads the block data.
int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard Pipeline methods, subclasses may override this method if needed.
vtkOverlappingAMR * Metadata
void Initialize()
Initializes the AMR reader.
void LoadPointData(const int blockIdx, vtkUniformGrid *block)
A wrapper that loops over point arrays and load the point arrays that are enabled,...
vtkAMRDataSetCache * Cache
void SetCellArrayStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is to be read.
vtkGetFilePathMacro(FileName)
Set/Get the filename.
vtkMultiProcessController * Controller
virtual int GetNumberOfLevels()=0
Returns the total number of levels.
virtual void SetFileName(VTK_FILEPATH const char *fileName)=0
Set/Get the filename.
int FillOutputPortInformation(int port, vtkInformation *info) override
Standard Pipeline methods, subclasses may override this method if needed.
int GetNumberOfPointArrays()
Get the number of point or cell arrays available in the input.
virtual vtkUniformGrid * GetAMRGrid(const int blockIdx)=0
Loads the block according to the index w.r.t.
virtual void SetUpDataArraySelections()=0
Initializes the PointDataArraySelection & CellDataArraySelection.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A concrete implementation of vtkObject that provides functionality for caching AMR blocks.
supports function callbacks
Store on/off settings for data arrays for a vtkSource.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:73
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
hierarchical dataset of vtkUniformGrids
image data with blanking
@ field
Definition: vtkX3D.h:183
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FILEPATH