VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAMRBaseReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00021 #ifndef VTKAMRBASEREADER_H_ 00022 #define VTKAMRBASEREADER_H_ 00023 00024 #include "vtkIOAMRModule.h" // For export macro 00025 #include "vtkOverlappingAMRAlgorithm.h" 00026 #include <vector> // STL vector header 00027 #include <map> // STL map header 00028 #include <utility> // for STL pair 00029 00030 // Forward Declarations 00031 class vtkOverlappingAMR; 00032 class vtkMultiProcessController; 00033 class vtkDataArraySelection; 00034 class vtkCallbackCommand; 00035 class vtkIndent; 00036 class vtkAMRDataSetCache; 00037 class vtkUniformGrid; 00038 class vtkDataArray; 00039 00040 class VTKIOAMR_EXPORT vtkAMRBaseReader : 00041 public vtkOverlappingAMRAlgorithm 00042 { 00043 public: 00044 vtkTypeMacro( vtkAMRBaseReader, vtkOverlappingAMRAlgorithm ); 00045 void PrintSelf(ostream &os, vtkIndent indent); 00046 00049 void Initialize(); 00050 00052 00053 vtkSetMacro( EnableCaching, int ); 00054 vtkGetMacro( EnableCaching, int ); 00055 vtkBooleanMacro( EnableCaching, int ); 00056 bool IsCachingEnabled() const 00057 { 00058 return( (this->EnableCaching)?true:false); 00059 }; 00061 00063 00065 vtkSetMacro( Controller, vtkMultiProcessController* ); 00066 vtkGetMacro( Controller, vtkMultiProcessController* ); 00068 00070 00071 vtkSetMacro( MaxLevel,int); 00073 00075 00077 vtkGetObjectMacro(CellDataArraySelection, vtkDataArraySelection); 00078 vtkGetObjectMacro(PointDataArraySelection, vtkDataArraySelection); 00080 00082 00083 int GetNumberOfPointArrays(); 00084 int GetNumberOfCellArrays(); 00086 00088 00090 const char* GetPointArrayName(int index); 00091 const char* GetCellArrayName(int index); 00093 00095 00097 int GetPointArrayStatus(const char* name); 00098 int GetCellArrayStatus(const char* name); 00099 void SetPointArrayStatus(const char* name, int status); 00100 void SetCellArrayStatus(const char* name, int status); 00102 00104 00106 vtkGetStringMacro( FileName ); 00107 virtual void SetFileName( const char *fileName ) = 0; 00109 00112 virtual int GetNumberOfBlocks() = 0; 00113 00116 virtual int GetNumberOfLevels() = 0; 00117 00118 protected: 00119 vtkAMRBaseReader(); 00120 virtual ~vtkAMRBaseReader(); 00121 00122 // Desscription: 00123 // Checks if this reader instance is attached to a communicator 00124 // with more than one MPI processes. 00125 bool IsParallel(); 00126 00129 bool IsBlockMine( const int blockIdx ); 00130 00134 vtkUniformGrid* GetAMRBlock( const int blockIdx ); 00135 00139 void AssignAndLoadBlocks( vtkOverlappingAMR *amrds ); 00140 00146 void LoadRequestedBlocks( vtkOverlappingAMR *amrds ); 00147 00149 00151 void GetAMRData( 00152 const int blockIdx, vtkUniformGrid *block, const char *fieldName ); 00154 00158 void LoadPointData( const int blockIdx, vtkUniformGrid *block ); 00159 00164 void LoadCellData( const int blockIdx, vtkUniformGrid *block ); 00165 00172 int GetBlockProcessId( const int blockIdx ); 00173 00179 void SetupBlockRequest( vtkInformation *outputInfo ); 00180 00183 virtual void ReadMetaData() = 0; 00184 00186 virtual int GetBlockLevel( const int blockIdx ) = 0; 00187 00191 virtual int FillMetaData( ) = 0; 00192 00194 virtual vtkUniformGrid* GetAMRGrid( const int blockIdx ) = 0; 00195 00197 00198 virtual void GetAMRGridData( 00199 const int blockIdx, vtkUniformGrid *block, const char *field ) = 0; 00201 00203 00205 virtual int RequestData( 00206 vtkInformation* vtkNotUsed(request), 00207 vtkInformationVector** vtkNotUsed(inputVector), 00208 vtkInformationVector* outputVector ); 00209 virtual int RequestInformation( 00210 vtkInformation* rqst, 00211 vtkInformationVector** inputVector, 00212 vtkInformationVector* outputVector ); 00213 int FillOutputPortInformation(int port,vtkInformation *info); 00215 00216 // Array selection member variables and methods 00217 vtkDataArraySelection *PointDataArraySelection; 00218 vtkDataArraySelection *CellDataArraySelection; 00219 vtkCallbackCommand *SelectionObserver; 00220 00224 void InitializeArraySelections(); 00225 00227 virtual void SetUpDataArraySelections() = 0; 00228 00230 00231 static void SelectionModifiedCallback( 00232 vtkObject *caller,unsigned long eid,void *clientdata,void *calldata ); 00234 00235 bool InitialRequest; 00236 int MaxLevel; 00237 char *FileName; 00238 vtkMultiProcessController *Controller; 00239 00240 int EnableCaching; 00241 vtkAMRDataSetCache *Cache; 00242 int NumBlocksFromFile; 00243 int NumBlocksFromCache; 00244 00245 vtkOverlappingAMR *Metadata; 00246 bool LoadedMetaData; 00247 00248 00249 //BTX 00250 std::vector<int> BlockMap; 00251 //ETX 00252 00253 private: 00254 vtkAMRBaseReader( const vtkAMRBaseReader& ); // Not implemented 00255 void operator=( const vtkAMRBaseReader& ); // Not implemented 00256 }; 00257 00258 #endif /* VTKAMRBASEREADER_H_ */