@@ -81,28 +81,32 @@ char* bsp_generate_json(bsp_matrix_t matrix, cJSON* user_json) {
8181 return string ;
8282}
8383
84- int bsp_write_matrix_to_group (hid_t f , bsp_matrix_t matrix , cJSON * user_json ) {
85- int result = bsp_write_array (f , "values" , matrix .values );
84+ int bsp_write_matrix_to_group (hid_t f , bsp_matrix_t matrix , cJSON * user_json ,
85+ int compression_level ) {
86+ int result = bsp_write_array (f , "values" , matrix .values , compression_level );
8687
8788 if (result != 0 )
8889 return result ;
8990
9091 if (matrix .indices_0 .size > 0 ) {
91- result = bsp_write_array (f , "indices_0" , matrix .indices_0 );
92+ result =
93+ bsp_write_array (f , "indices_0" , matrix .indices_0 , compression_level );
9294 if (result != 0 ) {
9395 return result ;
9496 }
9597 }
9698
9799 if (matrix .indices_1 .size > 0 ) {
98- result = bsp_write_array (f , "indices_1" , matrix .indices_1 );
100+ result =
101+ bsp_write_array (f , "indices_1" , matrix .indices_1 , compression_level );
99102 if (result != 0 ) {
100103 return result ;
101104 }
102105 }
103106
104107 if (matrix .pointers_to_1 .size > 0 ) {
105- result = bsp_write_array (f , "pointers_to_1" , matrix .pointers_to_1 );
108+ result = bsp_write_array (f , "pointers_to_1" , matrix .pointers_to_1 ,
109+ compression_level );
106110 if (result != 0 ) {
107111 return result ;
108112 }
@@ -117,10 +121,10 @@ int bsp_write_matrix_to_group(hid_t f, bsp_matrix_t matrix, cJSON* user_json) {
117121}
118122
119123int bsp_write_matrix (char * fname , bsp_matrix_t matrix , char * group ,
120- cJSON * user_json ) {
124+ cJSON * user_json , int compression_level ) {
121125 if (group == NULL ) {
122126 hid_t f = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT );
123- bsp_write_matrix_to_group (f , matrix , user_json );
127+ bsp_write_matrix_to_group (f , matrix , user_json , compression_level );
124128 H5Fclose (f );
125129 } else {
126130 hid_t f ;
@@ -130,7 +134,7 @@ int bsp_write_matrix(char* fname, bsp_matrix_t matrix, char* group,
130134 f = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT );
131135 }
132136 hid_t g = H5Gcreate1 (f , group , H5P_DEFAULT );
133- bsp_write_matrix_to_group (g , matrix , user_json );
137+ bsp_write_matrix_to_group (g , matrix , user_json , compression_level );
134138 H5Gclose (g );
135139 H5Fclose (f );
136140 }
0 commit comments