VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAMREnzoReader.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 =========================================================================*/ 00025 #ifndef VTKAMRENZOREADER_H_ 00026 #define VTKAMRENZOREADER_H_ 00027 00028 #include "vtkIOAMRModule.h" // For export macro 00029 #include "vtkAMRBaseReader.h" 00030 00031 #include <map> // For STL map 00032 00033 class vtkOverlappingAMR; 00034 class vtkEnzoReaderInternal; 00035 00036 class VTKIOAMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader 00037 { 00038 public: 00039 static vtkAMREnzoReader* New(); 00040 vtkTypeMacro(vtkAMREnzoReader,vtkAMRBaseReader); 00041 void PrintSelf(ostream &os, vtkIndent indent ); 00042 00044 00045 vtkSetMacro( ConvertToCGS, int ); 00046 vtkGetMacro( ConvertToCGS, int ); 00047 vtkBooleanMacro( ConvertToCGS, int ); 00049 00051 int GetNumberOfBlocks(); 00052 00054 int GetNumberOfLevels(); 00055 00057 void SetFileName( const char* fileName ); 00058 00059 protected: 00060 vtkAMREnzoReader(); 00061 ~vtkAMREnzoReader(); 00062 00065 void ParseConversionFactors(); 00066 00069 int GetIndexFromArrayName( std::string arrayName ); 00070 00073 void ParseLabel(const std::string labelString,int &idx,std::string &label); 00074 00077 void ParseCFactor(const std::string labelString, int &idx, double &factor ); 00078 00082 double GetConversionFactor( const std::string name ); 00083 00085 void ReadMetaData(); 00086 00088 int GetBlockLevel( const int blockIdx ); 00089 00090 void ComputeStats(vtkEnzoReaderInternal* internal, std::vector<int>& blocksPerLevel, double min[3]); 00091 00093 int FillMetaData( ); 00094 00096 vtkUniformGrid* GetAMRGrid( const int blockIdx ); 00097 00099 00100 void GetAMRGridData( 00101 const int blockIdx, vtkUniformGrid *block, const char *field); 00103 00105 void SetUpDataArraySelections(); 00106 00107 int ConvertToCGS; 00108 bool IsReady; 00109 00110 private: 00111 vtkAMREnzoReader( const vtkAMREnzoReader& ); // Not Implemented 00112 void operator=(const vtkAMREnzoReader& ); // Not Implemented 00113 00114 vtkEnzoReaderInternal *Internal; 00115 00116 std::map< std::string, int > label2idx; 00117 std::map< int, double > conversionFactors; 00118 }; 00119 00120 #endif /* VTKAMRENZOREADER_H_ */