@@ -81,28 +81,32 @@ char* bsp_generate_json(bsp_matrix_t matrix, cJSON* user_json) {
81
81
return string ;
82
82
}
83
83
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 );
86
87
87
88
if (result != 0 )
88
89
return result ;
89
90
90
91
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 );
92
94
if (result != 0 ) {
93
95
return result ;
94
96
}
95
97
}
96
98
97
99
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 );
99
102
if (result != 0 ) {
100
103
return result ;
101
104
}
102
105
}
103
106
104
107
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 );
106
110
if (result != 0 ) {
107
111
return result ;
108
112
}
@@ -117,10 +121,10 @@ int bsp_write_matrix_to_group(hid_t f, bsp_matrix_t matrix, cJSON* user_json) {
117
121
}
118
122
119
123
int bsp_write_matrix (char * fname , bsp_matrix_t matrix , char * group ,
120
- cJSON * user_json ) {
124
+ cJSON * user_json , int compression_level ) {
121
125
if (group == NULL ) {
122
126
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 );
124
128
H5Fclose (f );
125
129
} else {
126
130
hid_t f ;
@@ -130,7 +134,7 @@ int bsp_write_matrix(char* fname, bsp_matrix_t matrix, char* group,
130
134
f = H5Fcreate (fname , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT );
131
135
}
132
136
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 );
134
138
H5Gclose (g );
135
139
H5Fclose (f );
136
140
}
0 commit comments