moab
|
00001 00006 #ifndef moab_READ_HDF5_VAR_LEN_HPP 00007 #define moab_READ_HDF5_VAR_LEN_HPP 00008 00009 #ifdef USE_MPI 00010 # include "moab_mpi.h" 00011 #endif 00012 #include "DebugOutput.hpp" 00013 #include "moab/Range.hpp" 00014 #include "H5Ipublic.h" 00015 00016 namespace moab { 00017 00018 class ReadHDF5Dataset; 00019 00030 class ReadHDF5VarLen { 00031 protected: 00032 DebugOutput& dbgOut; 00033 private: 00034 void* const dataBuffer; 00035 const size_t bufferSize; 00036 00040 static bool is_ranged( EntityHandle file_id, 00041 Range::const_iterator& ranged_iter, 00042 Range::const_iterator ranged_end ); 00043 protected: 00044 00059 virtual ErrorCode store_data( EntityHandle file_id, 00060 void* data, 00061 long num_data, 00062 bool ranged ) = 0; 00063 00064 public: 00069 ReadHDF5VarLen( DebugOutput& debug_output, 00070 void* buffer, 00071 size_t buffer_size ) 00072 : dbgOut( debug_output ), 00073 dataBuffer( buffer ), 00074 bufferSize( buffer_size ) 00075 {} 00076 00077 virtual ~ReadHDF5VarLen() {} 00078 00089 ErrorCode read_data( ReadHDF5Dataset& data_set, 00090 const Range& offsets, 00091 EntityHandle start_offset, 00092 hid_t data_type, 00093 const Range& file_ids, 00094 const std::vector<unsigned>& vals_per_ent, 00095 const Range& ranged_file_ids ); 00096 00121 /* 00122 ErrorCode read_offsets( ReadHDF5Dataset& data_set, 00123 const Range& file_ids, 00124 EntityHandle start_file_id, 00125 unsigned num_columns, 00126 const unsigned indices[], 00127 EntityHandle nudge, 00128 Range offsets_out[], 00129 std::vector<unsigned> counts_out[], 00130 Range* ranged_file_ids = 0 ); 00131 */ 00132 ErrorCode read_offsets( ReadHDF5Dataset& data_set, 00133 const Range& file_ids, 00134 EntityHandle start_file_id, 00135 EntityHandle nudge, 00136 Range& offsets_out, 00137 std::vector<unsigned>& counts_out ); 00138 00139 ErrorCode read( ReadHDF5Dataset& offset_data, 00140 ReadHDF5Dataset& value_data, 00141 const Range& file_ids, 00142 EntityHandle start_file_id, 00143 hid_t data_type, 00144 const Range* ranged = 0 ) 00145 { 00146 ErrorCode rval; 00147 const EntityHandle nudge = 1; 00148 Range offsets; 00149 std::vector<unsigned> counts; 00150 rval = read_offsets( offset_data, file_ids, 00151 start_file_id, nudge, 00152 offsets, counts ); 00153 if (MB_SUCCESS != rval) 00154 return rval; 00155 Range empty; 00156 rval = read_data( value_data, 00157 offsets, nudge, data_type, 00158 file_ids, counts, ranged ? *ranged : empty ); 00159 return rval; 00160 } 00161 }; 00162 00163 } // namespace moab 00164 00165 #endif // moab_READ_HDF5_VAR_LEN_HPP