VTK  9.3.1
H5RageAdaptor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Kitware, Inc.
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef H5RageAdaptor_h
5 #define H5RageAdaptor_h
6 
8 #include "vtkIOH5RageModule.h" // For export macro
9 
10 #include <cstdint> // for std::int64_t
11 #include <string> // for std::string
12 #include <vector> // for std::vector
13 
14 VTK_ABI_NAMESPACE_BEGIN
16 class vtkImageData;
18 
19 class VTKIOH5RAGE_EXPORT H5RageAdaptor
20 {
21 public:
23  ~H5RageAdaptor();
24 
25  int InitializeGlobal(const char* DescFile);
26  void LoadVariableData(vtkImageData* data, int timeStep, vtkDataArraySelection* cellSelection);
27  template <class T>
28  void ConvertHDFData(int ndims, int* dims_out, T* hdfData);
29 
30  int GetNumberOfTimeSteps() { return this->NumberOfTimeSteps; }
31  double GetTimeStep(int step) { return this->TimeSteps[step]; }
32 
33  int GetNumberOfVariables() { return (int)this->VariableName.size(); }
34  const char* GetVariableName(int indx) { return this->VariableName[indx].c_str(); }
35 
36  int GetWholeExtent(int ext) { return this->WholeExtent[ext]; }
37  int GetSubExtent(int ext) { return this->SubExtent[ext]; }
38  int GetDimension(int dim) { return this->Dimension[dim]; }
39  double GetOrigin(int dim) { return this->Origin[dim]; }
40  double GetSpacing(int dim) { return this->Spacing[dim]; }
41 
42 protected:
43  // Collect the metadata
44  int CollectMetaData(const char* H5RageFileName);
45  int ParseH5RageFile(const char* H5RageFileName);
46  std::string TrimString(const std::string& str);
47 
48  // Used in parallel reader and load balancing
50  int Rank;
51  int TotalRank;
52 
53  // Time series of hdf files
54  std::vector<std::string> HdfFileName; // all hdf files
55 
56  // Time step information retrieved from hdf filenames
58  double* TimeSteps;
59 
60  // Geometry information for sharing data with other processors
62  int64_t* NumberOfTuples;
63 
64  int WholeExtent[6]; // Size of image
65  int SubExtent[6]; // Size of image this processor
66  int Dimension[3]; // Dimension of image
67  double Origin[3]; // Physical origin
68  double Spacing[3]; // Physical spacing
69 
71  int64_t TotalTuples;
72  bool UseFloat64;
73 
74  // Variable information retrieved from hdf filenames
76  std::vector<std::string> VariableName;
77 };
78 
79 VTK_ABI_NAMESPACE_END
80 #endif
81 
82 // VTK-HeaderTest-Exclude: H5RageAdaptor.h
double GetOrigin(int dim)
Definition: H5RageAdaptor.h:39
double * TimeSteps
Definition: H5RageAdaptor.h:58
int GetNumberOfTimeSteps()
Definition: H5RageAdaptor.h:30
double GetTimeStep(int step)
Definition: H5RageAdaptor.h:31
int GetNumberOfVariables()
Definition: H5RageAdaptor.h:33
int GetDimension(int dim)
Definition: H5RageAdaptor.h:38
int64_t TotalTuples
Definition: H5RageAdaptor.h:71
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
Store on/off settings for data arrays, etc.
double GetSpacing(int dim)
Definition: H5RageAdaptor.h:40
vtkMultiProcessController * Controller
Definition: H5RageAdaptor.h:49
int GetSubExtent(int ext)
Definition: H5RageAdaptor.h:37
int ** ExtentSchedule
Definition: H5RageAdaptor.h:61
const char * GetVariableName(int indx)
Definition: H5RageAdaptor.h:34
std::vector< std::string > HdfFileName
Definition: H5RageAdaptor.h:54
int NumberOfDimensions
Definition: H5RageAdaptor.h:70
int64_t * NumberOfTuples
Definition: H5RageAdaptor.h:62
int GetWholeExtent(int ext)
Definition: H5RageAdaptor.h:36
std::vector< std::string > VariableName
Definition: H5RageAdaptor.h:76
Multiprocessing communication superclass.