1 | /** |
---|
2 | * @file szf.c |
---|
3 | * @author Sheng Di |
---|
4 | * @date April, 2015 |
---|
5 | * @brief the key C binding file to connect Fortran and C |
---|
6 | * (C) 2015 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
7 | * See COPYRIGHT in top-level directory. |
---|
8 | */ |
---|
9 | |
---|
10 | |
---|
11 | #include <string.h> |
---|
12 | #include <stdio.h> |
---|
13 | #include <stdlib.h> |
---|
14 | #include "sz.h" |
---|
15 | #include "szf.h" |
---|
16 | |
---|
17 | //special notice: all the function names in this file must be lower-cases!! |
---|
18 | void sz_init_c_(char *configFile,int *len,int *ierr) |
---|
19 | { |
---|
20 | int i; |
---|
21 | char s2[*len+1]; |
---|
22 | for(i=0;i<*len;i++) |
---|
23 | s2[i]=configFile[i]; |
---|
24 | s2[*len]='\0'; |
---|
25 | // printf("sconfigFile=%s\n",configFile); |
---|
26 | *ierr = SZ_Init(s2); |
---|
27 | } |
---|
28 | |
---|
29 | void sz_finalize_c_() |
---|
30 | { |
---|
31 | SZ_Finalize(); |
---|
32 | } |
---|
33 | |
---|
34 | //compress with config (without args in function) |
---|
35 | void sz_compress_d1_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1) |
---|
36 | { |
---|
37 | unsigned char *tmp_bytes = SZ_compress(SZ_FLOAT, data, outSize, 0, 0, 0, 0, *r1); |
---|
38 | memcpy(bytes, tmp_bytes, *outSize); |
---|
39 | free(tmp_bytes); |
---|
40 | } |
---|
41 | |
---|
42 | void sz_compress_d1_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1) |
---|
43 | { |
---|
44 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_FLOAT, data, reservedValue, outSize, 0, 0, 0, 0, *r1); |
---|
45 | memcpy(bytes, tmp_bytes, *outSize); |
---|
46 | free(tmp_bytes); |
---|
47 | } |
---|
48 | |
---|
49 | void sz_compress_d2_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2) |
---|
50 | { |
---|
51 | unsigned char *tmp_bytes = SZ_compress(SZ_FLOAT, data, outSize, 0, 0, 0, *r2, *r1); |
---|
52 | memcpy(bytes, tmp_bytes, *outSize); |
---|
53 | free(tmp_bytes); |
---|
54 | } |
---|
55 | |
---|
56 | void sz_compress_d2_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2) |
---|
57 | { |
---|
58 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_FLOAT, data, reservedValue, outSize, 0, 0, 0, *r2, *r1); |
---|
59 | memcpy(bytes, tmp_bytes, *outSize); |
---|
60 | free(tmp_bytes); |
---|
61 | } |
---|
62 | |
---|
63 | void sz_compress_d3_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3) |
---|
64 | { |
---|
65 | unsigned char *tmp_bytes = SZ_compress(SZ_FLOAT, data, outSize, 0, 0, *r3, *r2, *r1); |
---|
66 | memcpy(bytes, tmp_bytes, *outSize); |
---|
67 | free(tmp_bytes); |
---|
68 | } |
---|
69 | |
---|
70 | void sz_compress_d3_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3) |
---|
71 | { |
---|
72 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_FLOAT, data, reservedValue, outSize, 0, 0, *r3, *r2, *r1); |
---|
73 | memcpy(bytes, tmp_bytes, *outSize); |
---|
74 | free(tmp_bytes); |
---|
75 | } |
---|
76 | |
---|
77 | void sz_compress_d4_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
78 | { |
---|
79 | unsigned char *tmp_bytes = SZ_compress(SZ_FLOAT, data, outSize, 0, *r4, *r3, *r2, *r1); |
---|
80 | memcpy(bytes, tmp_bytes, *outSize); |
---|
81 | free(tmp_bytes); |
---|
82 | } |
---|
83 | |
---|
84 | void sz_compress_d4_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
85 | { |
---|
86 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_FLOAT, data, reservedValue, outSize, 0, *r4, *r3, *r2, *r1); |
---|
87 | memcpy(bytes, tmp_bytes, *outSize); |
---|
88 | free(tmp_bytes); |
---|
89 | } |
---|
90 | |
---|
91 | void sz_compress_d5_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
92 | { |
---|
93 | unsigned char *tmp_bytes = SZ_compress(SZ_FLOAT, data, outSize, *r5, *r4, *r3, *r2, *r1); |
---|
94 | memcpy(bytes, tmp_bytes, *outSize); |
---|
95 | free(tmp_bytes); |
---|
96 | } |
---|
97 | |
---|
98 | void sz_compress_d5_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
99 | { |
---|
100 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_FLOAT, data, reservedValue, outSize, *r5, *r4, *r3, *r2, *r1); |
---|
101 | memcpy(bytes, tmp_bytes, *outSize); |
---|
102 | free(tmp_bytes); |
---|
103 | } |
---|
104 | |
---|
105 | void sz_compress_d1_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1) |
---|
106 | { |
---|
107 | unsigned char *tmp_bytes = SZ_compress(SZ_DOUBLE, data, outSize, 0, 0, 0, 0, *r1); |
---|
108 | memcpy(bytes, tmp_bytes, *outSize); |
---|
109 | free(tmp_bytes); |
---|
110 | } |
---|
111 | |
---|
112 | void sz_compress_d1_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1) |
---|
113 | { |
---|
114 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_DOUBLE, data, reservedValue, outSize, 0, 0, 0, 0, *r1); |
---|
115 | memcpy(bytes, tmp_bytes, *outSize); |
---|
116 | free(tmp_bytes); |
---|
117 | } |
---|
118 | |
---|
119 | void sz_compress_d2_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2) |
---|
120 | { |
---|
121 | unsigned char *tmp_bytes = SZ_compress(SZ_DOUBLE, data, outSize, 0, 0, 0, *r2, *r1); |
---|
122 | memcpy(bytes, tmp_bytes, *outSize); |
---|
123 | free(tmp_bytes); |
---|
124 | } |
---|
125 | |
---|
126 | void sz_compress_d2_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2) |
---|
127 | { |
---|
128 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_DOUBLE, data, reservedValue, outSize, 0, 0, 0, *r2, *r1); |
---|
129 | memcpy(bytes, tmp_bytes, *outSize); |
---|
130 | free(tmp_bytes); |
---|
131 | } |
---|
132 | |
---|
133 | void sz_compress_d3_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3) |
---|
134 | { |
---|
135 | unsigned char *tmp_bytes = SZ_compress(SZ_DOUBLE, data, outSize, 0, 0, *r3, *r2, *r1); |
---|
136 | memcpy(bytes, tmp_bytes, *outSize); |
---|
137 | free(tmp_bytes); |
---|
138 | } |
---|
139 | |
---|
140 | void sz_compress_d3_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3) |
---|
141 | { |
---|
142 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_DOUBLE, data, reservedValue, outSize, 0, 0, *r3, *r2, *r1); |
---|
143 | memcpy(bytes, tmp_bytes, *outSize); |
---|
144 | free(tmp_bytes); |
---|
145 | } |
---|
146 | |
---|
147 | void sz_compress_d4_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
148 | { |
---|
149 | unsigned char *tmp_bytes = SZ_compress(SZ_DOUBLE, data, outSize, 0, *r4, *r3, *r2, *r1); |
---|
150 | memcpy(bytes, tmp_bytes, *outSize); |
---|
151 | free(tmp_bytes); |
---|
152 | } |
---|
153 | |
---|
154 | void sz_compress_d4_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
155 | { |
---|
156 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_DOUBLE, data, reservedValue, outSize, 0, *r4, *r3, *r2, *r1); |
---|
157 | memcpy(bytes, tmp_bytes, *outSize); |
---|
158 | free(tmp_bytes); |
---|
159 | } |
---|
160 | |
---|
161 | void sz_compress_d5_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
162 | { |
---|
163 | unsigned char *tmp_bytes = SZ_compress(SZ_DOUBLE, data, outSize, *r5, *r4, *r3, *r2, *r1); |
---|
164 | memcpy(bytes, tmp_bytes, *outSize); |
---|
165 | free(tmp_bytes); |
---|
166 | } |
---|
167 | |
---|
168 | void sz_compress_d5_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
169 | { |
---|
170 | unsigned char *tmp_bytes = SZ_compress_rev(SZ_DOUBLE, data, reservedValue, outSize, *r5, *r4, *r3, *r2, *r1); |
---|
171 | memcpy(bytes, tmp_bytes, *outSize); |
---|
172 | free(tmp_bytes); |
---|
173 | } |
---|
174 | |
---|
175 | //compress with args |
---|
176 | |
---|
177 | void sz_compress_d1_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1) |
---|
178 | { |
---|
179 | unsigned char *tmp_bytes = SZ_compress_args(SZ_FLOAT, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, 0, 0, *r1); |
---|
180 | memcpy(bytes, tmp_bytes, *outSize); |
---|
181 | free(tmp_bytes); |
---|
182 | } |
---|
183 | |
---|
184 | void sz_compress_d2_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2) |
---|
185 | { |
---|
186 | unsigned char *tmp_bytes = SZ_compress_args(SZ_FLOAT, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, 0, *r2, *r1); |
---|
187 | memcpy(bytes, tmp_bytes, *outSize); |
---|
188 | free(tmp_bytes); |
---|
189 | } |
---|
190 | |
---|
191 | void sz_compress_d3_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
192 | { |
---|
193 | unsigned char *tmp_bytes = SZ_compress_args(SZ_FLOAT, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, *r3, *r2, *r1); |
---|
194 | memcpy(bytes, tmp_bytes, *outSize); |
---|
195 | free(tmp_bytes); |
---|
196 | } |
---|
197 | |
---|
198 | void sz_compress_d4_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
199 | { |
---|
200 | unsigned char *tmp_bytes = SZ_compress_args(SZ_FLOAT, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, *r4, *r3, *r2, *r1); |
---|
201 | memcpy(bytes, tmp_bytes, *outSize); |
---|
202 | free(tmp_bytes); |
---|
203 | } |
---|
204 | |
---|
205 | void sz_compress_d5_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
206 | { |
---|
207 | unsigned char *tmp_bytes = SZ_compress_args(SZ_FLOAT, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, *r5, *r4, *r3, *r2, *r1); |
---|
208 | memcpy(bytes, tmp_bytes, *outSize); |
---|
209 | free(tmp_bytes); |
---|
210 | } |
---|
211 | |
---|
212 | void sz_compress_d1_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1) |
---|
213 | { |
---|
214 | unsigned char *tmp_bytes = SZ_compress_args(SZ_DOUBLE, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, 0, 0, *r1); |
---|
215 | memcpy(bytes, tmp_bytes, *outSize); |
---|
216 | free(tmp_bytes); |
---|
217 | } |
---|
218 | |
---|
219 | void sz_compress_d2_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2) |
---|
220 | { |
---|
221 | unsigned char *tmp_bytes = SZ_compress_args(SZ_DOUBLE, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, 0, *r2, *r1); |
---|
222 | memcpy(bytes, tmp_bytes, *outSize); |
---|
223 | free(tmp_bytes); |
---|
224 | } |
---|
225 | |
---|
226 | void sz_compress_d3_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
227 | { |
---|
228 | unsigned char *tmp_bytes = SZ_compress_args(SZ_DOUBLE, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, 0, *r3, *r2, *r1); |
---|
229 | memcpy(bytes, tmp_bytes, *outSize); |
---|
230 | free(tmp_bytes); |
---|
231 | } |
---|
232 | |
---|
233 | void sz_compress_d4_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
234 | { |
---|
235 | unsigned char *tmp_bytes = SZ_compress_args(SZ_DOUBLE, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, 0, *r4, *r3, *r2, *r1); |
---|
236 | memcpy(bytes, tmp_bytes, *outSize); |
---|
237 | free(tmp_bytes); |
---|
238 | } |
---|
239 | |
---|
240 | void sz_compress_d5_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
241 | { |
---|
242 | unsigned char *tmp_bytes = SZ_compress_args(SZ_DOUBLE, data, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0.1, 1, *r5, *r4, *r3, *r2, *r1); |
---|
243 | memcpy(bytes, tmp_bytes, *outSize); |
---|
244 | free(tmp_bytes); |
---|
245 | } |
---|
246 | |
---|
247 | //-------------- |
---|
248 | |
---|
249 | void sz_compress_d1_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1) |
---|
250 | { |
---|
251 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_FLOAT, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, 0, *r1); |
---|
252 | memcpy(bytes, tmp_bytes, *outSize); |
---|
253 | free(tmp_bytes); |
---|
254 | } |
---|
255 | |
---|
256 | void sz_compress_d2_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2) |
---|
257 | { |
---|
258 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_FLOAT, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, *r2, *r1); |
---|
259 | memcpy(bytes, tmp_bytes, *outSize); |
---|
260 | free(tmp_bytes); |
---|
261 | } |
---|
262 | |
---|
263 | void sz_compress_d3_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
264 | { |
---|
265 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_FLOAT, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, *r3, *r2, *r1); |
---|
266 | memcpy(bytes, tmp_bytes, *outSize); |
---|
267 | free(tmp_bytes); |
---|
268 | } |
---|
269 | |
---|
270 | void sz_compress_d4_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
271 | { |
---|
272 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_FLOAT, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, *r4, *r3, *r2, *r1); |
---|
273 | memcpy(bytes, tmp_bytes, *outSize); |
---|
274 | free(tmp_bytes); |
---|
275 | } |
---|
276 | |
---|
277 | void sz_compress_d5_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
278 | { |
---|
279 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_FLOAT, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, *r5, *r4, *r3, *r2, *r1); |
---|
280 | memcpy(bytes, tmp_bytes, *outSize); |
---|
281 | free(tmp_bytes); |
---|
282 | } |
---|
283 | |
---|
284 | void sz_compress_d1_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1) |
---|
285 | { |
---|
286 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_DOUBLE, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, 0, *r1); |
---|
287 | memcpy(bytes, tmp_bytes, *outSize); |
---|
288 | free(tmp_bytes); |
---|
289 | } |
---|
290 | |
---|
291 | void sz_compress_d2_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2) |
---|
292 | { |
---|
293 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_DOUBLE, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, *r2, *r1); |
---|
294 | memcpy(bytes, tmp_bytes, *outSize); |
---|
295 | free(tmp_bytes); |
---|
296 | } |
---|
297 | |
---|
298 | void sz_compress_d3_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
299 | { |
---|
300 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_DOUBLE, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, *r3, *r2, *r1); |
---|
301 | memcpy(bytes, tmp_bytes, *outSize); |
---|
302 | } |
---|
303 | |
---|
304 | void sz_compress_d4_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
305 | { |
---|
306 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_DOUBLE, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, 0, *r4, *r3, *r2, *r1); |
---|
307 | memcpy(bytes, tmp_bytes, *outSize); |
---|
308 | free(tmp_bytes); |
---|
309 | } |
---|
310 | |
---|
311 | void sz_compress_d5_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
312 | { |
---|
313 | unsigned char *tmp_bytes = SZ_compress_rev_args(SZ_DOUBLE, data, reservedValue, outSize, *errBoundMode, *absErrBound, *relBoundRatio, *r5, *r4, *r3, *r2, *r1); |
---|
314 | memcpy(bytes, tmp_bytes, *outSize); |
---|
315 | free(tmp_bytes); |
---|
316 | } |
---|
317 | |
---|
318 | //decompress |
---|
319 | |
---|
320 | void sz_decompress_d1_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1) |
---|
321 | { |
---|
322 | float *tmp_data = SZ_decompress(SZ_FLOAT, bytes, *byteLength, 0, 0, 0, 0, *r1); |
---|
323 | memcpy(data, tmp_data, (*r1)*sizeof(float)); |
---|
324 | free(tmp_data); |
---|
325 | } |
---|
326 | |
---|
327 | void sz_decompress_d2_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2) |
---|
328 | { |
---|
329 | size_t r; |
---|
330 | float *tmp_data = SZ_decompress(SZ_FLOAT, bytes, *byteLength, 0, 0, 0, *r2, *r1); |
---|
331 | r=(*r1)*(*r2); |
---|
332 | memcpy(data, tmp_data, r*sizeof(float)); |
---|
333 | free(tmp_data); |
---|
334 | } |
---|
335 | |
---|
336 | void sz_decompress_d3_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3) |
---|
337 | { |
---|
338 | size_t r; |
---|
339 | float *tmp_data = SZ_decompress(SZ_FLOAT, bytes, *byteLength, 0, 0, *r3, *r2, *r1); |
---|
340 | r=(*r1)*(*r2)*(*r3); |
---|
341 | memcpy(data, tmp_data, r*sizeof(float)); |
---|
342 | free(tmp_data); |
---|
343 | } |
---|
344 | |
---|
345 | void sz_decompress_d4_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
346 | { |
---|
347 | size_t r; |
---|
348 | float *tmp_data = SZ_decompress(SZ_FLOAT, bytes, *byteLength, 0, *r4, *r3, *r2, *r1); |
---|
349 | r=(*r1)*(*r2)*(*r3)*(*r4); |
---|
350 | memcpy(data, tmp_data, r*sizeof(float)); |
---|
351 | free(tmp_data); |
---|
352 | } |
---|
353 | |
---|
354 | void sz_decompress_d5_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
355 | { |
---|
356 | size_t r; |
---|
357 | float *tmp_data = SZ_decompress(SZ_FLOAT, bytes, *byteLength, *r5, *r4, *r3, *r2, *r1); |
---|
358 | r=(*r1)*(*r2)*(*r3)*(*r4)*(*r5); |
---|
359 | memcpy(data, tmp_data, r*sizeof(float)); |
---|
360 | free(tmp_data); |
---|
361 | } |
---|
362 | |
---|
363 | void sz_decompress_d1_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1) |
---|
364 | { |
---|
365 | double *tmp_data = SZ_decompress(SZ_DOUBLE, bytes, *byteLength, 0, 0, 0, 0, *r1); |
---|
366 | memcpy(data, tmp_data, (*r1)*sizeof(double)); |
---|
367 | free(tmp_data); |
---|
368 | } |
---|
369 | |
---|
370 | void sz_decompress_d2_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2) |
---|
371 | { |
---|
372 | size_t r; |
---|
373 | double *tmp_data = SZ_decompress(SZ_DOUBLE, bytes, *byteLength, 0, 0, 0, *r2, *r1); |
---|
374 | r=(*r1)*(*r2); |
---|
375 | memcpy(data, tmp_data, r*sizeof(double)); |
---|
376 | free(tmp_data); |
---|
377 | } |
---|
378 | |
---|
379 | void sz_decompress_d3_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3) |
---|
380 | { |
---|
381 | size_t r; |
---|
382 | double *tmp_data = SZ_decompress(SZ_DOUBLE, bytes, *byteLength, 0, 0, *r3, *r2, *r1); |
---|
383 | r=(*r1)*(*r2)*(*r3); |
---|
384 | memcpy(data, tmp_data, r*sizeof(double)); |
---|
385 | free(tmp_data); |
---|
386 | } |
---|
387 | |
---|
388 | void sz_decompress_d4_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
389 | { |
---|
390 | size_t r; |
---|
391 | double *tmp_data = SZ_decompress(SZ_DOUBLE, bytes, *byteLength, 0, *r4, *r3, *r2, *r1); |
---|
392 | r=(*r1)*(*r2)*(*r3)*(*r4); |
---|
393 | memcpy(data, tmp_data, r*sizeof(double)); |
---|
394 | free(tmp_data); |
---|
395 | } |
---|
396 | |
---|
397 | void sz_decompress_d5_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
398 | { |
---|
399 | size_t r; |
---|
400 | double *tmp_data = SZ_decompress(SZ_DOUBLE, bytes, *byteLength, *r5, *r4, *r3, *r2, *r1); |
---|
401 | r=(*r1)*(*r2)*(*r3)*(*r4)*(*r5); |
---|
402 | memcpy(data, tmp_data, r*sizeof(double)); |
---|
403 | free(tmp_data); |
---|
404 | } |
---|
405 | |
---|
406 | //-----------------TODO: batch mode----------- |
---|
407 | void sz_batchaddvar_d1_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1) |
---|
408 | { |
---|
409 | int i; |
---|
410 | char s2[*len+1]; |
---|
411 | for(i=0;i<*len;i++) |
---|
412 | s2[i]=varName[i]; |
---|
413 | s2[*len]='\0'; |
---|
414 | SZ_batchAddVar(s2, SZ_FLOAT, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, 0, *r1); |
---|
415 | } |
---|
416 | void sz_batchaddvar_d2_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2) |
---|
417 | { |
---|
418 | int i; |
---|
419 | char s2[*len+1]; |
---|
420 | for(i=0;i<*len;i++) |
---|
421 | s2[i]=varName[i]; |
---|
422 | s2[*len]='\0'; |
---|
423 | SZ_batchAddVar(s2, SZ_FLOAT, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, *r2, *r1); |
---|
424 | } |
---|
425 | void sz_batchaddvar_d3_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
426 | { |
---|
427 | int i; |
---|
428 | char s2[*len+1]; |
---|
429 | for(i=0;i<*len;i++) |
---|
430 | s2[i]=varName[i]; |
---|
431 | s2[*len]='\0'; |
---|
432 | SZ_batchAddVar(s2, SZ_FLOAT, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, *r3, *r2, *r1); |
---|
433 | } |
---|
434 | void sz_batchaddvar_d4_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
435 | { |
---|
436 | int i; |
---|
437 | char s2[*len+1]; |
---|
438 | for(i=0;i<*len;i++) |
---|
439 | s2[i]=varName[i]; |
---|
440 | s2[*len]='\0'; |
---|
441 | SZ_batchAddVar(s2, SZ_FLOAT, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, *r4, *r3, *r2, *r1); |
---|
442 | } |
---|
443 | void sz_batchaddvar_d5_float_(char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
444 | { |
---|
445 | int i; |
---|
446 | char s2[*len+1]; |
---|
447 | for(i=0;i<*len;i++) |
---|
448 | s2[i]=varName[i]; |
---|
449 | s2[*len]='\0'; |
---|
450 | SZ_batchAddVar(s2, SZ_FLOAT, data, *errBoundMode, *absErrBound, *relBoundRatio, *r5, *r4, *r3, *r2, *r1); |
---|
451 | } |
---|
452 | void sz_batchaddvar_d1_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1) |
---|
453 | { |
---|
454 | int i; |
---|
455 | char s2[*len+1]; |
---|
456 | for(i=0;i<*len;i++) |
---|
457 | s2[i]=varName[i]; |
---|
458 | s2[*len]='\0'; |
---|
459 | SZ_batchAddVar(s2, SZ_DOUBLE, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, 0, *r1); |
---|
460 | } |
---|
461 | void sz_batchaddvar_d2_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2) |
---|
462 | { |
---|
463 | int i; |
---|
464 | char s2[*len+1]; |
---|
465 | for(i=0;i<*len;i++) |
---|
466 | s2[i]=varName[i]; |
---|
467 | s2[*len]='\0'; |
---|
468 | SZ_batchAddVar(s2, SZ_DOUBLE, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, 0, *r2, *r1); |
---|
469 | } |
---|
470 | void sz_batchaddvar_d3_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3) |
---|
471 | { |
---|
472 | int i; |
---|
473 | char s2[*len+1]; |
---|
474 | for(i=0;i<*len;i++) |
---|
475 | s2[i]=varName[i]; |
---|
476 | s2[*len]='\0'; |
---|
477 | SZ_batchAddVar(s2, SZ_DOUBLE, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, 0, *r3, *r2, *r1); |
---|
478 | } |
---|
479 | void sz_batchaddvar_d4_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4) |
---|
480 | { |
---|
481 | int i; |
---|
482 | char s2[*len+1]; |
---|
483 | for(i=0;i<*len;i++) |
---|
484 | s2[i]=varName[i]; |
---|
485 | s2[*len]='\0'; |
---|
486 | SZ_batchAddVar(s2, SZ_DOUBLE, data, *errBoundMode, *absErrBound, *relBoundRatio, 0, *r4, *r3, *r2, *r1); |
---|
487 | } |
---|
488 | void sz_batchaddvar_d5_double_(char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
489 | { |
---|
490 | int i; |
---|
491 | char s2[*len+1]; |
---|
492 | for(i=0;i<*len;i++) |
---|
493 | s2[i]=varName[i]; |
---|
494 | s2[*len]='\0'; |
---|
495 | SZ_batchAddVar(s2, SZ_DOUBLE, data, *errBoundMode, *absErrBound, *relBoundRatio, *r5, *r4, *r3, *r2, *r1); |
---|
496 | } |
---|
497 | void sz_batchdelvar_c_(char* varName, int *len, int *errState) |
---|
498 | { |
---|
499 | int i; |
---|
500 | char s2[*len+1]; |
---|
501 | for(i=0;i<*len;i++) |
---|
502 | s2[i]=varName[i]; |
---|
503 | s2[*len]='\0'; |
---|
504 | *errState = SZ_batchDelVar(s2); |
---|
505 | } |
---|
506 | void sz_batch_compress_c_(unsigned char* bytes, size_t *outSize) |
---|
507 | { |
---|
508 | unsigned char* tmp_bytes = SZ_batch_compress(outSize); |
---|
509 | memcpy(bytes, tmp_bytes, *outSize); |
---|
510 | free(tmp_bytes); |
---|
511 | } |
---|
512 | void sz_batch_decompress_c_(unsigned char* bytes, size_t *byteLength, int *ierr) |
---|
513 | { |
---|
514 | SZ_batch_decompress(bytes, *byteLength, ierr); |
---|
515 | } |
---|
516 | |
---|
517 | void sz_getvardim_c_(char* varName, int *len, int *dim, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5) |
---|
518 | { |
---|
519 | int i; |
---|
520 | char s2[*len+1]; |
---|
521 | for(i=0;i<*len;i++) |
---|
522 | s2[i]=varName[i]; |
---|
523 | s2[*len]='\0'; |
---|
524 | |
---|
525 | SZ_getVarData(s2, r5, r4, r3, r2, r1); |
---|
526 | *dim = computeDimension(*r5, *r4, *r3, *r2, *r1); |
---|
527 | } |
---|
528 | |
---|
529 | void compute_total_batch_size_c_(size_t *totalSize) |
---|
530 | { |
---|
531 | *totalSize = compute_total_batch_size(); |
---|
532 | } |
---|
533 | |
---|
534 | void sz_getvardata_float_(char* varName, int *len, float* data) |
---|
535 | { |
---|
536 | int i; |
---|
537 | size_t r1, r2, r3, r4, r5; |
---|
538 | char s2[*len+1]; |
---|
539 | for(i=0;i<*len;i++) |
---|
540 | s2[i]=varName[i]; |
---|
541 | s2[*len]='\0'; |
---|
542 | |
---|
543 | float* tmp_data = (float*)SZ_getVarData(s2, &r5, &r4, &r3, &r2, &r1); |
---|
544 | int size = computeDataLength(r5, r4, r3, r2, r1); |
---|
545 | memcpy(data, tmp_data, size*sizeof(float)); |
---|
546 | free(tmp_data); |
---|
547 | } |
---|
548 | void sz_getvardata_double_(char* varName, int *len, double* data) |
---|
549 | { |
---|
550 | int i; |
---|
551 | size_t r1, r2, r3, r4, r5; |
---|
552 | char s2[*len+1]; |
---|
553 | for(i=0;i<*len;i++) |
---|
554 | s2[i]=varName[i]; |
---|
555 | s2[*len]='\0'; |
---|
556 | |
---|
557 | double* tmp_data = (double*)SZ_getVarData(s2, &r5, &r4, &r3, &r2, &r1); |
---|
558 | int size = computeDataLength(r5, r4, r3, r2, r1); |
---|
559 | memcpy(data, tmp_data, size*sizeof(double)); |
---|
560 | //free(tmp_data); |
---|
561 | } |
---|
562 | |
---|
563 | void sz_freevarset_c_(int *mode) |
---|
564 | { |
---|
565 | SZ_freeVarSet(*mode); |
---|
566 | } |
---|
567 | |
---|