source: thirdparty/SZ/sz/src/sz_interface.F90 @ 2c47b73

Revision 2c47b73, 40.9 KB checked in by Hal Finkel <hfinkel@…>, 6 years ago (diff)

more work on adding SZ (latest version)

  • Property mode set to 100644
Line 
1!  @file   sz_interface.F90
2!  @author Sheng Di ([email protected] or [email protected])
3!  @date   June, 2016
4!  @ Mathematics and Computer Science (MCS)
5!  @ Argonne National Laboratory, Lemont, USA.
6!  @brief  The key Fortran binding file to connect C language and Fortran (Fortran part)
7
8
9MODULE SZ
10        use :: ISO_C_BINDING
11        INTERFACE SZ_Compress
12                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K4
13                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K4
14                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K4
15                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K4
16                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K4         
17                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K4_ARGS
18                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K4_ARGS
19                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K4_ARGS
20                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K4_ARGS
21                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K4_ARGS
22                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K8
23                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K8
24                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K8
25                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K8
26                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K8
27                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K8_ARGS
28                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K8_ARGS
29                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K8_ARGS
30                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K8_ARGS
31                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K8_ARGS
32                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K4_Rev
33                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K4_Rev
34                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K4_Rev
35                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K4_Rev
36                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K4_Rev     
37                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K4_ARGS_Rev
38                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K4_ARGS_Rev
39                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K4_ARGS_Rev
40                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K4_ARGS_Rev
41                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K4_ARGS_Rev
42                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K8_Rev
43                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K8_Rev
44                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K8_Rev
45                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K8_Rev
46                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K8_Rev
47                MODULE PROCEDURE SZ_Compress_d1_Fortran_REAL_K8_ARGS_Rev
48                MODULE PROCEDURE SZ_Compress_d2_Fortran_REAL_K8_ARGS_Rev
49                MODULE PROCEDURE SZ_Compress_d3_Fortran_REAL_K8_ARGS_Rev
50                MODULE PROCEDURE SZ_Compress_d4_Fortran_REAL_K8_ARGS_Rev
51                MODULE PROCEDURE SZ_Compress_d5_Fortran_REAL_K8_ARGS_Rev
52        END INTERFACE SZ_Compress
53
54        INTERFACE SZ_Decompress
55                MODULE PROCEDURE SZ_Decompress_d1_Fortran_REAL_K4
56                MODULE PROCEDURE SZ_Decompress_d2_Fortran_REAL_K4
57                MODULE PROCEDURE SZ_Decompress_d3_Fortran_REAL_K4
58                MODULE PROCEDURE SZ_Decompress_d4_Fortran_REAL_K4
59                MODULE PROCEDURE SZ_Decompress_d5_Fortran_REAL_K4
60                MODULE PROCEDURE SZ_Decompress_d1_Fortran_REAL_K8
61                MODULE PROCEDURE SZ_Decompress_d2_Fortran_REAL_K8
62                MODULE PROCEDURE SZ_Decompress_d3_Fortran_REAL_K8
63                MODULE PROCEDURE SZ_Decompress_d4_Fortran_REAL_K8
64                MODULE PROCEDURE SZ_Decompress_d5_Fortran_REAL_K8
65        END INTERFACE SZ_Decompress
66
67        INTERFACE SZ_BatchAddVar
68                MODULE PROCEDURE SZ_BatchAddVar_d1_Fortran_REAL_K4
69                MODULE PROCEDURE SZ_BatchAddVar_d2_Fortran_REAL_K4
70                MODULE PROCEDURE SZ_BatchAddVar_d3_Fortran_REAL_K4
71                MODULE PROCEDURE SZ_BatchAddVar_d4_Fortran_REAL_K4
72                MODULE PROCEDURE SZ_BatchAddVar_d5_Fortran_REAL_K4
73                MODULE PROCEDURE SZ_BatchAddVar_d1_Fortran_REAL_K8
74                MODULE PROCEDURE SZ_BatchAddVar_d2_Fortran_REAL_K8
75                MODULE PROCEDURE SZ_BatchAddVar_d3_Fortran_REAL_K8
76                MODULE PROCEDURE SZ_BatchAddVar_d4_Fortran_REAL_K8
77                MODULE PROCEDURE SZ_BatchAddVar_d5_Fortran_REAL_K8
78        END INTERFACE SZ_BatchAddVar
79
80        INTERFACE SZ_GetVarData
81                MODULE PROCEDURE SZ_GetVarData_d1_Fortran_REAL_K4
82                MODULE PROCEDURE SZ_GetVarData_d2_Fortran_REAL_K4
83                MODULE PROCEDURE SZ_GetVarData_d3_Fortran_REAL_K4
84                MODULE PROCEDURE SZ_GetVarData_d4_Fortran_REAL_K4
85                MODULE PROCEDURE SZ_GetVarData_d5_Fortran_REAL_K4
86                MODULE PROCEDURE SZ_GetVarData_d1_Fortran_REAL_K8
87                MODULE PROCEDURE SZ_GetVarData_d2_Fortran_REAL_K8
88                MODULE PROCEDURE SZ_GetVarData_d3_Fortran_REAL_K8
89                MODULE PROCEDURE SZ_GetVarData_d4_Fortran_REAL_K8
90                MODULE PROCEDURE SZ_GetVarData_d5_Fortran_REAL_K8                                                               
91        END INTERFACE SZ_GetVarData
92
93        CONTAINS
94
95!Init and Finalize
96
97        SUBROUTINE SZ_Init(config_File,ierr)
98                implicit none
99                CHARACTER(len=32) :: config_File
100                INTEGER :: l,ierr
101                CALL SZ_Init_c(config_File,len(trim(config_File)),ierr)
102        END SUBROUTINE SZ_Init
103       
104        SUBROUTINE SZ_Finalize()
105                CALL SZ_Finalize_c()
106        END SUBROUTINE SZ_Finalize
107
108        SUBROUTINE SZ_FREE_VARSET(mode)
109                implicit none
110                INTEGER :: mode !0,1,2, or 3
111               
112                CALL SZ_Freevarset_c(mode)
113        END SUBROUTINE SZ_FREE_VARSET
114
115!batch-mode functions
116
117        SUBROUTINE SZ_BatchDelVar(varName, ierr)
118                implicit none
119                CHARACTER(len=*) :: varName
120                INTEGER :: ierr
121                CALL SZ_BatchDelVar_c(varName, len(trim(varName)), ierr)
122        END SUBROUTINE SZ_BatchDelVar
123
124        SUBROUTINE SZ_Batch_Compress(Bytes, OutSize)
125                implicit none
126                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
127                INTEGER(kind=C_SIZE_T) :: OutSize
128                INTEGER(kind=C_SIZE_T) :: alloSize
129               
130                CALL compute_total_batch_size_c(alloSize)
131                allocate(Bytes(alloSize)) !allocate the largest possible memory
132
133                CALL SZ_Batch_Compress_c(Bytes, OutSize)
134               
135        END SUBROUTINE SZ_Batch_Compress
136
137        SUBROUTINE SZ_Batch_Decompress(Bytes, OutSize, ierr)
138                implicit none
139                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
140                INTEGER(kind=C_SIZE_T) :: OutSize
141                INTEGER :: ierr
142
143                CALL SZ_Batch_Decompress_c(Bytes, OutSize, ierr)
144        END SUBROUTINE SZ_Batch_Decompress
145
146!Compress functions that extract the dimension sizes and call C translation interface (single-precision)
147
148        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4(VAR, Bytes, OutSize)
149                implicit none
150                REAL(KIND=4), DIMENSION(:) :: VAR
151                INTEGER(kind=C_SIZE_T) :: OutSize, R1
152                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
153                R1 = SIZE(VAR,1)
154               
155                allocate(Bytes(8*R1)) !allocate the largest possible memory
156                       
157                CALL SZ_Compress_d1_Float(VAR, Bytes, OutSize, R1)
158       
159        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4
160
161        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
162                implicit none
163                REAL(KIND=4), DIMENSION(:) :: VAR
164                INTEGER(kind=C_SIZE_T) :: OutSize, R1
165                INTEGER(kind=4) :: ErrBoundMode
166                REAL(kind=4) :: AbsErrBound, RelBoundRatio
167                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
168                R1 = SIZE(VAR,1)
169               
170                allocate(Bytes(8*R1)) !allocate the largest possible memory
171               
172                CALL SZ_Compress_d1_Float_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
173       
174        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_ARGS
175
176        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4(VAR, Bytes, OutSize)
177                implicit none
178                REAL(KIND=4), DIMENSION(:,:) :: VAR
179                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
180                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
181                R1 = SIZE(VAR,1)
182                R2 = SIZE(VAR,2)
183
184                R = R1*R2
185               
186                allocate(Bytes(8*R)) !allocate the largest possible memory
187       
188                CALL SZ_Compress_d2_Float(VAR, Bytes, OutSize, R1, R2)
189       
190        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4
191
192        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
193                implicit none
194                REAL(KIND=4), DIMENSION(:,:) :: VAR
195                INTEGER(kind=4) :: ErrBoundMode
196                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
197                REAL(kind=4) :: AbsErrBound, RelBoundRatio
198                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
199                R1 = SIZE(VAR,1)
200                R2 = SIZE(VAR,2)
201               
202                R = R1*R2
203               
204                allocate(Bytes(8*R))  !allocate the largest possible memory
205               
206                CALL SZ_Compress_d2_Float_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
207        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_ARGS
208
209        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4(VAR, Bytes, OutSize)
210                implicit none
211                REAL(KIND=4), DIMENSION(:,:,:) :: VAR
212                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
213                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
214
215                R1 = SIZE(VAR,1)
216                R2 = SIZE(VAR,2)
217                R3 = SIZE(VAR,3)
218                R = R1*R2*R3
219                allocate(Bytes(8*R)) !allocate the largest possible memory
220               
221                CALL SZ_Compress_d3_Float(VAR, Bytes, OutSize, R1, R2, R3)
222               
223        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4
224
225        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
226                implicit none
227                REAL(KIND=4), DIMENSION(:,:,:) :: VAR
228                INTEGER(kind=4) :: ErrBoundMode
229                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
230                REAL(kind=4) :: AbsErrBound, RelBoundRatio
231                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
232
233                R1 = SIZE(VAR,1)
234                R2 = SIZE(VAR,2)
235                R3 = SIZE(VAR,3)
236                R = R1*R2*R3
237                allocate(Bytes(8*R)) !allocate the largest possible memory
238
239                CALL SZ_Compress_d3_Float_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
240
241        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_ARGS
242
243        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4(VAR, Bytes, OutSize)
244                implicit none
245                REAL(KIND=4), DIMENSION(:,:,:,:) :: VAR
246                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
247                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
248
249                R1 = SIZE(VAR,1)
250                R2 = SIZE(VAR,2)
251                R3 = SIZE(VAR,3)
252                R4 = SIZE(VAR,4)
253
254                R = R1*R2*R3*R4
255                allocate(Bytes(8*R)) !allocate the largest possible memory
256               
257                CALL SZ_Compress_d4_Float(VAR, Bytes, OutSize, R1, R2, R3, R4)
258               
259        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4
260
261        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
262                implicit none
263                REAL(KIND=4), DIMENSION(:,:,:,:) :: VAR
264                INTEGER(kind=4) :: ErrBoundMode
265                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
266                REAL(kind=4) :: AbsErrBound, RelBoundRatio
267                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
268
269                R1 = SIZE(VAR,1)
270                R2 = SIZE(VAR,2)
271                R3 = SIZE(VAR,3)
272                R4 = SIZE(VAR,4)
273                R = R1*R2*R3*R4
274                allocate(Bytes(8*R)) !allocate the largest possible memory
275
276                CALL SZ_Compress_d4_Float_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
277
278        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_ARGS
279
280        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4(VAR, Bytes, OutSize)
281                implicit none
282                REAL(KIND=4), DIMENSION(:,:,:,:,:) :: VAR
283                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
284                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
285
286                R1 = SIZE(VAR,1)
287                R2 = SIZE(VAR,2)
288                R3 = SIZE(VAR,3)
289                R4 = SIZE(VAR,4)
290                R5 = SIZE(VAR,5)
291                R = R1*R2*R3*R4*R5
292                allocate(Bytes(8*R)) !allocate the largest possible memory
293               
294                CALL SZ_Compress_d5_Float(VAR, Bytes, OutSize, R1, R2, R3, R4, R5)
295
296        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4
297
298        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
299                implicit none
300                REAL(KIND=4), DIMENSION(:,:,:,:,:) :: VAR
301                INTEGER(kind=4) :: ErrBoundMode
302                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
303                REAL(kind=4) :: AbsErrBound, RelBoundRatio
304                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
305
306                R1 = SIZE(VAR,1)
307                R2 = SIZE(VAR,2)
308                R3 = SIZE(VAR,3)
309                R4 = SIZE(VAR,4)
310                R5 = SIZE(VAR,5)
311                R = R1*R2*R3*R4*R5
312                allocate(Bytes(8*R)) !allocate the largest possible memory
313
314                CALL SZ_Compress_d5_Float_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
315
316        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_ARGS
317
318!Compress functions that extract the dimension sizes and call C translation interfaces (double-precision)
319
320        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8(VAR, Bytes, OutSize)
321                implicit none
322                REAL(KIND=8), DIMENSION(:) :: VAR
323                INTEGER(kind=C_SIZE_T) :: OutSize, R1
324                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
325                R1 = SIZE(VAR,1)
326               
327                allocate(Bytes(8*R1))
328               
329                CALL SZ_Compress_d1_Double(VAR, Bytes, OutSize, R1)
330        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8
331
332        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
333                implicit none
334                REAL(KIND=8), DIMENSION(:) :: VAR
335                INTEGER(kind=4) :: ErrBoundMode
336                INTEGER(kind=C_SIZE_T) :: OutSize, R1
337                REAL(kind=8) :: AbsErrBound, RelBoundRatio
338                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
339                R1 = SIZE(VAR,1)
340               
341                allocate(Bytes(8*R1))
342                CALL SZ_Compress_d1_Double_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
343        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_ARGS
344
345        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8(VAR, Bytes, OutSize)
346                implicit none
347                REAL(KIND=8), DIMENSION(:,:) :: VAR
348                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
349                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
350                R1 = SIZE(VAR,1)
351                R2 = SIZE(VAR,2)
352               
353                R = R1*R2
354                allocate(Bytes(8*R)) !allocate the largest possible memory
355               
356                CALL SZ_Compress_d2_Double(VAR, Bytes, OutSize, R1, R2)
357        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8
358
359        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
360                implicit none
361                REAL(KIND=8), DIMENSION(:,:) :: VAR
362                INTEGER(kind=4) :: ErrBoundMode
363                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
364                REAL(kind=8) :: AbsErrBound, RelBoundRatio
365                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
366                R1 = SIZE(VAR,1)
367                R2 = SIZE(VAR,2)
368
369                R = R1*R2
370                allocate(Bytes(8*R)) !allocate the largest possible memory             
371               
372                CALL SZ_Compress_d2_Double_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
373        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_ARGS
374
375        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8(VAR, Bytes, OutSize)
376                implicit none
377                REAL(KIND=8), DIMENSION(:,:,:) :: VAR
378                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
379                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
380
381                R1 = SIZE(VAR,1)
382                R2 = SIZE(VAR,2)
383                R3 = SIZE(VAR,3)
384                R = R1*R2*R3
385               
386                allocate(Bytes(8*R)) !allocate the largest possible memory
387               
388                CALL SZ_Compress_d3_Double(VAR, Bytes, OutSize, R1, R2, R3)
389       
390        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8
391
392        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
393                implicit none
394                REAL(KIND=8), DIMENSION(:,:,:) :: VAR
395                INTEGER(kind=4) :: ErrBoundMode
396                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
397                REAL(kind=8) :: AbsErrBound, RelBoundRatio
398                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
399
400                R1 = SIZE(VAR,1)
401                R2 = SIZE(VAR,2)
402                R3 = SIZE(VAR,3)
403                R = R1*R2*R3
404                allocate(Bytes(8*R)) !allocate the largest possible memory
405
406                CALL SZ_Compress_d3_Double_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
407
408        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_ARGS
409
410        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8(VAR, Bytes, OutSize)
411                implicit none
412                REAL(KIND=8), DIMENSION(:,:,:,:) :: VAR
413                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
414                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
415
416                R1 = SIZE(VAR,1)
417                R2 = SIZE(VAR,2)
418                R3 = SIZE(VAR,3)
419                R4 = SIZE(VAR,4)
420
421                R = R1*R2*R3*R4
422                allocate(Bytes(8*R)) !allocate the largest possible memory
423               
424                CALL SZ_Compress_d4_Double(VAR, Bytes, OutSize, R1, R2, R3, R4)
425       
426        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8
427
428        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
429                implicit none
430                REAL(KIND=8), DIMENSION(:,:,:,:) :: VAR
431                INTEGER(kind=C_SIZE_T) :: ErrBoundMode
432                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
433                REAL(kind=8) :: AbsErrBound, RelBoundRatio
434                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
435
436                R1 = SIZE(VAR,1)
437                R2 = SIZE(VAR,2)
438                R3 = SIZE(VAR,3)
439                R4 = SIZE(VAR,4)
440                R = R1*R2*R3*R4
441                allocate(Bytes(8*R)) !allocate the largest possible memory
442
443                CALL SZ_Compress_d4_Double_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
444
445        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_ARGS
446
447        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8(VAR, Bytes, OutSize)
448                implicit none
449                REAL(KIND=8), DIMENSION(:,:,:,:,:) :: VAR
450                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
451                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
452
453                R1 = SIZE(VAR,1)
454                R2 = SIZE(VAR,2)
455                R3 = SIZE(VAR,3)
456                R4 = SIZE(VAR,4)
457                R5 = SIZE(VAR,5)
458                R = R1*R2*R3*R4*R5
459                allocate(Bytes(8*R)) !allocate the largest possible memory
460               
461                CALL SZ_Compress_d5_Double(VAR, Bytes, OutSize, R1, R2, R3, R4, R5)
462       
463        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8
464
465        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_ARGS(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
466                implicit none
467                REAL(KIND=8), DIMENSION(:,:,:,:,:) :: VAR
468                INTEGER(kind=4) :: ErrBoundMode
469                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
470                REAL(kind=8) :: AbsErrBound, RelBoundRatio
471                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
472
473                R1 = SIZE(VAR,1)
474                R2 = SIZE(VAR,2)
475                R3 = SIZE(VAR,3)
476                R4 = SIZE(VAR,4)
477                R5 = SIZE(VAR,5)
478                R = R1*R2*R3*R4*R5
479                allocate(Bytes(8*R)) !allocate the largest possible memory
480
481                CALL SZ_Compress_d5_Double_Args(VAR, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
482
483        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_ARGS
484
485!Comrpession functions with reserved value
486
487        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_Rev(VAR, ReValue, Bytes, OutSize)
488                implicit none
489                REAL(KIND=4), DIMENSION(:) :: VAR
490                REAL(KIND=4) :: ReValue
491                INTEGER(kind=C_SIZE_T) :: OutSize, R1
492                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
493                R1 = SIZE(VAR,1)
494               
495                allocate(Bytes(8*R1))
496               
497                CALL SZ_Compress_d1_Float_Rev(VAR, ReValue, Bytes, OutSize, R1)
498        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_Rev
499
500        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
501                implicit none
502                REAL(KIND=4), DIMENSION(:) :: VAR
503                REAL(KIND=4) :: ReValue
504                INTEGER(kind=4) :: ErrBoundMode
505                INTEGER(kind=C_SIZE_T) :: OutSize, R1
506                REAL(kind=4) :: AbsErrBound, RelBoundRatio
507                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
508                R1 = SIZE(VAR,1)
509               
510                allocate(Bytes(8*R1))
511               
512                CALL SZ_Compress_d1_Float_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
513        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K4_ARGS_Rev
514
515        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_Rev(VAR, ReValue, Bytes, OutSize)
516                implicit none
517                REAL(KIND=4), DIMENSION(:,:) :: VAR
518                REAL(KIND=4) :: ReValue
519                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
520                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
521                R1 = SIZE(VAR,1)
522                R2 = SIZE(VAR,2)
523               
524                R = R1*R2
525                allocate(Bytes(8*R)) !allocate the largest possible memory
526               
527                CALL SZ_Compress_d2_Float_Rev(VAR, ReValue, Bytes, OutSize, R1, R2)
528        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_Rev
529
530        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
531                implicit none
532                REAL(KIND=4), DIMENSION(:,:) :: VAR
533                REAL(KIND=4) :: ReValue
534                INTEGER(kind=4) :: ErrBoundMode
535                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
536                REAL(kind=4) :: AbsErrBound, RelBoundRatio
537                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
538                R1 = SIZE(VAR,1)
539                R2 = SIZE(VAR,2)
540               
541                R = R1*R2
542                allocate(Bytes(8*R)) !allocate the largest possible memory
543               
544                CALL SZ_Compress_d2_Float_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
545        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K4_ARGS_Rev
546
547        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_Rev(VAR, ReValue, Bytes, OutSize)
548                implicit none
549                REAL(KIND=4), DIMENSION(:,:,:) :: VAR
550                REAL(KIND=4) :: ReValue
551                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
552                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
553                INTEGER(kind=1), DIMENSION(:), allocatable :: temp
554
555                R1 = SIZE(VAR,1)
556                R2 = SIZE(VAR,2)
557                R3 = SIZE(VAR,3)
558                R = R1*R2*R3
559                allocate(Bytes(8*R)) !allocate the largest possible memory
560               
561                CALL SZ_Compress_d3_Float_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3)
562
563        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_Rev
564
565        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
566                implicit none
567                REAL(KIND=4), DIMENSION(:,:,:) :: VAR
568                REAL(KIND=4) :: ReValue
569                INTEGER(kind=4) :: ErrBoundMode
570                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
571                REAL(kind=4) :: AbsErrBound, RelBoundRatio
572                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
573
574                R1 = SIZE(VAR,1)
575                R2 = SIZE(VAR,2)
576                R3 = SIZE(VAR,3)
577                R = R1*R2*R3
578                allocate(Bytes(8*R)) !allocate the largest possible memory
579
580                CALL SZ_Compress_d3_Float_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
581
582        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K4_ARGS_Rev
583
584        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_Rev(VAR, ReValue, Bytes, OutSize)
585                implicit none
586                REAL(KIND=4), DIMENSION(:,:,:,:) :: VAR
587                REAL(KIND=4) :: ReValue
588                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
589                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
590
591                R1 = SIZE(VAR,1)
592                R2 = SIZE(VAR,2)
593                R3 = SIZE(VAR,3)
594                R4 = SIZE(VAR,4)
595
596                R = R1*R2*R3*R4
597                allocate(Bytes(8*R)) !allocate the largest possible memory
598               
599                CALL SZ_Compress_d4_Float_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3, R4)
600       
601        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_Rev
602
603        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
604                implicit none
605                REAL(KIND=4), DIMENSION(:,:,:,:) :: VAR
606                REAL(KIND=4) :: ReValue
607                INTEGER(kind=4) :: ErrBoundMode
608                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
609                REAL(kind=4) :: AbsErrBound, RelBoundRatio
610                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
611
612                R1 = SIZE(VAR,1)
613                R2 = SIZE(VAR,2)
614                R3 = SIZE(VAR,3)
615                R4 = SIZE(VAR,4)
616                R = R1*R2*R3*R4
617                allocate(Bytes(8*R)) !allocate the largest possible memory
618
619                CALL SZ_Compress_d4_Float_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
620
621        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K4_ARGS_Rev
622
623        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_Rev(VAR, ReValue, Bytes, OutSize)
624                implicit none
625                REAL(KIND=4), DIMENSION(:,:,:,:,:) :: VAR
626                REAL(KIND=4) :: ReValue
627                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
628                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
629
630                R1 = SIZE(VAR,1)
631                R2 = SIZE(VAR,2)
632                R3 = SIZE(VAR,3)
633                R4 = SIZE(VAR,4)
634                R5 = SIZE(VAR,5)
635                R = R1*R2*R3*R4*R5
636                allocate(Bytes(8*R)) !allocate the largest possible memory
637               
638                CALL SZ_Compress_d5_Float_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3, R4, R5)
639               
640        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_Rev
641
642        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
643                implicit none
644                REAL(KIND=4), DIMENSION(:,:,:,:,:) :: VAR
645                REAL(KIND=4) :: ReValue
646                INTEGER(kind=4) :: ErrBoundMode
647                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
648                REAL(kind=4) :: AbsErrBound, RelBoundRatio
649                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
650
651                R1 = SIZE(VAR,1)
652                R2 = SIZE(VAR,2)
653                R3 = SIZE(VAR,3)
654                R4 = SIZE(VAR,4)
655                R5 = SIZE(VAR,5)
656                R = R1*R2*R3*R4*R5
657                allocate(Bytes(8*R)) !allocate the largest possible memory
658
659                CALL SZ_Compress_d5_Float_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
660
661        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K4_ARGS_Rev
662
663!Compress functions that extract the dimension sizes and call C translation interfaces (double-precision)
664
665        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_Rev(VAR, ReValue, Bytes, OutSize)
666                implicit none
667                REAL(KIND=8), DIMENSION(:) :: VAR
668                REAL(KIND=8) :: ReValue
669                INTEGER(kind=C_SIZE_T) :: OutSize, R1
670                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
671                R1 = SIZE(VAR,1)
672               
673                allocate(Bytes(8*R1))
674               
675                CALL SZ_Compress_d1_Double_Rev(VAR, ReValue, Bytes, OutSize, R1)
676        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_Rev
677
678        SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
679                implicit none
680                REAL(KIND=8), DIMENSION(:) :: VAR
681                REAL(KIND=8) :: ReValue
682                INTEGER(kind=4) :: ErrBoundMode
683                INTEGER(kind=C_SIZE_T) :: OutSize, R1
684                REAL(kind=8) :: AbsErrBound, RelBoundRatio
685                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
686                R1 = SIZE(VAR,1)
687               
688                allocate(Bytes(8*R1))
689               
690                CALL SZ_Compress_d1_Double_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
691        END SUBROUTINE SZ_Compress_d1_Fortran_REAL_K8_ARGS_Rev
692
693        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_Rev(VAR, ReValue, Bytes, OutSize)
694                implicit none
695                REAL(KIND=8), DIMENSION(:,:) :: VAR
696                REAL(KIND=8) :: ReValue
697                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
698                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
699                R1 = SIZE(VAR,1)
700                R2 = SIZE(VAR,2)
701               
702                R = R1*R2
703                allocate(Bytes(8*R)) !allocate the largest possible memory
704               
705                CALL SZ_Compress_d2_Double_Rev(VAR, ReValue, Bytes, OutSize, R1, R2)
706        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_Rev
707
708        SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
709                implicit none
710                REAL(KIND=8), DIMENSION(:,:) :: VAR
711                REAL(KIND=8) :: ReValue
712                INTEGER(kind=4) :: ErrBoundMode
713                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R
714                REAL(kind=8) :: AbsErrBound, RelBoundRatio
715                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
716                R1 = SIZE(VAR,1)
717                R2 = SIZE(VAR,2)
718                R = R1*R2
719                allocate(Bytes(8*R)) !allocate the largest possible memory
720
721                CALL SZ_Compress_d2_Double_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
722
723        END SUBROUTINE SZ_Compress_d2_Fortran_REAL_K8_ARGS_Rev
724
725        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_Rev(VAR, ReValue, Bytes, OutSize)
726                implicit none
727                REAL(KIND=8), DIMENSION(:,:,:) :: VAR
728                REAL(KIND=8) :: ReValue
729                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
730                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
731
732                R1 = SIZE(VAR,1)
733                R2 = SIZE(VAR,2)
734                R3 = SIZE(VAR,3)
735                R = R1*R2*R3
736                allocate(Bytes(8*R)) !allocate the largest possible memory
737               
738                CALL SZ_Compress_d3_Double_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3)
739
740        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_Rev
741
742        SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
743                implicit none
744                REAL(KIND=8), DIMENSION(:,:,:) :: VAR
745                REAL(KIND=8) :: ReValue
746                INTEGER(kind=4) :: ErrBoundMode
747                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R
748                REAL(kind=8) :: AbsErrBound, RelBoundRatio
749                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
750
751                R1 = SIZE(VAR,1)
752                R2 = SIZE(VAR,2)
753                R3 = SIZE(VAR,3)
754                R = R1*R2*R3
755                allocate(Bytes(8*R)) !allocate the largest possible memory
756
757                CALL SZ_Compress_d3_Double_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
758
759        END SUBROUTINE SZ_Compress_d3_Fortran_REAL_K8_ARGS_Rev
760
761        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_Rev(VAR, ReValue, Bytes, OutSize)
762                implicit none
763                REAL(KIND=8), DIMENSION(:,:,:,:) :: VAR
764                REAL(KIND=8) :: ReValue
765                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
766                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
767
768                R1 = SIZE(VAR,1)
769                R2 = SIZE(VAR,2)
770                R3 = SIZE(VAR,3)
771                R4 = SIZE(VAR,4)
772
773                R = R1*R2*R3*R4
774                allocate(Bytes(8*R)) !allocate the largest possible memory
775               
776                CALL SZ_Compress_d4_Double_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3, R4)
777       
778        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_Rev
779
780        SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
781                implicit none
782                REAL(KIND=8), DIMENSION(:,:,:,:) :: VAR
783                REAL(KIND=8) :: ReValue
784                INTEGER(kind=4) :: ErrBoundMode
785                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R
786                REAL(kind=8) :: AbsErrBound, RelBoundRatio
787                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
788
789                R1 = SIZE(VAR,1)
790                R2 = SIZE(VAR,2)
791                R3 = SIZE(VAR,3)
792                R4 = SIZE(VAR,4)
793                R = R1*R2*R3*R4
794                allocate(Bytes(8*R)) !allocate the largest possible memory
795
796                CALL SZ_Compress_d4_Double_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
797
798        END SUBROUTINE SZ_Compress_d4_Fortran_REAL_K8_ARGS_Rev
799
800        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_Rev(VAR, ReValue, Bytes, OutSize)
801                implicit none
802                REAL(KIND=8), DIMENSION(:,:,:,:,:) :: VAR
803                REAL(KIND=8) :: ReValue
804                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
805                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
806
807                R1 = SIZE(VAR,1)
808                R2 = SIZE(VAR,2)
809                R3 = SIZE(VAR,3)
810                R4 = SIZE(VAR,4)
811                R5 = SIZE(VAR,5)
812                R = R1*R2*R3*R4*R5
813                allocate(Bytes(8*R)) !allocate the largest possible memory
814               
815                CALL SZ_Compress_d5_Double_Rev(VAR, ReValue, Bytes, OutSize, R1, R2, R3, R4, R5)
816
817        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_Rev
818
819        SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_ARGS_Rev(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio)
820                implicit none
821                REAL(KIND=8), DIMENSION(:,:,:,:,:) :: VAR
822                REAL(KIND=8) :: ReValue
823                INTEGER(kind=4) :: ErrBoundMode
824                INTEGER(kind=C_SIZE_T) :: OutSize, R1, R2, R3, R4, R5, R
825                REAL(kind=8) :: AbsErrBound, RelBoundRatio
826                INTEGER(kind=1), DIMENSION(:), allocatable :: Bytes
827
828                R1 = SIZE(VAR,1)
829                R2 = SIZE(VAR,2)
830                R3 = SIZE(VAR,3)
831                R4 = SIZE(VAR,4)
832                R5 = SIZE(VAR,5)
833                R = R1*R2*R3*R4*R5
834                allocate(Bytes(8*R)) !allocate the largest possible memory
835
836                CALL SZ_Compress_d5_Double_Rev_Args(VAR, ReValue, Bytes, OutSize, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
837
838        END SUBROUTINE SZ_Compress_d5_Fortran_REAL_K8_ARGS_Rev
839
840!Decompress functions
841
842        SUBROUTINE SZ_Decompress_d1_Fortran_REAL_K4(Bytes, VAR, R1)
843                implicit none
844                INTEGER(kind=1), DIMENSION(:) :: Bytes
845                REAL(KIND=4), DIMENSION(:), allocatable :: VAR
846                INTEGER(kind=C_SIZE_T) :: R1, BLength
847                BLength = SIZE(Bytes)
848                allocate(VAR(R1))
849       
850                CALL SZ_Decompress_d1_Float(Bytes, BLength, VAR, R1)
851        END SUBROUTINE SZ_Decompress_d1_Fortran_REAL_K4
852
853        SUBROUTINE SZ_Decompress_d2_Fortran_REAL_K4(Bytes, VAR, R1, R2)
854                implicit none
855                INTEGER(kind=1), DIMENSION(:) :: Bytes 
856                REAL(KIND=4), DIMENSION(:,:), allocatable :: VAR
857                INTEGER(kind=C_SIZE_T) :: R1, R2, BLength
858                BLength = SIZE(Bytes)
859                allocate(VAR(R1,R2))
860       
861                CALL SZ_Decompress_d2_Float(Bytes, BLength, VAR, R1, R2)
862        END SUBROUTINE SZ_Decompress_d2_Fortran_REAL_K4
863
864        SUBROUTINE SZ_Decompress_d3_Fortran_REAL_K4(Bytes, VAR, R1, R2, R3)
865                implicit none
866                INTEGER(kind=1), DIMENSION(:) :: Bytes
867                REAL(KIND=4), DIMENSION(:,:,:), allocatable :: VAR
868                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, BLength
869                BLength = SIZE(Bytes)
870                allocate(VAR(R1,R2,R3))
871       
872                CALL SZ_Decompress_d3_Float(Bytes, BLength, VAR, R1, R2, R3)
873        END SUBROUTINE SZ_Decompress_d3_Fortran_REAL_K4
874
875        SUBROUTINE SZ_Decompress_d4_Fortran_REAL_K4(Bytes, VAR, R1, R2, R3, R4)
876                implicit none
877                INTEGER(kind=1), DIMENSION(:) :: Bytes
878                REAL(KIND=4), DIMENSION(:,:,:,:), allocatable :: VAR
879                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, BLength
880                BLength = SIZE(Bytes)
881                allocate(VAR(R1,R2,R3,R4))
882       
883                CALL SZ_Decompress_d4_Float(Bytes, BLength, VAR, R1, R2, R3, R4)
884        END SUBROUTINE SZ_Decompress_d4_Fortran_REAL_K4
885
886        SUBROUTINE SZ_Decompress_d5_Fortran_REAL_K4(Bytes, VAR, R1, R2, R3, R4, R5)
887                implicit none
888                INTEGER(kind=1), DIMENSION(:) :: Bytes
889                REAL(KIND=4), DIMENSION(:,:,:,:,:), allocatable :: VAR
890                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, R5, BLength
891                BLength = SIZE(Bytes)
892                allocate(VAR(R1,R2,R3,R4,R5))
893       
894                CALL SZ_Decompress_d5_Float(Bytes, BLength, VAR, R1, R2, R3, R4, R5)
895        END SUBROUTINE SZ_Decompress_d5_Fortran_REAL_K4
896
897        SUBROUTINE SZ_Decompress_d1_Fortran_REAL_K8(Bytes, VAR, R1)
898                implicit none
899                INTEGER(kind=1), DIMENSION(:) :: Bytes
900                REAL(KIND=8), DIMENSION(:), allocatable :: VAR
901                INTEGER(kind=C_SIZE_T) :: R1, BLength
902                BLength = SIZE(Bytes)
903                allocate(VAR(R1))
904       
905                CALL SZ_Decompress_d1_Double(Bytes, BLength, VAR, R1)
906        END SUBROUTINE SZ_Decompress_d1_Fortran_REAL_K8
907
908        SUBROUTINE SZ_Decompress_d2_Fortran_REAL_K8(Bytes, VAR, R1, R2)
909                implicit none
910                INTEGER(kind=1), DIMENSION(:) :: Bytes
911                REAL(KIND=8), DIMENSION(:,:), allocatable :: VAR
912                INTEGER(kind=C_SIZE_T) :: R1, R2, BLength
913                BLength = SIZE(Bytes)
914                allocate(VAR(R1,R2))
915       
916                CALL SZ_Decompress_d2_Double(Bytes, BLength, VAR, R1, R2)
917        END SUBROUTINE SZ_Decompress_d2_Fortran_REAL_K8
918
919        SUBROUTINE SZ_Decompress_d3_Fortran_REAL_K8(Bytes, VAR, R1, R2, R3)
920                implicit none
921                INTEGER(kind=1), DIMENSION(:) :: Bytes
922                REAL(KIND=8), DIMENSION(:,:,:), allocatable :: VAR
923                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, BLength
924                BLength = SIZE(Bytes)
925                allocate(VAR(R1,R2,R3))
926       
927                CALL SZ_Decompress_d3_Double(Bytes, BLength, VAR, R1, R2, R3)
928        END SUBROUTINE SZ_Decompress_d3_Fortran_REAL_K8
929
930        SUBROUTINE SZ_Decompress_d4_Fortran_REAL_K8(Bytes, VAR, R1, R2, R3, R4)
931                implicit none
932                INTEGER(kind=1), DIMENSION(:) :: Bytes
933                REAL(KIND=8), DIMENSION(:,:,:,:), allocatable :: VAR
934                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, BLength
935                BLength = SIZE(Bytes)
936                allocate(VAR(R1,R2,R3,R4))
937       
938                CALL SZ_Decompress_d4_Double(Bytes, BLength, VAR, R1, R2, R3, R4)
939        END SUBROUTINE SZ_Decompress_d4_Fortran_REAL_K8
940
941        SUBROUTINE SZ_Decompress_d5_Fortran_REAL_K8(Bytes, VAR, R1, R2, R3, R4, R5)
942                implicit none
943                INTEGER(kind=1), DIMENSION(:) :: Bytes
944                REAL(KIND=8), DIMENSION(:,:,:,:,:), allocatable :: VAR
945                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, R5, BLength
946                BLength = SIZE(Bytes, 1)
947                allocate(VAR(R1,R2,R3,R4,R5))
948       
949                CALL SZ_Decompress_d5_Double(Bytes, BLength, VAR, R1, R2, R3, R4, R5)
950        END SUBROUTINE SZ_Decompress_d5_Fortran_REAL_K8
951
952!--------batch add float
953
954        SUBROUTINE SZ_BatchAddVar_d1_Fortran_REAL_K4(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
955                implicit none
956                CHARACTER(len=*) :: varName
957                REAL(KIND=4), DIMENSION(:) :: VAR
958                INTEGER(kind=4) :: ErrBoundMode
959                INTEGER(kind=C_SIZE_T) :: R1
960                REAL(kind=4) :: AbsErrBound, RelBoundRatio
961                R1 = SIZE(VAR,1)
962
963                CALL SZ_batchAddVar_d1_Float(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
964        END SUBROUTINE SZ_BatchAddVar_d1_Fortran_REAL_K4
965
966        SUBROUTINE SZ_BatchAddVar_d2_Fortran_REAL_K4(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
967                implicit none           
968                CHARACTER(len=*) :: varName
969                REAL(KIND=4), DIMENSION(:,:) :: VAR
970                INTEGER(kind=4) :: ErrBoundMode
971                INTEGER(kind=C_SIZE_T) :: R1, R2
972                REAL(kind=4) :: AbsErrBound, RelBoundRatio
973                R1 = SIZE(VAR,1)
974                R2 = SIZE(VAR,2)
975
976                CALL SZ_batchAddVar_d2_Float(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
977        END SUBROUTINE SZ_BatchAddVar_d2_Fortran_REAL_K4
978
979        SUBROUTINE SZ_BatchAddVar_d3_Fortran_REAL_K4(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
980                implicit none           
981                CHARACTER(len=*) :: varName
982                REAL(KIND=4), DIMENSION(:,:,:) :: VAR
983                INTEGER(kind=4) :: ErrBoundMode
984                INTEGER(kind=C_SIZE_T) :: R1, R2, R3
985                REAL(kind=4) :: AbsErrBound, RelBoundRatio
986                R1 = SIZE(VAR,1)
987                R2 = SIZE(VAR,2)
988                R3 = SIZE(VAR,3)
989
990                CALL SZ_batchAddVar_d3_Float(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
991        END SUBROUTINE SZ_BatchAddVar_d3_Fortran_REAL_K4
992
993        SUBROUTINE SZ_BatchAddVar_d4_Fortran_REAL_K4(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
994                implicit none
995                CHARACTER(len=*) :: varName
996                REAL(KIND=4), DIMENSION(:,:,:,:) :: VAR
997                INTEGER(kind=4) :: ErrBoundMode
998                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4
999                REAL(kind=4) :: AbsErrBound, RelBoundRatio
1000                R1 = SIZE(VAR,1)
1001                R2 = SIZE(VAR,2)
1002                R3 = SIZE(VAR,3)
1003                R4 = SIZE(VAR,4)
1004
1005                CALL SZ_batchAddVar_d4_Float(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
1006        END SUBROUTINE SZ_BatchAddVar_d4_Fortran_REAL_K4
1007
1008        SUBROUTINE SZ_BatchAddVar_d5_Fortran_REAL_K4(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1009                implicit none
1010                CHARACTER(len=*) :: varName
1011                REAL(KIND=4), DIMENSION(:,:,:,:,:) :: VAR
1012                INTEGER(kind=4) :: ErrBoundMode
1013                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, R5
1014                REAL(kind=4) :: AbsErrBound, RelBoundRatio
1015                R1 = SIZE(VAR,1)
1016                R2 = SIZE(VAR,2)
1017                R3 = SIZE(VAR,3)
1018                R4 = SIZE(VAR,4)
1019                R5 = SIZE(VAR,5)
1020
1021                CALL SZ_batchAddVar_d5_Float(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
1022        END SUBROUTINE SZ_BatchAddVar_d5_Fortran_REAL_K4
1023
1024!------batch add double
1025        SUBROUTINE SZ_BatchAddVar_d1_Fortran_REAL_K8(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1026                implicit none
1027                CHARACTER(len=*) :: varName
1028                REAL(KIND=8), DIMENSION(:) :: VAR
1029                INTEGER(kind=4) :: ErrBoundMode
1030                INTEGER(kind=C_SIZE_T) :: R1
1031                REAL(kind=8) :: AbsErrBound, RelBoundRatio
1032                R1 = SIZE(VAR,1)
1033
1034                CALL SZ_batchAddVar_d1_Double(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1)
1035        END SUBROUTINE SZ_BatchAddVar_d1_Fortran_REAL_K8
1036
1037        SUBROUTINE SZ_BatchAddVar_d2_Fortran_REAL_K8(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1038                implicit none
1039                CHARACTER(len=*) :: varName
1040                REAL(KIND=8), DIMENSION(:,:) :: VAR
1041                INTEGER(kind=4) :: ErrBoundMode
1042                INTEGER(kind=C_SIZE_T) :: R1, R2
1043                REAL(kind=8) :: AbsErrBound, RelBoundRatio
1044                R1 = SIZE(VAR,1)
1045                R2 = SIZE(VAR,2)
1046
1047                CALL SZ_batchAddVar_d2_Double(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2)
1048        END SUBROUTINE SZ_BatchAddVar_d2_Fortran_REAL_K8
1049
1050        SUBROUTINE SZ_BatchAddVar_d3_Fortran_REAL_K8(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1051                implicit none
1052                CHARACTER(len=*) :: varName
1053                REAL(KIND=8), DIMENSION(:,:,:) :: VAR
1054                INTEGER(kind=4) :: ErrBoundMode
1055                INTEGER(kind=C_SIZE_T) :: R1, R2, R3
1056                REAL(kind=8) :: AbsErrBound, RelBoundRatio
1057                R1 = SIZE(VAR,1)
1058                R2 = SIZE(VAR,2)
1059                R3 = SIZE(VAR,3)
1060
1061                CALL SZ_batchAddVar_d3_Double(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3)
1062        END SUBROUTINE SZ_BatchAddVar_d3_Fortran_REAL_K8
1063
1064        SUBROUTINE SZ_BatchAddVar_d4_Fortran_REAL_K8(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1065                implicit none
1066                CHARACTER(len=*) :: varName
1067                REAL(KIND=8), DIMENSION(:,:,:,:) :: VAR
1068                INTEGER(kind=4) :: ErrBoundMode
1069                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4
1070                REAL(kind=8) :: AbsErrBound, RelBoundRatio
1071                R1 = SIZE(VAR,1)
1072                R2 = SIZE(VAR,2)
1073                R3 = SIZE(VAR,3)
1074                R4 = SIZE(VAR,4)
1075
1076                CALL SZ_batchAddVar_d4_Double(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4)
1077        END SUBROUTINE SZ_BatchAddVar_d4_Fortran_REAL_K8
1078
1079        SUBROUTINE SZ_BatchAddVar_d5_Fortran_REAL_K8(varName, VAR, ErrBoundMode, AbsErrBound, RelBoundRatio)
1080                implicit none
1081                CHARACTER(len=*) :: varName
1082                REAL(KIND=8), DIMENSION(:,:,:,:,:) :: VAR
1083                INTEGER(kind=4) :: ErrBoundMode
1084                INTEGER(kind=C_SIZE_T) :: R1, R2, R3, R4, R5
1085                REAL(kind=8) :: AbsErrBound, RelBoundRatio
1086                R1 = SIZE(VAR,1)
1087                R2 = SIZE(VAR,2)
1088                R3 = SIZE(VAR,3)
1089                R4 = SIZE(VAR,4)
1090                R5 = SIZE(VAR,5)
1091
1092                CALL SZ_batchAddVar_d5_Double(varName, len(trim(varName)), VAR, ErrBoundMode, AbsErrBound, RelBoundRatio, R1, R2, R3, R4, R5)
1093        END SUBROUTINE SZ_BatchAddVar_d5_Fortran_REAL_K8
1094
1095        SUBROUTINE SZ_GetVarDim(varName, DIMEN, R1, R2, R3, R4, R5)
1096                implicit none
1097                CHARACTER(len=*), INTENT(IN) :: varName
1098                INTEGER(kind=4), INTENT(OUT) :: DIMEN
1099                INTEGER(kind=C_SIZE_T), INTENT(OUT) :: R1, R2, R3, R4, R5
1100               
1101                CALL SZ_GetVarDim_c(varName, len(trim(varName)), DIMEN, R1, R2, R3, R4, R5)
1102               
1103        END SUBROUTINE SZ_GetVarDim
1104
1105        SUBROUTINE SZ_GetVarData_d1_Fortran_REAL_K4(varName, VAR)
1106                implicit none
1107                CHARACTER(len=*), INTENT(IN) :: varName
1108                REAL(KIND=4), DIMENSION(:), allocatable :: VAR
1109
1110                CALL SZ_getVarData_Float(varName, len(trim(varName)), VAR)
1111               
1112        END SUBROUTINE SZ_GetVarData_d1_Fortran_REAL_K4
1113       
1114        SUBROUTINE SZ_GetVarData_d2_Fortran_REAL_K4(varName, VAR)
1115                implicit none
1116                CHARACTER(len=*), INTENT(IN) :: varName
1117                REAL(KIND=4), DIMENSION(:,:), allocatable :: VAR
1118
1119                CALL SZ_getVarData_Float(varName, len(trim(varName)), VAR)
1120               
1121        END SUBROUTINE SZ_GetVarData_d2_Fortran_REAL_K4
1122
1123        SUBROUTINE SZ_GetVarData_d3_Fortran_REAL_K4(varName, VAR)
1124                implicit none
1125                CHARACTER(len=*), INTENT(IN) :: varName
1126                REAL(KIND=4), DIMENSION(:,:,:), allocatable :: VAR
1127
1128                CALL SZ_getVarData_Float(varName, len(trim(varName)), VAR)
1129               
1130        END SUBROUTINE SZ_GetVarData_d3_Fortran_REAL_K4
1131
1132        SUBROUTINE SZ_GetVarData_d4_Fortran_REAL_K4(varName, VAR)
1133                implicit none
1134                CHARACTER(len=*), INTENT(IN) :: varName
1135                REAL(KIND=4), DIMENSION(:,:,:,:), allocatable :: VAR
1136
1137                CALL SZ_getVarData_Float(varName, len(trim(varName)), VAR)
1138               
1139        END SUBROUTINE SZ_GetVarData_d4_Fortran_REAL_K4
1140
1141        SUBROUTINE SZ_GetVarData_d5_Fortran_REAL_K4(varName, VAR)
1142                implicit none
1143                CHARACTER(len=*), INTENT(IN) :: varName
1144                REAL(KIND=4), DIMENSION(:,:,:,:,:), allocatable :: VAR
1145
1146                CALL SZ_getVarData_Float(varName, len(trim(varName)), VAR)
1147               
1148        END SUBROUTINE SZ_GetVarData_d5_Fortran_REAL_K4
1149
1150        SUBROUTINE SZ_GetVarData_d1_Fortran_REAL_K8(varName, VAR)
1151                implicit none
1152                CHARACTER(len=*), INTENT(IN) :: varName
1153                REAL(KIND=8), DIMENSION(:), allocatable :: VAR
1154
1155                CALL SZ_getVarData_Double(varName, len(trim(varName)), VAR)
1156               
1157        END SUBROUTINE SZ_GetVarData_d1_Fortran_REAL_K8
1158       
1159        SUBROUTINE SZ_GetVarData_d2_Fortran_REAL_K8(varName, VAR)
1160                implicit none
1161                CHARACTER(len=*), INTENT(IN) :: varName
1162                REAL(KIND=8), DIMENSION(:,:), allocatable :: VAR
1163
1164                CALL SZ_getVarData_Double(varName, len(trim(varName)), VAR)
1165               
1166        END SUBROUTINE SZ_GetVarData_d2_Fortran_REAL_K8
1167
1168        SUBROUTINE SZ_GetVarData_d3_Fortran_REAL_K8(varName, VAR)
1169                implicit none
1170                CHARACTER(len=*), INTENT(IN) :: varName
1171                REAL(KIND=8), DIMENSION(:,:,:), allocatable :: VAR
1172
1173                CALL SZ_getVarData_Double(varName, len(trim(varName)), VAR)
1174               
1175        END SUBROUTINE SZ_GetVarData_d3_Fortran_REAL_K8
1176
1177        SUBROUTINE SZ_GetVarData_d4_Fortran_REAL_K8(varName, VAR)
1178                implicit none
1179                CHARACTER(len=*), INTENT(IN) :: varName
1180                REAL(KIND=8), DIMENSION(:,:,:,:), allocatable :: VAR
1181
1182                CALL SZ_getVarData_Double(varName, len(trim(varName)), VAR)
1183               
1184        END SUBROUTINE SZ_GetVarData_d4_Fortran_REAL_K8
1185
1186        SUBROUTINE SZ_GetVarData_d5_Fortran_REAL_K8(varName, VAR)
1187                implicit none
1188                CHARACTER(len=*), INTENT(IN) :: varName
1189                REAL(KIND=8), DIMENSION(:,:,:,:,:), allocatable :: VAR
1190
1191                CALL SZ_getVarData_Double(varName, len(trim(varName)), VAR)
1192               
1193        END SUBROUTINE SZ_GetVarData_d5_Fortran_REAL_K8
1194
1195END MODULE SZ
Note: See TracBrowser for help on using the repository browser.