void mhdf_openPolyConnectivity( mhdf_FileHandle file_handle, const char* element_handle, long* num_poly_out, long* data_list_length_out, long* first_poly_id_out, hid_t handles_out[2], mhdf_Status* status ) { FileHandle* file_ptr; hid_t elem_id, table_id, index_id; hsize_t row_count; API_BEGIN; file_ptr = (FileHandle*)(file_handle); if (!mhdf_check_valid_file( file_ptr, status )) return ; if (!num_poly_out || !data_list_length_out || !first_poly_id_out) { mhdf_setFail( status, "Invalid argument." ); return ; } elem_id = mhdf_elem_group_from_handle( file_ptr, element_handle, status ); if (elem_id < 0) return ; index_id = mhdf_open_table( elem_id, POLY_INDEX_NAME, 1, &row_count, status ); if (index_id < 0) { H5Gclose(elem_id); return ; } *num_poly_out = (int)row_count; table_id = mhdf_open_table( elem_id, CONNECTIVITY_NAME, 1, &row_count, status ); H5Gclose( elem_id ); if (table_id < 0) { H5Dclose( index_id ); return ; } *data_list_length_out = (long)row_count; if (!mhdf_read_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, first_poly_id_out, status )) { H5Dclose( table_id ); H5Dclose( index_id ); return ; } file_ptr->open_handle_count++; handles_out[0] = index_id; handles_out[1] = table_id; mhdf_setOkay( status ); API_END_H(2); }
hid_t mhdf_openAdjacency( mhdf_FileHandle file, const char* elem_handle, long* adj_list_size_out, mhdf_Status* status ) { FileHandle* file_ptr; hid_t elem_id, table_id; hsize_t dim; API_BEGIN; file_ptr = (FileHandle*)(file); if (!mhdf_check_valid_file( file_ptr, status )) return -1; if (!adj_list_size_out) { mhdf_setFail( status, "Invalid argument.\n" ); return -1; } if (elem_handle == mhdf_node_type_handle()) { table_id = mhdf_open_table( file_ptr->hdf_handle, NODE_ADJCY_PATH, 1, &dim, status ); } else { elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status ); if (elem_id < 0) return -1; table_id = mhdf_open_table( elem_id, ADJACENCY_NAME, 1, &dim, status ); H5Gclose( elem_id ); } *adj_list_size_out = (long)dim; API_END_H(1); return table_id; }