#include "./opaque_object_h5.hpp" namespace triqs { namespace utility { std::map> _object::code_to_deserialization_fnts; std::map> _object::code_to_h5_read_fnts; std::map _object::h5_type_to_c_equivalence; std::map, size_t > _object::code_element_rank_to_code_array; std::map _object::h5_scheme_to_code; std::map _object::type_code_to_type_name; std::map _object::type_name_to_type_code; bool _object::initialized = false; //----------------------------------------------------------------------- void _object::_init() { if (initialized) return; #define REGISTER_UNSERIALIZE_FUN(r, data, T) _object::register_native_type(); BOOST_PP_SEQ_FOR_EACH(REGISTER_UNSERIALIZE_FUN, nil , TRIQS_UTIL_OPAQUE_OBJECT_PREDEFINED_CAST); #undef REGISTER_UNSERIALIZE_FUN initialized = true; } //----------------------------------------------------------------------- void h5_read ( h5::group g, std::string const & name, _object & obj){ //std::cerr << " read object "<< name << std::endl ; using namespace H5; if (!g.has_key(name)) TRIQS_RUNTIME_ERROR << "no such "<() : _object::h5_scheme_to_code[triqs_data_scheme]; } else if ((H5Tget_class(dtype) == H5T_INTEGER ) || ((H5Tget_class(dtype) == H5T_FLOAT ) )) { int rank = ds.getSpace().getSimpleExtentNdims(); auto it = _object::h5_type_to_c_equivalence.begin(); for (;it != _object::h5_type_to_c_equivalence.end();++it) { if (H5Tequal(native_type, it->first)) break;} if (it == _object::h5_type_to_c_equivalence.end()) TRIQS_RUNTIME_ERROR << " h5_type_to_c_equivalence : type not found"; type_hash = it->second; if (rank>0) { size_t type_hash_element = type_hash; auto it2= _object::code_element_rank_to_code_array.find(std::make_pair(type_hash_element,rank)); if (it2 == _object::code_element_rank_to_code_array.end()) TRIQS_RUNTIME_ERROR << " code_element_rank_to_code_array : type not found" << rank; type_hash = it2->second; } } //else if (H5Tget_class(dtype)==H5T_ARRAY) herr_t status = H5Tclose (native_type); status = H5Tclose (dtype); } TRIQS_ARRAYS_H5_CATCH_EXCEPTION; obj = _object::code_to_h5_read_fnts[type_hash](g,name); } }}