Loading src/libnptm/file_io.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ HDFFile* HDFFile::from_schema( herr_t status; string *rec_types = schema.get_record_types(); string *rec_names = schema.get_record_names(); string known_types[] = {"INT32", "FLOAT64"}; string known_types[] = {"INT32", "FLOAT64", "COMPLEX128"}; int rec_num = schema.get_record_number(); regex re; smatch m; Loading @@ -99,8 +99,9 @@ HDFFile* HDFFile::from_schema( str_target = m.suffix().str(); if (type_index == 1) data_type = H5Tcopy(H5T_NATIVE_INT); else if (type_index == 2) data_type = H5Tcopy(H5T_NATIVE_DOUBLE); else if (type_index == 3) data_type = H5Tcopy(H5T_NATIVE_DOUBLE); } if (type_index == 2) break; if (type_index == 3) break; } if (found_type) { re = regex("[0-9]+"); Loading @@ -119,6 +120,9 @@ HDFFile* HDFFile::from_schema( max_dims[ti] = dim; str_target = m.suffix().str(); } int multiplier = (type_index == 3) ? 2 : 1; dims[rank - 1] *= multiplier; max_dims[rank - 1] *= multiplier; hid_t dataspace_id = H5Screate_simple(rank, dims, max_dims); hid_t dataset_id = H5Dcreate( file_id, rec_names[ri].c_str(), data_type, dataspace_id, H5P_DEFAULT, Loading Loading @@ -183,7 +187,7 @@ herr_t HDFFile::write( hid_t mem_space_id, hid_t file_space_id, hid_t dapl_id, hid_t dxpl_id ) { string known_types[] = {"INT32", "FLOAT64"}; string known_types[] = {"INT32", "FLOAT64", "COMPLEX128"}; regex re; smatch m; bool found_type = false; Loading @@ -191,7 +195,7 @@ herr_t HDFFile::write( while (!found_type) { re = regex(known_types[type_index++]); found_type = regex_search(data_type, m, re); if (type_index == 2) break; if (type_index == 3) break; } if (found_type) { hid_t dataset_id = H5Dopen2(file_id, dataset_name.c_str(), dapl_id); Loading @@ -201,6 +205,8 @@ herr_t HDFFile::write( mem_type_id = H5T_NATIVE_INT; break; case 2: mem_type_id = H5T_NATIVE_DOUBLE; break; case 3: mem_type_id = H5T_NATIVE_DOUBLE; break; default: throw UnrecognizedParameterException("unrecognized data type \"" + data_type + "\""); } Loading Loading
src/libnptm/file_io.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ HDFFile* HDFFile::from_schema( herr_t status; string *rec_types = schema.get_record_types(); string *rec_names = schema.get_record_names(); string known_types[] = {"INT32", "FLOAT64"}; string known_types[] = {"INT32", "FLOAT64", "COMPLEX128"}; int rec_num = schema.get_record_number(); regex re; smatch m; Loading @@ -99,8 +99,9 @@ HDFFile* HDFFile::from_schema( str_target = m.suffix().str(); if (type_index == 1) data_type = H5Tcopy(H5T_NATIVE_INT); else if (type_index == 2) data_type = H5Tcopy(H5T_NATIVE_DOUBLE); else if (type_index == 3) data_type = H5Tcopy(H5T_NATIVE_DOUBLE); } if (type_index == 2) break; if (type_index == 3) break; } if (found_type) { re = regex("[0-9]+"); Loading @@ -119,6 +120,9 @@ HDFFile* HDFFile::from_schema( max_dims[ti] = dim; str_target = m.suffix().str(); } int multiplier = (type_index == 3) ? 2 : 1; dims[rank - 1] *= multiplier; max_dims[rank - 1] *= multiplier; hid_t dataspace_id = H5Screate_simple(rank, dims, max_dims); hid_t dataset_id = H5Dcreate( file_id, rec_names[ri].c_str(), data_type, dataspace_id, H5P_DEFAULT, Loading Loading @@ -183,7 +187,7 @@ herr_t HDFFile::write( hid_t mem_space_id, hid_t file_space_id, hid_t dapl_id, hid_t dxpl_id ) { string known_types[] = {"INT32", "FLOAT64"}; string known_types[] = {"INT32", "FLOAT64", "COMPLEX128"}; regex re; smatch m; bool found_type = false; Loading @@ -191,7 +195,7 @@ herr_t HDFFile::write( while (!found_type) { re = regex(known_types[type_index++]); found_type = regex_search(data_type, m, re); if (type_index == 2) break; if (type_index == 3) break; } if (found_type) { hid_t dataset_id = H5Dopen2(file_id, dataset_name.c_str(), dapl_id); Loading @@ -201,6 +205,8 @@ herr_t HDFFile::write( mem_type_id = H5T_NATIVE_INT; break; case 2: mem_type_id = H5T_NATIVE_DOUBLE; break; case 3: mem_type_id = H5T_NATIVE_DOUBLE; break; default: throw UnrecognizedParameterException("unrecognized data type \"" + data_type + "\""); } Loading