1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: H5RageAdaptor.h 5 6 Copyright (c) Kitware, Inc. 7 All rights reserved. 8 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/ 15 #ifndef H5RageAdaptor_h 16 #define H5RageAdaptor_h 17 18 #include "vtkDataArraySelection.h" 19 #include "vtkIOH5RageModule.h" // For export macro 20 21 #include <string> // for std::string 22 #include <vector> // for std::vector 23 24 class vtkDataArraySelection; 25 class vtkImageData; 26 class vtkMultiProcessController; 27 28 class VTKIOH5RAGE_EXPORT H5RageAdaptor 29 { 30 public: 31 H5RageAdaptor(vtkMultiProcessController* ctrl); 32 ~H5RageAdaptor(); 33 34 int InitializeGlobal(const char* DescFile); 35 void LoadVariableData(vtkImageData* data, int timeStep, vtkDataArraySelection* cellSelection); 36 template <class T> 37 void ConvertHDFData(int ndims, int* dims_out, T* hdfData); 38 GetNumberOfTimeSteps()39 int GetNumberOfTimeSteps() { return this->NumberOfTimeSteps; } GetTimeStep(int step)40 double GetTimeStep(int step) { return this->TimeSteps[step]; } 41 GetNumberOfVariables()42 int GetNumberOfVariables() { return (int)this->VariableName.size(); } GetVariableName(int indx)43 const char* GetVariableName(int indx) { return this->VariableName[indx].c_str(); } 44 GetWholeExtent(int ext)45 int GetWholeExtent(int ext) { return this->WholeExtent[ext]; } GetSubExtent(int ext)46 int GetSubExtent(int ext) { return this->SubExtent[ext]; } GetDimension(int dim)47 int GetDimension(int dim) { return this->Dimension[dim]; } GetOrigin(int dim)48 double GetOrigin(int dim) { return this->Origin[dim]; } GetSpacing(int dim)49 double GetSpacing(int dim) { return this->Spacing[dim]; } 50 51 protected: 52 // Collect the metadata 53 int CollectMetaData(const char* H5RageFileName); 54 int ParseH5RageFile(const char* H5RageFileName); 55 std::string TrimString(const std::string& str); 56 57 // Used in parallel reader and load balancing 58 vtkMultiProcessController* Controller; 59 int Rank; 60 int TotalRank; 61 62 // Time series of hdf files 63 std::vector<std::string> HdfFileName; // all hdf files 64 65 // Time step information retrieved from hdf filenames 66 int NumberOfTimeSteps; 67 double* TimeSteps; 68 69 // Geometry information for sharing data with other processors 70 int** ExtentSchedule; 71 int* NumberOfTuples; 72 73 int WholeExtent[6]; // Size of image 74 int SubExtent[6]; // Size of image this processor 75 int Dimension[3]; // Dimension of image 76 double Origin[3]; // Physical origin 77 double Spacing[3]; // Physical spacing 78 79 int NumberOfDimensions; 80 int TotalTuples; 81 bool UseFloat64; 82 83 // Variable information retrieved from hdf filenames 84 int NumberOfVariables; 85 std::vector<std::string> VariableName; 86 }; 87 88 #endif 89 90 // VTK-HeaderTest-Exclude: H5RageAdaptor.h 91